On 7/12/06, Gussimulator <[EMAIL PROTECTED]> wrote:

About the "cant read while writing", how to avoid this?, I cant stop my
system while using the database. There would be no point on having a
database then.

check the return code from operation, if it says Busy, or Locked,
the redo the operation. You may need to retry several times

// here's an example with a 1/2 second delay:
           sqlite3_busy_timeout(db, 500);
           bool locked = true;
           for ( int i = 0; ( i < 10 ) && ( locked ); i++ )
             switch ( sqlite3_step() )
               {
                 case SQLITE_BUSY:
                 case SQLITE_LOCKED:
                   break;
                 case SQLITE_ROW:
                 case SQLITE_DONE:
                   locked = false;
                   break;
                 default:
                   throw Exception( "Cannot execute sql" );
                   break;
               }

Reply via email to