Small. Fast. Reliable.
Choose any three.

About Sitemap Documentation Download License News Developers Support

## SQLite C Interface

## Run-time Limits

>     int sqlite3_limit(sqlite3*, int id, int newVal);

This interface allows the size of various constructs to be limited on a connection by connection basis. The first parameter is the 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.

If the new limit is a negative number, the limit is unchanged. For the limit category of SQLITE_LIMIT_XYZ there is a hard upper bound set by a compile-time C preprocessor macro named SQLITE_MAX_XYZ. (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 limit.

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 webbrowser that has its own databases for storing history and separate databases controlled by JavaScript applications downloaded off the Internet. The internal databases can be given the large, default limits. Databases managed by external sources can be given much smaller limits designed to prevent a denial of service attack. Developers might also want to use the sqlite3_set_authorizer() interface to further control untrusted SQL. The size of the database created by an untrusted script can be contained using the max_page_count PRAGMA.

New run-time limit categories may be added in future releases.

### Invariants:

H12762 | A successful call to sqlite3_limit(D,C,V) where V is positive changes the limit on the size of construct C in the database connection D to the lesser of V and the hard upper bound on the size of C that is set at compile-time.
H12766 | A successful call to sqlite3_limit(D,C,V) where V is negative leaves the state of the database connection D unchanged.
H12769 | A successful call to sqlite3_limit(D,C,V) returns the value of the limit on the size of construct C in the database connection D as it was prior to the call.

See also lists of Objects, Constants, and Functions.

This page last modified 2008/12/09 18:44:04 UTC