For any clsql experts here. For this particular bit of code:
http://gist.github.com/258247 I'm trying to select objects from one
database, and insert into another. I took out the create table
portion to illustrate the error in the 2nd part. Are there any ways
to select an object out of one database, and insert it into another?
The update* updates the record, which makes sense by its name..but I
would like to insert if possible.
code for those that don't want to click:
(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)))))
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]
Thanks for any help on this.
-David
...
(dolist (obj (query ...))
(setf (slot-value obj (intern "VIEW-DATABASE" 'clsql-sys)) nil)
(clsql:update-records-from ...))..
In short, the update-records.. method will look for if the accessor
view-database is set. When a select query is done, this object is
generated with this set to the instance of the database that was used
to get the result. The update method assumes that if this is set,
that we are updating the record - even if we pass a database instance
along to the method.
I hope if others run into this issue that this will help explain
what's going on.
-David
On Dec 16, 4:35 pm, "David Thole (TheDarkTrumpet)" <dth...@gmail.com>
wrote:
> Hey All,
>
> For any clsql experts here. For this particular bit of code:http://gist.github.com/258247I'm trying to select objects from one
Thanks for posting your solution. I encourage others as well to do the
same, it is very helpful that even if no external relies/solutions are
offered and the OP finds the solution in any other way, that he/she
inform the rest of us. Anyone with similar problem in the future would
search the google archives, finds this and hence life would be easier
(just like the OP intended).