Replying to myself just to confirm that https://www.sqlite.org/src/info/0b9d8a1202c4220f fixes the problem.
Thank you, Dan! Ralf On 20.12.2019 17:48, Ralf Junker wrote:
As of Fossil checkin f84a1539, the RBU code in the following C example is no longer executed to completion. Instead, an error message is generated and the result database is not correctly written. The code works fine with Fossil checkin 28091a48. It generates no error messages and produces the expected result database. The problem is still present on trunk, checkin 289158aa at the time of this writing. Could anyone reproduce my findings? Many thanks, Ralf ---------------------------------------------- #include <stdio.h> #include "sqlite3.h" #include "sqlite3rbu.h" static void check(int r, int e) { if (r != e) { printf ("ERROR %d, expected %d\n", e, r); } } static int callback (void *user, int nCol, char **r, char **c) { int i; for (i = 0; i < nCol; i++) { printf("%s ", r[i]); } printf("\n"); return 0; } static int runrbu(char *zTarget, char *zRbu) { sqlite3rbu* rbu; int rc; char* zError; rbu = sqlite3rbu_open (zTarget, zRbu, NULL); do { rc = sqlite3rbu_step(rbu); } while (rc == SQLITE_OK); rc = sqlite3rbu_close(rbu, &zError); if (zError) { printf("RBU error: %s\n", zError); sqlite3_free(zError); } return rc; } int main(void) { sqlite3 *db, *dbRbu; int rc; remove ("test.db"); check(SQLITE_OK, sqlite3_open_v2 ("test.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL)); check(SQLITE_OK, sqlite3_exec(db, "CREATE TABLE t1(a, b, c PRIMARY KEY);" \ "CREATE INDEX i1 ON t1(a, null, b+1);" \ "CREATE INDEX i2 ON t1(a+1, b+1, c+1);" \ "INSERT INTO t1 VALUES(1, 2, 3);" \ "INSERT INTO t1 VALUES(4, 5, 6);" \ "INSERT INTO t1 VALUES(7, 8, 9);" \ "INSERT INTO t1 VALUES(10, 11, 12);" , callback, NULL, NULL)); sqlite3_close(db); remove ("rbu.db"); check(SQLITE_OK, sqlite3_open_v2 ("rbu.db", &dbRbu, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL)); check(SQLITE_OK, sqlite3_exec(db, "CREATE TABLE data_t1(a, b, c, rbu_control);" \ "INSERT INTO data_t1 VALUES(13, 14, 15, 0);" \ "INSERT INTO data_t1 VALUES(NULL, NULL, 6, 1);" \ "INSERT INTO data_t1 VALUES(NULL, 'three', 3, '.x.');", callback, NULL, NULL)); sqlite3_close(dbRbu); check(SQLITE_DONE, runrbu("test.db", "rbu.db")); printf("Done - Press ENTER to exit.\n"); getchar(); return 0; }
_______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users