Esempio n. 1
0
        /*
        ** Called to "rewind" a cursor back to the beginning so that
        ** it starts its output over again.  Always called at least once
        ** prior to any wholenumberColumn, wholenumberRowid, or wholenumberEof call.
        **
        **    idxNum   Constraints
        **    ------   ---------------------
        **      0      (none)
        **      1      value > $argv0
        **      2      value >= $argv0
        **      4      value < $argv0
        **      8      value <= $argv0
        **
        **      5      value > $argv0 AND value < $argv1
        **      6      value >= $argv0 AND value < $argv1
        **      9      value > $argv0 AND value <= $argv1
        **     10      value >= $argv0 AND value <= $argv1
        */
        static int wholenumberFilter(
            sqlite3_vtab_cursor pVtabCursor,
            int idxNum, string idxStr,
            int argc, sqlite3_value[] argv
            )
        {
            wholenumber_cursor pCur = (wholenumber_cursor)pVtabCursor;
            sqlite3_int64      v;
            int i = 0;

            pCur.iValue  = 1;
            pCur.mxValue = 0xffffffff; /* 4294967295 */
            if ((idxNum & 3) != 0)
            {
                v = sqlite3_value_int64(argv[0]) + (idxNum & 1);
                if (v > pCur.iValue && v <= pCur.mxValue)
                {
                    pCur.iValue = (uint)v;
                }
                i++;
            }
            if ((idxNum & 12) != 0)
            {
                v = sqlite3_value_int64(argv[i]) - ((idxNum >> 2) & 1);
                if (v >= pCur.iValue && v < pCur.mxValue)
                {
                    pCur.mxValue = (uint)v;
                }
            }
            return(SQLITE_OK);
        }
Esempio n. 2
0
        /*
        ** The rowid.
        */
        static int wholenumberRowid(sqlite3_vtab_cursor cur, out sqlite_int64 pRowid)
        {
            wholenumber_cursor pCur = (wholenumber_cursor)cur;

            pRowid = pCur.iValue;
            return(SQLITE_OK);
        }
Esempio n. 3
0
        /*
        ** Advance a cursor to its next row of output
        */
        static int wholenumberNext(sqlite3_vtab_cursor cur)
        {
            wholenumber_cursor pCur = (wholenumber_cursor)cur;

            pCur.iValue++;
            return(SQLITE_OK);
        }
Esempio n. 4
0
        /* The xDisconnect and xDestroy methods are also the same */


        /*
        ** Open a new wholenumber cursor.
        */
        static int wholenumberOpen(sqlite3_vtab p, out sqlite3_vtab_cursor ppCursor)
        {
            wholenumber_cursor pCur;

            pCur = new wholenumber_cursor();//sqlite3_malloc( sizeof(*pCur) );
            //if ( pCur == null )
            //  return SQLITE_NOMEM;
            //memset(pCur, 0, sizeof(*pCur));
            ppCursor = pCur;//.base;
            return(SQLITE_OK);
        }
Esempio n. 5
0
        /*
        ** Return the value associated with a wholenumber.
        */
        static int wholenumberColumn(
            sqlite3_vtab_cursor cur,
            sqlite3_context ctx,
            int i
            )
        {
            wholenumber_cursor pCur = (wholenumber_cursor)cur;

            sqlite3_result_int64(ctx, pCur.iValue);
            return(SQLITE_OK);
        }
    /* The xDisconnect and xDestroy methods are also the same */


    /*
    ** Open a new wholenumber cursor.
    */
    static int wholenumberOpen( sqlite3_vtab p, out sqlite3_vtab_cursor ppCursor )
    {
      wholenumber_cursor pCur;
      pCur = new wholenumber_cursor();//sqlite3_malloc( sizeof(*pCur) );
      //if ( pCur == null )
      //  return SQLITE_NOMEM;
      //memset(pCur, 0, sizeof(*pCur));
      ppCursor = pCur;//.base;
      return SQLITE_OK;
    }
Esempio n. 7
0
        /*
        ** When the wholenumber_cursor.rLimit value is 0 or less, that is a signal
        ** that the cursor has nothing more to output.
        */
        static int wholenumberEof(sqlite3_vtab_cursor cur)
        {
            wholenumber_cursor pCur = (wholenumber_cursor)cur;

            return((pCur.iValue > pCur.mxValue || pCur.iValue == 0) ? 1 : 0);
        }