I have the following code to find a specific record in my "book" table and then change the "display_page" field...
Code: Select all
sqlyoga_setDefaultDatabase "Library" put sqlquery_createObject("book") into theQueryA put sqlrecord_createObject("book") into theRecordA sqlquery_set theQueryA, "conditions", "filename is ':1'", gTheBookFileName sqlquery_retrieveAsRecords theQueryA, theRecordA sqlrecord_set theRecordA, "display_page", gdisplay_page sqlrecord_set theRecordA, "filename", gTheBookFileName sqlrecord_update theRecordA
I successfully find the record, modify the record object with the new "display_page" value.
(I had to add the "filename" value as this is the primary key and it complained when it was not being updated.)
but when it tries to execute the sqlrecord_update I get the following error:
sqlyoga_executesql_err,0,0,book.name may not be NULL (UPDATE book SET current_book = NULL,id = NULL,name = NULL,display_page = :1 WHERE filename = 'ACourseinMiracl1340788553.sqlite')
Now I can both see where this comes from but also don't.
In the record object there are indeed "NULL"s against the mentioned fields.
But they are also mentioned in the "passthru" entry and have valid values in the returned record entry.
The record object looks like this:
Code: Select all
theRecordA 1 @table <-> book current_book <-> yes display_page <-> Text/combined_volume_002.html filename <-> ACourseinMiracl1340788553.sqlite id <-> a9f10048-1812-4141-bed7-c69ec69c27ea name <-> Course in Miracles @connection <-> the_Library @database <-> Library @passthru <-> name,id,current_book @table <-> book current_book <-> NULL display_page <-> Text/combined_volume_030.html filename <-> ACourseinMiracl1340788553.sqlite id <-> NULL name <-> NULL