Hello,

I'm new to SQLite programming. I need to insert a great number of entries to
a DB, but my implementation is slow.
I've done a function that prepares a statement and returns it, like this:

const char *zSql = "INSERT INTO codewords( id, degree, seed, buffer )
VALUES( ?, ?, ?, ? )"; 
sqlite3_prepare( db, zSql, -1, &pStmt, 0 );
return pStmt;

Then I have another function that takes that statement. This function will
be called several times with different values to bind to the statement, so I
can insert different values:

sqlite3_reset( pStmt );
sqlite3_clear_bindings( pStmt );

sqlite3_bind_int( pStmt, 1, *id );
sqlite3_bind_int( pStmt, 2, *degree );
sqlite3_bind_int( pStmt, 3, *seed );
sqlite3_bind_blob( pStmt, 4, buffer, size, SQLITE_STATIC );

sqlite3_step( pStmt );

My question is: why is necessary to reset the statement before I can rebind
it?
It should work only if I clear the old bind, no? 

Thanks,

Pedro Saraiva
-- 
View this message in context: 
http://www.nabble.com/Rebind-Statement-tp24339026p24339026.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

Reply via email to