Hi all. I'm having difficulty binding variables to a statement. Here are the steps I'm taking:
* Create a statement in a loop ( parsing CSV headers ), in the form: insert into table( xxx, xxx, xxx ) values ( ?, ?, ? ); The above is working and I can dump valid-looking SQL at this point. The statement is prepared with the code: void prepare_sqlite_statement (struct db_stuff my_db_stuff) { int rc; rc = sqlite3_prepare_v2( sqlite3_db, my_db_stuff.sqlstr, -1, &my_db_stuff.stmt, NULL ); if (rc) { fprintf(stderr, "Error creating SQLite3 statement: %s\n", sqlite3_errmsg(sqlite3_db)); printf( "SQL was:\n%s", my_db_stuff.sqlstr ); exit(EXIT_FAILURE); } else { printf( "Statement successfully prepared. Return code: %d\n", rc ); } } ( pardon wrapping ). I'm getting a return code of 0, by the way, and my code outputs "Statement successfully prepared. Return code: 0" * Loop through values, calling sqlite3_bind_text on each of then: rc = sqlite3_bind_text( my_db_stuff->stmt, my_db_stuff->current_position + 1, local_buff, len, SQLITE_STATIC ); On the 1st call to the above, I get the return code 21, which I assume is 'SQLITE_MISUSE' from searching around. If I call sqlite3_errmsg(sqlite3_db) I get 'not an error'. What am I doing wrong? Dan _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users