On 5 Jul 2009, at 12:50am, Indiff3rence wrote:

> 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;

Forget all the fancy ways to speed up individual INSERT commands.  You  
could probably just use sqlite_exec.  Your speed problem is probably  
that you're not specifying that they're all the same transaction.  Do  
a 'BEGIN TRANSACTION' before the first one and a 'COMMIT' after the  
last one.

If you do want to use _prepare, try to use the _v2 versions of it and  
check to see that you're using _finalize correctly.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to