示例#1
0
 /*
 ** External API function used to create a new virtual-table module.
 */
 static int sqlite3_create_module_v2(
     sqlite3 db,             /* Database in which module is registered */
     string zName,           /* Name assigned to this module */
     sqlite3_module pModule, /* The definition of the module */
     sqlite3_vtab pAux,      /* Context pointer for xCreate/xConnect */
     smdxDestroy xDestroy    /* Module destructor function */
     )
 {
     return(createModule(db, zName, pModule, pAux, xDestroy));
 }
示例#2
0
        /*
        ** The actual function that does the work of creating a new module.
        ** This function implements the sqlite3_create_module() and
        ** sqlite3_create_module_v2() interfaces.
        */
        static int createModule(
            sqlite3 db,             /* Database in which module is registered */
            string zName,           /* Name assigned to this module */
            sqlite3_module pModule, /* The definition of the module */
            object pAux,            /* Context pointer for xCreate/xConnect */
            smdxDestroy xDestroy    /* Module destructor function */
            )
        {
            int    rc, nName;
            Module pMod;

            sqlite3_mutex_enter(db.mutex);
            nName = sqlite3Strlen30(zName);
            pMod  = new Module();//  (Module)sqlite3DbMallocRaw( db, sizeof( Module ) + nName + 1 );
            if (pMod != null)
            {
                Module pDel;
                string zCopy;          // = (char )(&pMod[1]);
                zCopy         = zName; //memcpy(zCopy, zName, nName+1);
                pMod.zName    = zCopy;
                pMod.pModule  = pModule;
                pMod.pAux     = pAux;
                pMod.xDestroy = xDestroy;
                pDel          = (Module)sqlite3HashInsert(ref db.aModule, zCopy, nName, pMod);
                if (pDel != null && pDel.xDestroy != null)
                {
                    sqlite3ResetInternalSchema(db, -1);
                    pDel.xDestroy(ref pDel.pAux);
                }
                sqlite3DbFree(db, ref pDel);
                //if( pDel==pMod ){
                //  db.mallocFailed = 1;
                //}
            }
            else if (xDestroy != null)
            {
                xDestroy(ref pAux);
            }
            rc = sqlite3ApiExit(db, SQLITE_OK);
            sqlite3_mutex_leave(db.mutex);
            return(rc);
        }
示例#3
0
    /*
    ** The actual function that does the work of creating a new module.
    ** This function implements the sqlite3_create_module() and
    ** sqlite3_create_module_v2() interfaces.
    */
    static int createModule(
      sqlite3 db,              /* Database in which module is registered */
      string zName,            /* Name assigned to this module */
      sqlite3_module pModule,  /* The definition of the module */
      object pAux,             /* Context pointer for xCreate/xConnect */
      smdxDestroy xDestroy     /* Module destructor function */
    )
    {
      int rc, nName;
      Module pMod;

      sqlite3_mutex_enter( db.mutex );
      nName = sqlite3Strlen30( zName );
      pMod = new Module();//  (Module)sqlite3DbMallocRaw( db, sizeof( Module ) + nName + 1 );
      if ( pMod != null )
      {
        Module pDel;
        string zCopy;// = (char )(&pMod[1]);
        zCopy = zName;//memcpy(zCopy, zName, nName+1);
        pMod.zName = zCopy;
        pMod.pModule = pModule;
        pMod.pAux = pAux;
        pMod.xDestroy = xDestroy;
        pDel = (Module)sqlite3HashInsert( ref db.aModule, zCopy, nName, pMod );
        if ( pDel != null && pDel.xDestroy != null )
        {
          sqlite3ResetInternalSchema( db, -1 );
          pDel.xDestroy( ref pDel.pAux );
        }
        sqlite3DbFree( db, ref pDel );
        //if( pDel==pMod ){
        //  db.mallocFailed = 1;
        //}
      }
      else if ( xDestroy != null )
      {
        xDestroy( ref pAux );
      }
      rc = sqlite3ApiExit( db, SQLITE_OK );
      sqlite3_mutex_leave( db.mutex );
      return rc;
    }
