The pragma as eponymous virtual table mechanism now appears to work.

FossilOrigin-Name: 2c274a1a7b57ef1208901fbc1d96d39c0d492652
This commit is contained in:
drh 2016-12-15 21:11:15 +00:00
parent 2fcc1590c4
commit d7175ebeaf
3 changed files with 13 additions and 17 deletions

View File

@ -1,5 +1,5 @@
C Code\sto\sautomatically\screate\seponymous\svirtual\stables\sfor\sread-only\spragmas.\nCompiles,\sbut\sdoes\snot\syet\swork.
D 2016-12-15T20:59:03.895
C The\spragma\sas\seponymous\svirtual\stable\smechanism\snow\sappears\sto\swork.
D 2016-12-15T21:11:15.541
F Makefile.in c194b58fe00c370a48ac6ae6945e92a7781db1c8
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@ -381,7 +381,7 @@ F src/parse.y 29153738a7322054359320eb00b5a4cd44389f20
F src/pcache.c 51070ec9b8251bbf9c6ea3d35fd96a458752929e
F src/pcache.h 2cedcd8407eb23017d92790b112186886e179490
F src/pcache1.c e3967219b2a92b9edcb9324a4ba75009090d3953
F src/pragma.c b2421f23af876cb7a2f9aca09e803e207a4750f1
F src/pragma.c db1d2ae01ad327b2c1d348924cdb11bbe1a54dcf
F src/pragma.h f9b221b2c8949ea941dbee49934299e4ed5af41c
F src/prepare.c b1140c3d0cf59bc85ace00ce363153041b424b7a
F src/printf.c f94da4935d1dd25420ac50c6745db1deb35e07c1
@ -1536,10 +1536,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P a88ca3524b97f296dffc68335466b3767a681747
R 23c19e6ab9e9f56bda2263bb45958620
T *branch * pragma-as-vtab
T *sym-pragma-as-vtab *
T -sym-table-driven-pragma *
P 988a61e8b03f302c69d11898d1ea95f002cba1a5
R fc9b9c22fa99573809efcbc3a3ada70d
U drh
Z 91a2192a11c3bfa409136450c9378cb1
Z 6fcba4a1d98b45e26069fbc257e90ccd

View File

@ -1 +1 @@
988a61e8b03f302c69d11898d1ea95f002cba1a5
2c274a1a7b57ef1208901fbc1d96d39c0d492652

View File

@ -1999,8 +1999,7 @@ static int pragmaVtabConnect(
sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0);
sqlite3StrAccumAppendAll(&acc, "CREATE TABLE x");
for(i=0, j=pPragma->iPragCName; i<pPragma->nPragCName; i++, j++){
sqlite3StrAccumAppend(&acc, &cSep, 1);
sqlite3StrAccumAppendAll(&acc, pragCName[j]);
sqlite3XPrintf(&acc, "%c\"%s\"", cSep, pragCName[j]);
cSep = ',';
}
j = 0;
@ -2068,20 +2067,20 @@ static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
j = pConstraint->iColumn - pTab->iHidden;
assert( j < 2 );
if( seen[j] ) continue;
seen[j] = i;
seen[j] = i+1;
}
if( seen[0]==0 ){
pIdxInfo->estimatedCost = (double)2147483647;
pIdxInfo->estimatedRows = 2147483647;
return SQLITE_OK;
}
j = seen[0];
j = seen[0]-1;
pIdxInfo->aConstraintUsage[j].argvIndex = 1;
pIdxInfo->aConstraintUsage[j].omit = 1;
if( seen[1]==0 ) return SQLITE_OK;
pIdxInfo->estimatedCost = (double)20;
pIdxInfo->estimatedRows = 20;
j = seen[1];
j = seen[1]-1;
pIdxInfo->aConstraintUsage[j].argvIndex = 2;
pIdxInfo->aConstraintUsage[j].omit = 1;
return SQLITE_OK;
@ -2156,7 +2155,7 @@ static int pragmaVtabFilter(
return SQLITE_NOMEM;
}
}
sqlite3StrAccumInit(&acc, 0, 0, 0, pTab->db->aLimit[SQLITE_MAX_SQL_LENGTH]);
sqlite3StrAccumInit(&acc, 0, 0, 0, pTab->db->aLimit[SQLITE_LIMIT_SQL_LENGTH]);
sqlite3StrAccumAppendAll(&acc, "PRAGMA ");
if( pCsr->azArg[1] ){
sqlite3XPrintf(&acc, "%Q.", pCsr->azArg[1]);
@ -2250,7 +2249,7 @@ Module *sqlite3PragmaVtabRegister(sqlite3 *db, const char *zName){
if( pName==0 ) return 0;
if( (pName->mPragFlg & (PragFlg_Result0|PragFlg_Result1))==0 ) return 0;
assert( sqlite3HashFind(&db->aModule, zName)==0 );
return sqlite3VtabCreateModule(db, zName, &pragmaVtabModule, 0, 0);
return sqlite3VtabCreateModule(db, zName, &pragmaVtabModule, (void*)pName, 0);
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */