1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Enhance the sqlite3_normalize_sql() interface so that it works even if the

prepared statement was not initially compiled using
SQLITE_PREPARE_NORMALIZED.  Enhance the ".trace" command in the CLI so that
it is able to access the full scope of functionality provided by 
sqlite3_trace_v2() and in particular so that it is able to show normalized
SQL output using the newly enhanced sqlite3_normalize_sql() interface.

FossilOrigin-Name: 7da617e97eb905cb009c47403786682b911e32a630f266e1c53ea72836fc88b5
This commit is contained in:
drh
2018-12-05 13:39:06 +00:00
parent 731dd6ebda
commit 707821ff72
10 changed files with 159 additions and 69 deletions

View File

@@ -1712,7 +1712,11 @@ char *sqlite3_expanded_sql(sqlite3_stmt *pStmt){
*/
const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt){
Vdbe *p = (Vdbe *)pStmt;
return p ? p->zNormSql : 0;
if( p==0 ) return 0;
if( p->zNormSql==0 && p->zSql!=0 ){
p->zNormSql = sqlite3Normalize(p, p->zSql, sqlite3Strlen30(p->zSql));
}
return p->zNormSql;
}
#endif /* SQLITE_ENABLE_NORMALIZE */