1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Add a new sqlite3_test_control() that indicates that database files are

always well-formed.  Use this during testing to enable assert() statements
that prove conditions that are always true for well-formed databases.

FossilOrigin-Name: 15e4f63d1f3cbcd0aa789fd3e460cd6e4d3338f9
This commit is contained in:
drh
2013-11-29 15:06:27 +00:00
parent 1b4b334abb
commit 09fe614372
25 changed files with 169 additions and 33 deletions

View File

@@ -2538,6 +2538,7 @@ struct Sqlite3Config {
int bOpenUri; /* True to interpret filenames as URIs */
int bUseCis; /* Use covering indices for full-scans */
int mxStrlen; /* Maximum string length */
int neverCorrupt; /* Database is always well-formed */
int szLookaside; /* Default lookaside buffer size */
int nLookaside; /* Default lookaside buffer count */
sqlite3_mem_methods m; /* Low-level memory allocation interface */
@@ -2574,6 +2575,23 @@ struct Sqlite3Config {
#endif
};
/*
** This macro is used inside of assert() statements to indicate that
** the assert is only valid on a well-formed database. Instead of:
**
** assert( X );
**
** One writes:
**
** assert( X || CORRUPTIBLE );
**
** CORRUPTIBLE is true during normal operation. But for many test cases,
** it is set to false using a sqlite3_test_control(). This enables assert()
** statements to prove things that are always true for well-formed
** databases.
*/
#define CORRUPTIBLE (sqlite3Config.neverCorrupt==0)
/*
** Context pointer passed down through the tree-walk.
*/