示例#4
0
     //Version 2
     public     sqlite3_module(
      int iVersion,
      smdxCreateConnect xCreate,
      smdxCreateConnect xConnect,
      smdxBestIndex xBestIndex,
      smdxDisconnect xDisconnect,
      smdxDestroy xDestroy,
      smdxOpen xOpen,
      smdxClose xClose,
      smdxFilter xFilter,
      smdxNext xNext,
      smdxEof xEof,
      smdxColumn xColumn,
      smdxRowid xRowid,
      smdxUpdate xUpdate,
      smdxFunction xBegin,
      smdxFunction xSync,
      smdxFunction xCommit,
      smdxFunction xRollback,
      smdxFindFunction xFindFunction,
      smdxRename xRename,
 /* The methods above are in version 1 of the sqlite_module object. Those 
 ** below are for version 2 and greater. */
      smdxFunctionArg xSavepoint,
      smdxFunctionArg xRelease,
      smdxFunctionArg xRollbackTo
     )
     {
       this.iVersion = iVersion;
       this.xCreate = xCreate;
       this.xConnect = xConnect;
       this.xBestIndex = xBestIndex;
       this.xDisconnect = xDisconnect;
       this.xDestroy = xDestroy;
       this.xOpen = xOpen;
       this.xClose = xClose;
       this.xFilter = xFilter;
       this.xNext = xNext;
       this.xEof = xEof;
       this.xColumn = xColumn;
       this.xRowid = xRowid;
       this.xUpdate = xUpdate;
       this.xBegin = xBegin;
       this.xSync = xSync;
       this.xCommit = xCommit;
       this.xRollback = xRollback;
       this.xFindFunction = xFindFunction;
       this.xRename = xRename;
       this.xSavepoint = xSavepoint;
       this.xRelease = xRelease;
       this.xRollbackTo = xRollbackTo;
     }
示例#5
0
 //Version 1
   public sqlite3_module(
    int iVersion,
    smdxCreateConnect xCreate,
    smdxCreateConnect xConnect,
    smdxBestIndex xBestIndex,
    smdxDisconnect xDisconnect,
    smdxDestroy xDestroy,
    smdxOpen xOpen,
    smdxClose xClose,
    smdxFilter xFilter,
    smdxNext xNext,
    smdxEof xEof,
    smdxColumn xColumn,
    smdxRowid xRowid,
    smdxUpdate xUpdate,
    smdxFunction xBegin,
    smdxFunction xSync,
    smdxFunction xCommit,
    smdxFunction xRollback,
    smdxFindFunction xFindFunction,
    smdxRename xRename )
   {
     this.iVersion = iVersion;
     this.xCreate = xCreate;
     this.xConnect = xConnect;
     this.xBestIndex = xBestIndex;
     this.xDisconnect = xDisconnect;
     this.xDestroy = xDestroy;
     this.xOpen = xOpen;
     this.xClose = xClose;
     this.xFilter = xFilter;
     this.xNext = xNext;
     this.xEof = xEof;
     this.xColumn = xColumn;
     this.xRowid = xRowid;
     this.xUpdate = xUpdate;
     this.xBegin = xBegin;
     this.xSync = xSync;
     this.xCommit = xCommit;
     this.xRollback = xRollback;
     this.xFindFunction = xFindFunction;
     this.xRename = xRename;
   }
示例#6
0
 /*
 ** External API function used to create a new virtual-table module.
 */
 static int sqlite3_create_module_v2(
   sqlite3 db,               /* Database in which module is registered */
   string zName,             /* Name assigned to this module */
   sqlite3_module pModule,   /* The definition of the module */
   sqlite3_vtab pAux,        /* Context pointer for xCreate/xConnect */
   smdxDestroy xDestroy      /* Module destructor function */
 )
 {
   return createModule( db, zName, pModule, pAux, xDestroy );
 }