Hello everyone, I don't understand why when I use the sqlite3_prepare_v2() function, some bind_xxx, and then commit, the data stored in my database are redundant..
To be more precise, when I run my code (see below), I obtain this in my database : 1|s||| 2|s|t|| 3|s|t|y| 4|s|t|y|ve ==================================== ============ Part of the code =========== sprintf(insert_data,"INSERT INTO %s(pid, class_id, instance_id, dataset) VALUES(?,?,?,?)", table_name); const char *zSql = insert_data; sqlite3_exec(db, "BEGIN", NULL, NULL, NULL); if( sqlite3_prepare_v2(db, zSql, strlen(zSql)+1, &ppStmt, pzTail) != SQLITE_OK ) { sqlite3_close(db); exit(1); } if(ppStmt) { sqlite3_bind_blob(ppStmt, 1, &pid_value, sizeof(pid_value), SQLITE_TRANSIENT); sqlite3_step(ppStmt); sqlite3_reset(ppStmt); sqlite3_bind_blob(ppStmt, 2, &class_id_value, sizeof(class_id_value), SQLITE_TRANSIENT); sqlite3_step(ppStmt); sqlite3_reset(ppStmt); sqlite3_bind_blob(ppStmt, 3, &instance_id_value, sizeof(instance_id_value), SQLITE_TRANSIENT); sqlite3_step(ppStmt); sqlite3_reset(ppStmt); sqlite3_bind_blob(ppStmt, 4, &dataset_struct, sizeof(dataset_struct), SQLITE_TRANSIENT); sqlite3_step(ppStmt); sqlite3_finalize(ppStmt); sqlite3_exec(db, "COMMIT", NULL, NULL, NULL); } ==================================== ==================================== Is there an error in the code? Or is it impossible to submit all data in one time without specifying the PRIMARY_ID? -- View this message in context: http://old.nabble.com/Problem-with-sqlite3_prepare_v2--tp31636159p31636159.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users