SQLite running time limit (Run-timeLimits) _ MySQL

Source: Internet
Author: User
Intsqlite3_limit (sqlite3 *, intid, intnewVal); This interface allows you to restrict the variable structure (variousconstructs) of the connection (onaconnection) during the connection process. The first parameter specifies the restricted settings... Running-time Limits _ MySQL

Int sqlite3_limit (sqlite3 *, int id, intnewVal );

This interface allows you to restrict the variable structure (various constructs) of the connection (on a connection) during the connection process (by connection basis. The first parameter specifies the throttling of the configured or queried database. The second parameter specifies the restricted category ), this structure defines a series of structure variables that can be limited in size (The second parameter is one of the limit categories that define aclass of constructs to be size limited ). The third parameter is a new limitation on the structure. The following is the defined restriction category:

# Define SQLITE_LIMIT_LENGTH 0

# Define SQLITE_LIMIT_ SQL _LENGTH 1

# Define SQLITE_LIMIT_COLUMN 2

# Define SQLITE_LIMIT_EXPR_DEPTH 3

# Define SQLITE_LIMIT_COMPOUND_SELECT 4

# Define SQLITE_LIMIT_VDBE_OP 5

# Define SQLITE_LIMIT_FUNCTION_ARG 6

# Define SQLITE_LIMIT_ATTACHED 7

# DefineSQLITE_LIMIT_LIKE_PATTERN_LENGTH 8

# Define SQLITE_LIMIT_VARIABLE_NUMBER 9

# Define SQLITE_LIMIT_TRIGGER_DEPTH 10

# Define SQLITE_LIMIT_WORKER_THREADS 11

If a given limit value is a negative value, the limit does not take effect. For each restricted category, the macro definition of C has been used during compilation (the variable name is SQLITE_MAX_NAME, of course, the restricted name is SQLITE_LIMIT_NAME ), specifies the upper limit of this value (a hard upper bound ). if the specified value exceeds the upper limit, the value is specified as the upper limit (truncated to the hard upper bound Categories ).

The return value of sqlite3_limit is the last limit value regardless of whether the limit value has changed. Therefore, if you want to know the current limit value, you can set the third parameter of the function to-1, you can query the limit value of this struct.

For example:

int permitexecutelength = sqlite3_limit(pdb, 1 , -1);


Note: the length of the SQL statement that can be executed is returned and stored in the permitexecutelength variable.

This design can be used to manage customers' internal databases and control unreliable data sources. An obvious example is the web browser, which stores historical records, and separate the JavaScript scripts downloaded from the Internet from the local database (separate databases controlled by JavaScript applications downloaded off the Internet ). the internal database can give a large default limit value. Source from external access to the database in order to avoid DoS attacks, a smaller default limit value is generally given. Developers can call the sqlite3_set_authorizer () interface to control unreliable SQL statements. You can use the max_page_count PRAGMA macro to limit the size of databases generated by unreliable scripts.

The above is the running-time Limits _ MySQL content of SQLite. For more information, see PHP Chinese website (www.php1.cn )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.