Fix sqlite3_expert handling of triggers on views.
FossilOrigin-Name: ff4976da667872614331d88e68fb67d347874f164a1c7950dd738c7c2320b954
This commit is contained in:
parent
280db65e2c
commit
7853002c71
@ -135,8 +135,8 @@ int main(int argc, char **argv){
|
|||||||
}
|
}
|
||||||
fprintf(stdout, "%s\n%s\n", zIdx, zEQP);
|
fprintf(stdout, "%s\n%s\n", zIdx, zEQP);
|
||||||
}
|
}
|
||||||
}else if( zErr ){
|
}else{
|
||||||
fprintf(stderr, "Error: %s\n", zErr);
|
fprintf(stderr, "Error: %s\n", zErr ? zErr : "?");
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_expert_destroy(p);
|
sqlite3_expert_destroy(p);
|
||||||
|
@ -1136,6 +1136,9 @@ static int idxProcessOneTrigger(
|
|||||||
sqlite3_stmt *pX = 0;
|
sqlite3_stmt *pX = 0;
|
||||||
rc = sqlite3_prepare_v2(p->dbv, zWrite, -1, &pX, 0);
|
rc = sqlite3_prepare_v2(p->dbv, zWrite, -1, &pX, 0);
|
||||||
idxFinalize(&rc, pX);
|
idxFinalize(&rc, pX);
|
||||||
|
if( rc!=SQLITE_OK ){
|
||||||
|
idxDatabaseError(p->dbv, pzErr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sqlite3_free(zWrite);
|
sqlite3_free(zWrite);
|
||||||
|
|
||||||
@ -1174,15 +1177,20 @@ static int idxCreateVtabSchema(sqlite3expert *p, char **pzErrmsg){
|
|||||||
** 2) Create the equivalent virtual table in dbv.
|
** 2) Create the equivalent virtual table in dbv.
|
||||||
*/
|
*/
|
||||||
rc = idxPrepareStmt(p->db, &pSchema, pzErrmsg,
|
rc = idxPrepareStmt(p->db, &pSchema, pzErrmsg,
|
||||||
"SELECT type, name, sql FROM sqlite_master "
|
"SELECT type, name, sql, 1 FROM sqlite_master "
|
||||||
"WHERE type IN ('table','view') ORDER BY 1"
|
"WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%%' "
|
||||||
|
" UNION ALL "
|
||||||
|
"SELECT type, name, sql, 2 FROM sqlite_master "
|
||||||
|
"WHERE type = 'trigger'"
|
||||||
|
" AND tbl_name IN(SELECT name FROM sqlite_master WHERE type = 'view') "
|
||||||
|
"ORDER BY 4, 1"
|
||||||
);
|
);
|
||||||
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSchema) ){
|
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSchema) ){
|
||||||
const char *zType = (const char*)sqlite3_column_text(pSchema, 0);
|
const char *zType = (const char*)sqlite3_column_text(pSchema, 0);
|
||||||
const char *zName = (const char*)sqlite3_column_text(pSchema, 1);
|
const char *zName = (const char*)sqlite3_column_text(pSchema, 1);
|
||||||
const char *zSql = (const char*)sqlite3_column_text(pSchema, 2);
|
const char *zSql = (const char*)sqlite3_column_text(pSchema, 2);
|
||||||
|
|
||||||
if( zType[0]=='v' ){
|
if( zType[0]=='v' || zType[1]=='r' ){
|
||||||
rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg);
|
rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg);
|
||||||
}else{
|
}else{
|
||||||
IdxTable *pTab;
|
IdxTable *pTab;
|
||||||
|
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
|||||||
C Add\ssupport\sfor\sanalyzing\strigger\sprograms\sto\sthe\ssqlite3_expert\scode.
|
C Fix\ssqlite3_expert\shandling\sof\striggers\son\sviews.
|
||||||
D 2017-04-17T17:03:08.723
|
D 2017-04-18T09:04:48.670
|
||||||
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
|
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
|
||||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||||
F Makefile.msc 6a8c838220f7c00820e1fc0ac1bccaaa8e5676067e1dbfa1bafa7a4ffecf8ae6
|
F Makefile.msc 6a8c838220f7c00820e1fc0ac1bccaaa8e5676067e1dbfa1bafa7a4ffecf8ae6
|
||||||
@ -41,9 +41,9 @@ F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
|
|||||||
F ext/async/sqlite3async.c 0f3070cc3f5ede78f2b9361fb3b629ce200d7d74
|
F ext/async/sqlite3async.c 0f3070cc3f5ede78f2b9361fb3b629ce200d7d74
|
||||||
F ext/async/sqlite3async.h f489b080af7e72aec0e1ee6f1d98ab6cf2e4dcef
|
F ext/async/sqlite3async.h f489b080af7e72aec0e1ee6f1d98ab6cf2e4dcef
|
||||||
F ext/expert/README.md 9f15075ec5ad772808eff55ef044c31140fd1146aa0a3c47eafd155e71851b01
|
F ext/expert/README.md 9f15075ec5ad772808eff55ef044c31140fd1146aa0a3c47eafd155e71851b01
|
||||||
F ext/expert/expert.c 6349cf8d26c847f5f0fa7e25772b614c67f60f3c850dca0d75d55eb27cf3f69b
|
F ext/expert/expert.c 22d2dd096d479049bc332506fc8c0294bf53b7ebfe60af99635d8c87839bb40b
|
||||||
F ext/expert/expert1.test 6a50a1538dc9e4ff360fb117298aa3b085beed030cbe15dd36803da1a9f70702
|
F ext/expert/expert1.test 6a50a1538dc9e4ff360fb117298aa3b085beed030cbe15dd36803da1a9f70702
|
||||||
F ext/expert/sqlite3expert.c f9f41caf6d941b52ef76043f3191ab05294f4d286425e34923a7d74876014f0b
|
F ext/expert/sqlite3expert.c 8befe20906cf8f4928c754763cbf0a81f42fc1ee242fe8e5869c3bb4adba7300
|
||||||
F ext/expert/sqlite3expert.h b1c9eedeb647fd734c4206ae6851635284cfbfa5fb688eff74c3265c9f949b4d
|
F ext/expert/sqlite3expert.h b1c9eedeb647fd734c4206ae6851635284cfbfa5fb688eff74c3265c9f949b4d
|
||||||
F ext/expert/test_expert.c bad0611732d07180d586bd589cbb7713dc3ab0338c52bff29680eb2007678c05
|
F ext/expert/test_expert.c bad0611732d07180d586bd589cbb7713dc3ab0338c52bff29680eb2007678c05
|
||||||
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
|
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
|
||||||
@ -1579,7 +1579,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 2e6308798ae2db30564deb35ba3896597448edabbcac6efc4ff084552e42de30
|
P 159e8022a9d6701532b8b60e0c41154bc434c1bbdb107c8c97a78fb1140fa745
|
||||||
R 3935ba65365bf244da478b55268b3a1f
|
R 52d2320865ff7653f66201ecd375f3d6
|
||||||
U dan
|
U dan
|
||||||
Z 871de5d26699f20ec603c0a41beb3b11
|
Z e02fbf739534a0fe797908906bbc0c24
|
||||||
|
@ -1 +1 @@
|
|||||||
159e8022a9d6701532b8b60e0c41154bc434c1bbdb107c8c97a78fb1140fa745
|
ff4976da667872614331d88e68fb67d347874f164a1c7950dd738c7c2320b954
|
Loading…
Reference in New Issue
Block a user