aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-09-07 14:59:15 +0000
committerdrh <drh@noemail.net>2010-09-07 14:59:15 +0000
commit4e93f5bf90e33e05cf43c6961cb15d5ef1cc588c (patch)
tree1e21fdf6f1cd0213e44dfe403897e01af0b1e7a4
parent06ae6792712fdacfb0a813f6ee72f1e7e755134f (diff)
downloadsqlite-4e93f5bf90e33e05cf43c6961cb15d5ef1cc588c.tar.gz
sqlite-4e93f5bf90e33e05cf43c6961cb15d5ef1cc588c.zip
Revised documentation for sqlite3_limit(). Added some evidence marks and
assert() statements to verify sqlite3_limit() behavior. FossilOrigin-Name: 883b9b7441593200def05d8a482bc92d3dc0e96b
-rw-r--r--manifest26
-rw-r--r--manifest.uuid2
-rw-r--r--src/main.c28
-rw-r--r--src/sqlite.h.in18
4 files changed, 55 insertions, 19 deletions
diff --git a/manifest b/manifest
index 29c24f4fd..7aeae15ba 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,8 @@
-C Example\sicon\sfile\s(32x32x4)\sfor\snew\slogo.
-D 2010-09-07T14:12:14
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+C Revised\sdocumentation\sfor\ssqlite3_limit().\s\sAdded\ssome\sevidence\smarks\sand\nassert()\sstatements\sto\sverify\ssqlite3_limit()\sbehavior.
+D 2010-09-07T14:59:16
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -139,7 +142,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
F src/loadext.c 6d422ea91cf3d2d00408c5a8f2391cd458da85f8
-F src/main.c 57869e792971cc202f77b69bde87454a821f8119
+F src/main.c ca8eadcf620f0b48fdf33d0bb63115214e798bc0
F src/malloc.c e0e9ca16a90215e2f0b53e7f5cc17abe01fbe34a
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 00bd8265c81abb665c48fea1e0c234eb3b922206
@@ -174,7 +177,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F src/select.c b0b124781474e4e0c8f64022875e5e2009e13443
F src/shell.c 8517fc1f9c59ae4007e6cc8b9af91ab231ea2056
-F src/sqlite.h.in d867122e53a24b9a11864a7aaf2509cad62c55b2
+F src/sqlite.h.in 0c8362d432a4317a334bb6aab5ee92253f706fb5
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
F src/sqliteInt.h 4e31d3b58720d6251e08ba394641b9a63725eb8a
F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44
@@ -857,7 +860,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 657472bce2b2fe6f3d4bbead5301f658812b937d
-R 623cfca513f7bdb142e745f695a90cac
-U shaneh
-Z 2cc81c97140a2abcebcf774d4ef8c00a
+P bd700794678613c1fb78ef9fcf2bcd6d48f70dc0
+R 69716d22de4bcacc6f3b2e000a39c9a7
+U drh
+Z 5525c419763660d5eabe8aec9d844974
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFMhlNHoxKgR168RlERAob+AJ9myxkLwt0lv7Z/fVE48Z/mxrAPdQCeKHEr
+v8vaa6Ji96D59ok+PxHqpsk=
+=85Kf
+-----END PGP SIGNATURE-----
diff --git a/manifest.uuid b/manifest.uuid
index 26c5dd065..ce495703b 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-bd700794678613c1fb78ef9fcf2bcd6d48f70dc0 \ No newline at end of file
+883b9b7441593200def05d8a482bc92d3dc0e96b \ No newline at end of file
diff --git a/src/main.c b/src/main.c
index 7b4fa253c..92069a427 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1673,17 +1673,39 @@ static const int aHardLimit[] = {
*/
int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
int oldLimit;
+
+
+ /* EVIDENCE-OF: R-30189-54097 For each limit category SQLITE_LIMIT_NAME
+ ** there is a hard upper bound set at compile-time by a C preprocessor
+ ** macro called SQLITE_MAX_NAME. (The "_LIMIT_" in the name is changed to
+ ** "_MAX_".)
+ */
+ assert( aHardLimit[SQLITE_LIMIT_LENGTH]==SQLITE_MAX_LENGTH );
+ assert( aHardLimit[SQLITE_LIMIT_SQL_LENGTH]==SQLITE_MAX_SQL_LENGTH );
+ assert( aHardLimit[SQLITE_LIMIT_COLUMN]==SQLITE_MAX_COLUMN );
+ assert( aHardLimit[SQLITE_LIMIT_EXPR_DEPTH]==SQLITE_MAX_EXPR_DEPTH );
+ assert( aHardLimit[SQLITE_LIMIT_COMPOUND_SELECT]==SQLITE_MAX_COMPOUND_SELECT);
+ assert( aHardLimit[SQLITE_LIMIT_VDBE_OP]==SQLITE_MAX_VDBE_OP );
+ assert( aHardLimit[SQLITE_LIMIT_FUNCTION_ARG]==SQLITE_MAX_FUNCTION_ARG );
+ assert( aHardLimit[SQLITE_LIMIT_ATTACHED]==SQLITE_MAX_ATTACHED );
+ assert( aHardLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]==
+ SQLITE_MAX_LIKE_PATTERN_LENGTH );
+ assert( aHardLimit[SQLITE_LIMIT_VARIABLE_NUMBER]==SQLITE_MAX_VARIABLE_NUMBER);
+ assert( aHardLimit[SQLITE_LIMIT_TRIGGER_DEPTH]==SQLITE_MAX_TRIGGER_DEPTH );
+ assert( SQLITE_LIMIT_TRIGGER_DEPTH==(SQLITE_N_LIMIT-1) );
+
+
if( limitId<0 || limitId>=SQLITE_N_LIMIT ){
return -1;
}
oldLimit = db->aLimit[limitId];
- if( newLimit>=0 ){
+ if( newLimit>=0 ){ /* IMP: R-52476-28732 */
if( newLimit>aHardLimit[limitId] ){
- newLimit = aHardLimit[limitId];
+ newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */
}
db->aLimit[limitId] = newLimit;
}
- return oldLimit;
+ return oldLimit; /* IMP: R-53341-35419 */
}
/*
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 6edb8348c..3cbf47c6a 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -2395,17 +2395,22 @@ typedef struct sqlite3_stmt sqlite3_stmt;
** [database connection] whose limit is to be set or queried. The
** second parameter is one of the [limit categories] that define a
** class of constructs to be size limited. The third parameter is the
-** new limit for that construct. The function returns the old limit.)^
+** new limit for that construct.)^
**
** ^If the new limit is a negative number, the limit is unchanged.
-** ^(For the limit category of SQLITE_LIMIT_XYZ there is a
+** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a
** [limits | hard upper bound]
-** set by a compile-time C preprocessor macro named
-** [limits | SQLITE_MAX_XYZ].
+** set at compile-time by a C preprocessor macro called
+** [limits | SQLITE_MAX_<i>NAME</i>].
** (The "_LIMIT_" in the name is changed to "_MAX_".))^
** ^Attempts to increase a limit above its hard upper bound are
** silently truncated to the hard upper bound.
**
+** ^Regardless of whether or not the limit was changed, the
+** [sqlite3_limit()] interface returns the prior value of the limit.
+** ^Hence, to find the current value of a limit without changing it,
+** simply invoke this interface with the third parameter set to -1.
+**
** Run-time limits are intended for use in applications that manage
** both their own internal database and also databases that are controlled
** by untrusted external sources. An example application might be a
@@ -2434,7 +2439,7 @@ int sqlite3_limit(sqlite3*, int id, int newVal);
**
** <dl>
** ^(<dt>SQLITE_LIMIT_LENGTH</dt>
-** <dd>The maximum size of any string or BLOB or table row.<dd>)^
+** <dd>The maximum size of any string or BLOB or table row, in bytes.<dd>)^
**
** ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>
** <dd>The maximum length of an SQL statement, in bytes.</dd>)^
@@ -2465,8 +2470,7 @@ int sqlite3_limit(sqlite3*, int id, int newVal);
** [GLOB] operators.</dd>)^
**
** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>
-** <dd>The maximum number of variables in an SQL statement that can
-** be bound.</dd>)^
+** <dd>The maximum index number of any [parameter] in an SQL statement.)^
**
** ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
** <dd>The maximum depth of recursion for triggers.</dd>)^