in order to speed up table inserts, I've concatenated insert statements (all semicol terminated) into one single string (sqlCode
), which is PREPAREd then STEPed.
There are 10000 records in my test file, but only 1000 inserted records in the table.
What am I doing wrong?
I know i should bind parameters to the insert statements, but am new to this and learning: bound parameters will come next. Also, the return value (0) resets a counter used elsewhere.
Thanks.
Frank.
int loadBloc( sqlite3 *db, char *sqlCode )
{
int i;
int rc;
sqlite3_stmt *stmt = NULL;
/* TRANSACT !! */
sqlite3_exec(db, "BEGIN", 0, 0, 0);
//printf("%d\n",strlen(sqlCode));
rc = sqlite3_prepare_v2( db, sqlCode, -1 , &stmt, NULL );
checkRC( db, rc,SQLITE_OK , "Error: Failed to prepare.\n" );
rc = sqlite3_step(stmt);
checkRC( db, rc,SQLITE_DONE, "Error: Failed to load.\n" );
sqlite3_exec(db, "COMMIT", 0, 0, 0);
sqlite3_finalize(stmt);
sqlCode[0] = '\0';
return 0;
}