Add contributions section to README
[sqlcipher.git] / src / sqliteLimit.h
blobc7aee53cebca94da51e71a822ea5a6deb90385df
1 /*
2 ** 2007 May 7
3 **
4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
6 **
7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give.
11 *************************************************************************
12 **
13 ** This file defines various limits of what SQLite can process.
17 ** The maximum length of a TEXT or BLOB in bytes. This also
18 ** limits the size of a row in a table or index.
20 ** The hard limit is the ability of a 32-bit signed integer
21 ** to count the size: 2^31-1 or 2147483647.
23 #ifndef SQLITE_MAX_LENGTH
24 # define SQLITE_MAX_LENGTH 1000000000
25 #endif
28 ** This is the maximum number of
30 ** * Columns in a table
31 ** * Columns in an index
32 ** * Columns in a view
33 ** * Terms in the SET clause of an UPDATE statement
34 ** * Terms in the result set of a SELECT statement
35 ** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
36 ** * Terms in the VALUES clause of an INSERT statement
38 ** The hard upper limit here is 32676. Most database people will
39 ** tell you that in a well-normalized database, you usually should
40 ** not have more than a dozen or so columns in any table. And if
41 ** that is the case, there is no point in having more than a few
42 ** dozen values in any of the other situations described above.
44 #ifndef SQLITE_MAX_COLUMN
45 # define SQLITE_MAX_COLUMN 2000
46 #endif
49 ** The maximum length of a single SQL statement in bytes.
51 ** It used to be the case that setting this value to zero would
52 ** turn the limit off. That is no longer true. It is not possible
53 ** to turn this limit off.
55 #ifndef SQLITE_MAX_SQL_LENGTH
56 # define SQLITE_MAX_SQL_LENGTH 1000000000
57 #endif
60 ** The maximum depth of an expression tree. This is limited to
61 ** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
62 ** want to place more severe limits on the complexity of an
63 ** expression.
65 ** A value of 0 used to mean that the limit was not enforced.
66 ** But that is no longer true. The limit is now strictly enforced
67 ** at all times.
69 #ifndef SQLITE_MAX_EXPR_DEPTH
70 # define SQLITE_MAX_EXPR_DEPTH 1000
71 #endif
74 ** The maximum number of terms in a compound SELECT statement.
75 ** The code generator for compound SELECT statements does one
76 ** level of recursion for each term. A stack overflow can result
77 ** if the number of terms is too large. In practice, most SQL
78 ** never has more than 3 or 4 terms. Use a value of 0 to disable
79 ** any limit on the number of terms in a compount SELECT.
81 #ifndef SQLITE_MAX_COMPOUND_SELECT
82 # define SQLITE_MAX_COMPOUND_SELECT 500
83 #endif
86 ** The maximum number of opcodes in a VDBE program.
87 ** Not currently enforced.
89 #ifndef SQLITE_MAX_VDBE_OP
90 # define SQLITE_MAX_VDBE_OP 25000
91 #endif
94 ** The maximum number of arguments to an SQL function.
96 #ifndef SQLITE_MAX_FUNCTION_ARG
97 # define SQLITE_MAX_FUNCTION_ARG 127
98 #endif
101 ** The maximum number of in-memory pages to use for the main database
102 ** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE
104 #ifndef SQLITE_DEFAULT_CACHE_SIZE
105 # define SQLITE_DEFAULT_CACHE_SIZE 2000
106 #endif
107 #ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
108 # define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500
109 #endif
112 ** The default number of frames to accumulate in the log file before
113 ** checkpointing the database in WAL mode.
115 #ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
116 # define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
117 #endif
120 ** The maximum number of attached databases. This must be between 0
121 ** and 62. The upper bound on 62 is because a 64-bit integer bitmap
122 ** is used internally to track attached databases.
124 #ifndef SQLITE_MAX_ATTACHED
125 # define SQLITE_MAX_ATTACHED 10
126 #endif
130 ** The maximum value of a ?nnn wildcard that the parser will accept.
132 #ifndef SQLITE_MAX_VARIABLE_NUMBER
133 # define SQLITE_MAX_VARIABLE_NUMBER 999
134 #endif
136 /* Maximum page size. The upper bound on this value is 65536. This a limit
137 ** imposed by the use of 16-bit offsets within each page.
139 ** Earlier versions of SQLite allowed the user to change this value at
140 ** compile time. This is no longer permitted, on the grounds that it creates
141 ** a library that is technically incompatible with an SQLite library
142 ** compiled with a different limit. If a process operating on a database
143 ** with a page-size of 65536 bytes crashes, then an instance of SQLite
144 ** compiled with the default page-size limit will not be able to rollback
145 ** the aborted transaction. This could lead to database corruption.
147 #ifdef SQLITE_MAX_PAGE_SIZE
148 # undef SQLITE_MAX_PAGE_SIZE
149 #endif
150 #define SQLITE_MAX_PAGE_SIZE 65536
154 ** The default size of a database page.
156 #ifndef SQLITE_DEFAULT_PAGE_SIZE
157 # define SQLITE_DEFAULT_PAGE_SIZE 1024
158 #endif
159 #if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
160 # undef SQLITE_DEFAULT_PAGE_SIZE
161 # define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
162 #endif
165 ** Ordinarily, if no value is explicitly provided, SQLite creates databases
166 ** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
167 ** device characteristics (sector-size and atomic write() support),
168 ** SQLite may choose a larger value. This constant is the maximum value
169 ** SQLite will choose on its own.
171 #ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
172 # define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
173 #endif
174 #if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
175 # undef SQLITE_MAX_DEFAULT_PAGE_SIZE
176 # define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
177 #endif
181 ** Maximum number of pages in one database file.
183 ** This is really just the default value for the max_page_count pragma.
184 ** This value can be lowered (or raised) at run-time using that the
185 ** max_page_count macro.
187 #ifndef SQLITE_MAX_PAGE_COUNT
188 # define SQLITE_MAX_PAGE_COUNT 1073741823
189 #endif
192 ** Maximum length (in bytes) of the pattern in a LIKE or GLOB
193 ** operator.
195 #ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
196 # define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
197 #endif
200 ** Maximum depth of recursion for triggers.
202 ** A value of 1 means that a trigger program will not be able to itself
203 ** fire any triggers. A value of 0 means that no trigger programs at all
204 ** may be executed.
206 #ifndef SQLITE_MAX_TRIGGER_DEPTH
207 # define SQLITE_MAX_TRIGGER_DEPTH 1000
208 #endif