コード例 #1
0
        static int intarrayEof(sqlite3_vtab_cursor cur)
        {
            intarray_cursor pCur  = (intarray_cursor)cur;
            intarray_vtab   pVtab = (intarray_vtab)cur.pVtab;

            return(pCur.i >= pVtab.pContent.n ? 1 : 0);
        }
コード例 #2
0
        /*
        ** Retrieve a column of data.
        */
        static int intarrayColumn(sqlite3_vtab_cursor cur, sqlite3_context ctx, int i)
        {
            intarray_cursor pCur  = (intarray_cursor)cur;
            intarray_vtab   pVtab = (intarray_vtab)cur.pVtab;

            if (pCur.i >= 0 && pCur.i < pVtab.pContent.n)
            {
                sqlite3_result_int64(ctx, pVtab.pContent.a[pCur.i]);
            }
            return(SQLITE_OK);
        }
コード例 #3
0
        /*
        ** Table constructor for the intarray module.
        */
        static int intarrayCreate(
            sqlite3 db,              /* Database where module is created */
            object pAux,             /* clientdata for the module */
            int argc,                /* Number of arguments */
            string[] argv,           /* Value for all arguments */
            out sqlite3_vtab ppVtab, /* Write the new virtual table object here */
            out string pzErr         /* Put error message text here */
            )
        {
            int           rc    = SQLITE_NOMEM;
            intarray_vtab pVtab = new intarray_vtab();//sqlite3_malloc(sizeof(intarray_vtab));

            if (pVtab != null)
            {
                //memset(pVtab, 0, sizeof(intarray_vtab));
                pVtab.pContent = (sqlite3_intarray)pAux;
                rc             = sqlite3_declare_vtab(db, "CREATE TABLE x(value INTEGER PRIMARY KEY)");
            }
            ppVtab = (sqlite3_vtab)pVtab;
            pzErr  = "";
            return(rc);
        }
コード例 #4
0
    /*
    ** Table constructor for the intarray module.
    */
    static int intarrayCreate(
      sqlite3 db,               /* Database where module is created */
      object pAux,              /* clientdata for the module */
      int argc,                 /* Number of arguments */
      string[] argv,   /* Value for all arguments */
      out sqlite3_vtab ppVtab,  /* Write the new virtual table object here */
      out string pzErr          /* Put error message text here */
    )
    {
      int rc = SQLITE_NOMEM;
      intarray_vtab pVtab = new intarray_vtab();//sqlite3_malloc(sizeof(intarray_vtab));

      if ( pVtab != null )
      {
        //memset(pVtab, 0, sizeof(intarray_vtab));
        pVtab.pContent = (sqlite3_intarray)pAux;
        rc = sqlite3_declare_vtab( db, "CREATE TABLE x(value INTEGER PRIMARY KEY)" );
      }
      ppVtab = (sqlite3_vtab)pVtab;
      pzErr = "";
      return rc;
    }