1.Dd March 11, 2017 2.Dt SQLITE3_LIMIT 3 3.Os 4.Sh NAME 5.Nm sqlite3_limit 6.Nd Run-time Limits 7.Sh SYNOPSIS 8.Ft int 9.Fo sqlite3_limit 10.Fa "sqlite3*" 11.Fa "int id" 12.Fa "int newVal" 13.Fc 14.Sh DESCRIPTION 15This interface allows the size of various constructs to be limited 16on a connection by connection basis. 17The first parameter is the database connection whose 18limit is to be set or queried. 19The second parameter is one of the limit categories 20that define a class of constructs to be size limited. 21The third parameter is the new limit for that construct. 22.Pp 23If the new limit is a negative number, the limit is unchanged. 24For each limit category SQLITE_LIMIT_<i>NAME</i> there is a hard upper bound 25set at compile-time by a C preprocessor macro called SQLITE_MAX_<i>NAME</i>. 26(The "_LIMIT_" in the name is changed to "_MAX_".) Attempts to increase 27a limit above its hard upper bound are silently truncated to the hard 28upper bound. 29.Pp 30Regardless of whether or not the limit was changed, the sqlite3_limit() 31interface returns the prior value of the limit. 32Hence, to find the current value of a limit without changing it, simply 33invoke this interface with the third parameter set to -1. 34.Pp 35Run-time limits are intended for use in applications that manage both 36their own internal database and also databases that are controlled 37by untrusted external sources. 38An example application might be a web browser that has its own databases 39for storing history and separate databases controlled by JavaScript 40applications downloaded off the Internet. 41The internal databases can be given the large, default limits. 42Databases managed by external sources can be given much smaller limits 43designed to prevent a denial of service attack. 44Developers might also want to use the sqlite3_set_authorizer() 45interface to further control untrusted SQL. 46The size of the database created by an untrusted script can be contained 47using the max_page_count PRAGMA. 48.Pp 49New run-time limit categories may be added in future releases. 50.Sh SEE ALSO 51.Xr sqlite3 3 , 52.Xr sqlite3_limit 3 , 53.Xr sqlite3_set_authorizer 3 54