MongoosePeople. Places. Questionable inventions.

All help topics · Link to this topic

Showing help on 'sqlite_limit()'

Syntax: sqlite_limit(INT <database handle>, STR|INT <category>, INT <new value>) => INT

This function allows you to specify various construct limitations on a per-database basis. The programmer must be a wizard, or E_PERM is raised.

If <new value> is a negative number, the limit is unchanged. Each limit category has a hardcoded upper bound. 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 sqlite_limit() function 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.

Category may be either a string limit name or the corresponding integer SQLite limit category. E_INVARG is raised if the handle is invalid or the category is not recognized.

As of this writing, the following limits exist:

LIMIT_LENGTH
The maximum size of any string or BLOB or table row, in bytes.

LIMIT_SQL_LENGTH
The maximum length of an SQL statement, in bytes.

LIMIT_COLUMN
The maximum number of columns in a table definition or in the result set of a SELECT or the maximum number of columns in an index or in an ORDER BY or GROUP BY clause.

LIMIT_EXPR_DEPTH
The maximum depth of the parse tree on any expression.

LIMIT_COMPOUND_SELECT
The maximum number of terms in a compound SELECT statement.

LIMIT_VDBE_OP
The maximum number of instructions in a virtual machine program used to implement an SQL statement. If sqlite3_prepare_v2() or the equivalent tries to allocate space for more than this many opcodes in a single prepared statement, an SQLITE_NOMEM error is returned.

LIMIT_FUNCTION_ARG
The maximum number of arguments on a function.

LIMIT_ATTACHED
The maximum number of attached databases.

LIMIT_LIKE_PATTERN_LENGTH
The maximum length of the pattern argument to the LIKE or GLOB operators.

LIMIT_VARIABLE_NUMBER
The maximum index number of any parameter in an SQL statement.

LIMIT_TRIGGER_DEPTH
The maximum depth of recursion for triggers.

LIMIT_WORKER_THREADS
The maximum number of auxiliary worker threads that a single prepared statement may start.

For an up-to-date list of limits, see the SQLite documentation here: https://www.sqlite.org/c3ref/c_limit_attached.html