Ejemplo n.º 1
0
        static int tclvarBestIndex(sqlite3_vtab tab, ref sqlite3_index_info pIdxInfo)
        {
            int ii;

            for (ii = 0; ii < pIdxInfo.nConstraint; ii++)
            {
                sqlite3_index_constraint pCons = pIdxInfo.aConstraint[ii];
                if (pCons.iColumn == 0 && pCons.usable &&
                    pCons.op == SQLITE_INDEX_CONSTRAINT_EQ)
                {
                    sqlite3_index_constraint_usage pUsage = new sqlite3_index_constraint_usage();
                    pUsage           = pIdxInfo.aConstraintUsage[ii];
                    pUsage.omit      = false;
                    pUsage.argvIndex = 1;
                    return(SQLITE_OK);
                }
            }

            for (ii = 0; ii < pIdxInfo.nConstraint; ii++)
            {
                sqlite3_index_constraint pCons = pIdxInfo.aConstraint[ii];
                if (pCons.iColumn == 0 && pCons.usable &&
                    pCons.op == SQLITE_INDEX_CONSTRAINT_MATCH)
                {
                    sqlite3_index_constraint_usage pUsage = new sqlite3_index_constraint_usage();
                    pUsage           = pIdxInfo.aConstraintUsage[ii];
                    pUsage.omit      = true;
                    pUsage.argvIndex = 1;
                    return(SQLITE_OK);
                }
            }

            return(SQLITE_OK);
        }
static int tclvarBestIndex( sqlite3_vtab tab, ref sqlite3_index_info pIdxInfo )
{
  int ii;

  for(ii=0; ii<pIdxInfo.nConstraint; ii++){
    sqlite3_index_constraint  pCons = pIdxInfo.aConstraint[ii];
    if( pCons.iColumn==0 && pCons.usable
           && pCons.op==SQLITE_INDEX_CONSTRAINT_EQ ){
      sqlite3_index_constraint_usage pUsage = new sqlite3_index_constraint_usage();
      pUsage = pIdxInfo.aConstraintUsage[ii];
      pUsage.omit = false;
      pUsage.argvIndex = 1;
      return SQLITE_OK;
    }
  }

  for(ii=0; ii<pIdxInfo.nConstraint; ii++){
    sqlite3_index_constraint pCons = pIdxInfo.aConstraint[ii];
    if( pCons.iColumn==0 && pCons.usable
           && pCons.op==SQLITE_INDEX_CONSTRAINT_MATCH ){
      sqlite3_index_constraint_usage pUsage = new sqlite3_index_constraint_usage();
      pUsage = pIdxInfo.aConstraintUsage[ii];
      pUsage.omit = true;
      pUsage.argvIndex = 1;
      return SQLITE_OK;
    }
  }

  return SQLITE_OK;
}