1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Enable query invariant checking in fuzzcheck by default. There is no way

to turn it off.  Update the invariant checking logic to be consistant with
dbsqlfuzz.

FossilOrigin-Name: 66ca729bbbf37cb7ff8eb12f51429e0c0833bd5d3f0ef20a1eaeeb10820713c2
This commit is contained in:
drh
2022-06-18 20:20:30 +00:00
parent d0d21f5565
commit 13736999d9
4 changed files with 51 additions and 25 deletions

View File

@@ -109,7 +109,7 @@ int fuzz_invariant(
}
if( i>=nCol ) break;
}
if( rc!=SQLITE_ROW && rc!=SQLITE_NOMEM ){
if( rc==SQLITE_DONE ){
/* No matching output row found */
sqlite3_stmt *pCk = 0;
rc = sqlite3_prepare_v2(db, "PRAGMA integrity_check", -1, &pCk, 0);
@@ -183,8 +183,9 @@ static char *fuzz_invariant_sql(sqlite3_stmt *pStmt, int iCnt){
while( nIn>0 && (isspace(zIn[nIn-1]) || zIn[nIn-1]==';') ) nIn--;
if( strchr(zIn, '?') ) return 0;
pTest = sqlite3_str_new(0);
sqlite3_str_appendf(pTest, "SELECT %s* FROM (%.*s)",
bDistinct ? "DISTINCT " : "", (int)nIn, zIn);
sqlite3_str_appendf(pTest, "SELECT %s* FROM (%s",
bDistinct ? "DISTINCT " : "", zIn);
sqlite3_str_appendf(pTest, ")");
rc = sqlite3_prepare_v2(db, sqlite3_str_value(pTest), -1, &pBase, 0);
if( rc ){
sqlite3_finalize(pBase);