I don't have any real problem this time, just wondered if our C# wrapper is
programmed correctly/efficiently.

Suppose we prepared a statement using sqlite3_prepare_v2(). Could please
anybody explain how to treat above mentioned error codes returned by
sqlite3_step()?

Our C# wrapper (inspired by system.data.sqlite) uses this quasi-code:

bool Step(stmt)
{
  while(true)
  {
    start time measurement
    rc = sqlite3_step(stmt);
    if( rc == SQLITE_ROW) return true;    // ... reading column values
possible
    if( rc == SQLITE_DONE) return false;  // ... done

    rc = sqlite3_reset(stmt);    // needed? looks strange to me

    if( rc!=SQLITE_LOCKED && rc!=SQLITE_BUSY)
        throw an exception (message taken from sqlite3_errmsg())
    else {
        if timeout expired => throw a timeout exception
        else sleep a bit
    }
  }
}

If I understand sqlite3_reset correctly (i.e. when it is called after some
table rows are read, then it returns to the first row), then this code looks
buggy.

My web research yielded only unclear (sometimes even contradictory) results,
even from guys who are supposed to understand SQLite internals.

Could please somebody shed more light onto this problem?




--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/sqlite3-step-and-SQLITE-LOCKED-BUSY-tp77690.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to