Pyramide-Ingenierie Developer List wrote:
Hello,

I am using SQLite 3.3.8 library on Mac OS X using XCode 2.4.1 (gcc 4.0)...

I try to compile only once an SQL instruction like "INSERT INTO Book (author_fk,title,date,time,price,created) VALUES (?,?,?,?,?,?);" and insert multiple rows through a (sqlite3_bind_xxx / sqlite3_bind_step) loop but I everytime got errors...

Does looping through step is only available for "SELECT" ? Cannot we think that a compiled SQL statement could be reuse many times as long as only the bindings change ?

I try to use "sqlite3_reset()" and/or "sqlite3_clear_bindings()" before "re-binds" and "re-step" but I always get an error 21 (SQLITE_MISUSE) when I am calling them on a already used sqlite3_stmt...

Here is a summary of what I try to do:

    sqlite3_prepare

    // insert first row
    sqlite3_reset()
    sqlite3_clear_bindings()
    sqlite3_bind_xxx()
    sqlite3_bind_xxx()
    ...
    sqlite3_bind_xxx()
    sqlite3_step

    // insert second row
    sqlite3_reset()
    sqlite3_clear_bindings()
    sqlite3_bind_xxx()
    sqlite3_bind_xxx()
    ...
    sqlite3_bind_xxx()
    sqlite3_step

    etc...

I do not know why functions like "sqlite3_reset()" and "sqlite3_clear_bindings()" exist if it is not for doing this ?

Regards,

Luc Demarche



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


See this thread http://www.mail-archive.com/sqlite-users@sqlite.org/msg14937.html for some example programs that do lots of INSERTS into a database using prepared statements.

HTH
Dennis Cote

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to