396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
|
(stmt1 (conc "INSERT OR IGNORE INTO "todb table
" SELECT * FROM "fromdb table";"))
(stmt8 (conc "UPDATE "todb table" SET ("no-id-fields-str") = (SELECT "no-id-fields-str" FROM "fromdb table" WHERE "todb table".id="fromdb table".id"
(if (member "last_update" fields)
(conc " AND "fromdb table".last_update > "todb table".last_update);")
");")))
(start-ms (current-milliseconds)))
(debug:print 0 *default-log-port* "stmt8="stmt8)
(if (sqlite3:auto-committing? dbh)
(begin
(sqlite3:with-transaction
dbh
(lambda ()
(sqlite3:execute dbh stmt1) ;; get all new rows
|
|
|
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
|
(stmt1 (conc "INSERT OR IGNORE INTO "todb table
" SELECT * FROM "fromdb table";"))
(stmt8 (conc "UPDATE "todb table" SET ("no-id-fields-str") = (SELECT "no-id-fields-str" FROM "fromdb table" WHERE "todb table".id="fromdb table".id"
(if (member "last_update" fields)
(conc " AND "fromdb table".last_update > "todb table".last_update);")
");")))
(start-ms (current-milliseconds)))
;; (debug:print 0 *default-log-port* "stmt8="stmt8)
(if (sqlite3:auto-committing? dbh)
(begin
(sqlite3:with-transaction
dbh
(lambda ()
(sqlite3:execute dbh stmt1) ;; get all new rows
|