Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

SQLite Runtime restrictions (Run-time Limits)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Extracted from: http://www.sqlite.org/c3ref/limit.html

Int sqlite3_limit (sqlite3*, int id, intnewVal)

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

# 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

For details, please refer to: http://www.sqlite.org/c3ref/c_limit_attached.html

If a given limit value is negative, the limit will not take effect. For each restricted category, in the process of compilation, the upper limit of the value (a hard upper bound) has been specified through the C macro definition (variable name is SQLITE_MAX_NAME, of course, restriction name is SQLITE_LIMIT_NAME). If the specified value exceeds the upper limit, the value is specified as the upper limit (truncated to the hard upper bound Categories).

Whether the limit value has changed or not, the return value of sqlite3_limit is the last limit value. Therefore, if we want to know what the current limit value is, we can query what the limit value of the structure is by setting the third parameter of the function to-1.

For example:

Int permitexecutelength = sqlite3_limit (pdb, 1,-1)

Description: returns the length of the SQL statement currently allowed to be executed, which is saved in the permitexecutelength variable.

The design can be used not only to manage the customer's internal database, but also to control some unreliable access data sources. An obvious example is the web browser, which has its own storage history and separate databases controlled by JavaScript applications downloaded off the Internet JavaScript scripts downloaded from the Internet from the local database. The internal database can give a large default limit. To protect against illegal access to DDOS, a smaller default limit is generally given. Developers can call the sqlite3_set_authorizer () interface to control unreliable SQL statements. You can use max_page_count PRAGMA macros to limit the size of databases generated by unreliable scripts.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report