Re: Question about update-records-from-instance

Thijs Oppermann <[email protected]>
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
I'd start by doing:

(start-sql-recording :type :both)

This outputs all the statements clsql is running against the database
in your REPL. Handy for debugging.

For the rest, update-records-from-instance is for adding or updating
based on OODML, i.e. from an object created by def-view-class. I think
you need to actually build the correct sql statement if you want to do
what you seem to want to do in your code snippet (sorry, hurried
reply... )

Gr,
Thijs

On Wed, Dec 16, 2009 at 10:31 PM, David Thole <[email protected]> wrote:
> Hey all,
> I'm trying to run the code, something like below:
> (defun build-sqlite-db ()
>   (with-generic-wordnet-mssql-connection (dbms)
>     (with-generic-wordnet-sqlite-connection (sqlitedb)
> ;      (clsql:create-view-from-class 'worddef :database sqlitedb)
>
>
>       (dolist (obj (query-db :word "cat" :tbl 'worddef :db dbms))
>         (clsql:update-records-from-instance obj :database sqlitedb)))))
>
> Error:
> While accessing database #<SQLITE3-DATABASE db/wordnet.sqlite3 OPEN
> {1003013921}>
>
>   with expression "UPDATE WORD_DEFS SET LEMMA = 'cat',POS = 'n',DEFIN...":
>
>
>   Error 1 / no such table: WORD_DEFS
>
>
>   has occurred.
>    [Condition of type CLSQL-SYS:SQL-DATABASE-DATA-ERROR]
> The goal I'm trying to do is query from MSSQL (which works), and then insert
> the data into the sqlite database.  I wanted to generate the error, to
> illustrate what the update-records is doing.  With it uncommented out, it'll
> execute just fine...just not insert records.
> Is there a good way to accomplish what I'm trying to do?  I was hoping for
> an insert-records-from-instance, but couldn't find anything that did that.
> -David
> _______________________________________________
> CLSQL mailing list
> [email protected]
> http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
>
>
_______________________________________________
CLSQL mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.