SQLite

Check-in [7126807a18]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the cost estimation in the BestIndex method of the eponymous pragma virtual table implementation.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | pragma-as-vtab
Files: files | file ages | folders
SHA1: 7126807a186746a8663fbaa267d63214d06476e4
User & Date: drh 2016-12-15 21:33:55.724
Context
2016-12-16
01:09
Merge enhancements from trunk, and especially the ability to use temp.sqlite_master as an alias for sqlite_temp_master. (check-in: 994a4401f5 user: drh tags: pragma-as-vtab)
2016-12-15
21:33
Fix the cost estimation in the BestIndex method of the eponymous pragma virtual table implementation. (check-in: 7126807a18 user: drh tags: pragma-as-vtab)
21:11
The pragma as eponymous virtual table mechanism now appears to work. (check-in: 2c274a1a7b user: drh tags: pragma-as-vtab)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pragma.c.
2052
2053
2054
2055
2056
2057
2058

2059
2060
2061
2062
2063
2064
2065
*/
static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
  PragmaVtab *pTab = (PragmaVtab*)tab;
  const struct sqlite3_index_constraint *pConstraint;
  int i, j;
  int seen[2];


  if( pTab->nHidden==0 ){ return SQLITE_OK; }
  pConstraint = pIdxInfo->aConstraint;
  seen[0] = 0;
  seen[1] = 0;
  for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
    if( pConstraint->usable==0 ) continue;
    if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;







>







2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
*/
static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
  PragmaVtab *pTab = (PragmaVtab*)tab;
  const struct sqlite3_index_constraint *pConstraint;
  int i, j;
  int seen[2];

  pIdxInfo->estimatedCost = (double)1;
  if( pTab->nHidden==0 ){ return SQLITE_OK; }
  pConstraint = pIdxInfo->aConstraint;
  seen[0] = 0;
  seen[1] = 0;
  for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
    if( pConstraint->usable==0 ) continue;
    if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;