Example #1
0
        public int InvokeBusyHandler()
        {
            if (C._NEVER(BusyHandler == null) || BusyHandler.Func == null || BusyHandler.Busys < 0)
            {
                return(0);
            }
            int rc = BusyHandler.Func(BusyHandler.Arg, BusyHandler.Busys);

            if (rc == 0)
            {
                BusyHandler.Busys = -1;
            }
            else
            {
                BusyHandler.Busys++;
            }
            return(rc);
        }
Example #2
0
 /*
 ** Invoke the given busy handler.
 **
 ** This routine is called when an operation failed with a lock.
 ** If this routine returns non-zero, the lock is retried.  If it
 ** returns 0, the operation aborts with an SQLITE_BUSY error.
 */
 static int sqlite3InvokeBusyHandler( BusyHandler p )
 {
   int rc;
   if ( NEVER( p == null ) || p.xFunc == null || p.nBusy < 0 )
     return 0;
   rc = p.xFunc( p.pArg, p.nBusy );
   if ( rc == 0 )
   {
     p.nBusy = -1;
   }
   else
   {
     p.nBusy++;
   }
   return rc;
 }