Пример #1
0
    /*
** Register a statically linked extension that is automatically
** loaded by every new database connection.
*/
    static int sqlite3_auto_extension( dxInit xInit )
    {
      int rc = SQLITE_OK;
#if !SQLITE_OMIT_AUTOINIT
      rc = sqlite3_initialize();
      if ( rc != 0 )
      {
        return rc;
      }
      else
#endif
      {
        int i;
#if SQLITE_THREADSAFE
        sqlite3_mutex mutex = sqlite3MutexAlloc( SQLITE_MUTEX_STATIC_MASTER );
#else
        sqlite3_mutex mutex = sqlite3MutexAlloc( SQLITE_MUTEX_STATIC_MASTER );
#endif
        wsdAutoextInit();
        sqlite3_mutex_enter( mutex );
        for ( i = 0; i < wsdAutoext.nExt; i++ )
        {
          if ( wsdAutoext.aExt[i] == xInit )
            break;
        }
        //if( i==wsdAutoext.nExt ){
        //  int nByte = (wsdAutoext.nExt+1)*sizeof(wsdAutoext.aExt[0]);
        //  void **aNew;
        //  aNew = sqlite3_realloc(wsdAutoext.aExt, nByte);
        //  if( aNew==0 ){
        //    rc = SQLITE_NOMEM;
        //  }else{
        Array.Resize( ref wsdAutoext.aExt, wsdAutoext.nExt + 1 );//        wsdAutoext.aExt = aNew;
        wsdAutoext.aExt[wsdAutoext.nExt] = xInit;
        wsdAutoext.nExt++;
        //}
        sqlite3_mutex_leave( mutex );
        Debug.Assert( ( rc & 0xff ) == rc );
        return rc;
      }
    }
Пример #2
0
 public dxInit[] aExt = null;    /* Pointers to the extension init functions */
 public sqlite3AutoExtList( int nExt, dxInit[] aExt )
 {
   this.nExt = nExt;
   this.aExt = aExt;
 }