Hello Richard, thanks for your reply. I think I have found the problem. I do the following: call sqlite3_bind_text() and then if successful I call sqlite3_step() on the prepared statement and then call sqlite3_reset(). This sequence is called 20 times as one SQL transaction. I have noticed that the problem occurs after about 20 transactions since power on. I have noticed that before sqlite3_bind_text() returns Error 21, the sqlite3_step() returns NO_MEM error. So, here maybe I am simply running out of RAM. I have only 160 K of RAM. What could I do here in order to free memory after sqlite3_step() for further operations. Regards
2015-09-21 14:08 GMT+02:00 Richard Hipp <drh at sqlite.org>: > On 9/21/15, Shuhrat Rahimov <sandrorkmv at gmail.com> wrote: > > Hi all, > > I have ported SQLite to an embedded ARM Cortex M4 based processor. a bare > > metal firmware is using SQLite, no OS. It seems to work but occasionaly > > bindText function fails. So, I am doing 20 inserts as a one transaction, > > but occasionally after 400-460 inserts bindText returns Error 21. I have > > seen that it is occuring in vdbeUnbind function, log is: "bind on a busy > > prepared statement". Could you help me to find out what the problem can > be? > > The prepared statement is still in use when you try to call > sqlite3_bind_text(). You can see this by adding "assert( > sqlite3_stmt_busy(pStmt) );" right before you call > sqlite3_bind_text(pStmt,...). This is an application-level error, not > a problem with SQLite or your port. > > You need to invoke sqlite3_reset() on a prepared statement that has > been previously used before you run sqlite3_bind_text() on that > prepared statement. > > -- > D. Richard Hipp > drh at sqlite.org > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >