engine/sqlite/src/sqliteLimit.h
changeset 2 29cda98b007e
equal deleted inserted replaced
1:5f8e5adbbed9 2:29cda98b007e
       
     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.
       
    10 **
       
    11 *************************************************************************
       
    12 ** 
       
    13 ** This file defines various limits of what SQLite can process.
       
    14 **
       
    15 ** @(#) $Id: sqliteLimit.h 1282 2008-11-13 09:31:33Z LarsPson $
       
    16 */
       
    17 
       
    18 /*
       
    19 ** The maximum length of a TEXT or BLOB in bytes.   This also
       
    20 ** limits the size of a row in a table or index.
       
    21 **
       
    22 ** The hard limit is the ability of a 32-bit signed integer
       
    23 ** to count the size: 2^31-1 or 2147483647.
       
    24 */
       
    25 #ifndef SQLITE_MAX_LENGTH
       
    26 # define SQLITE_MAX_LENGTH 1000000000
       
    27 #endif
       
    28 
       
    29 /*
       
    30 ** This is the maximum number of
       
    31 **
       
    32 **    * Columns in a table
       
    33 **    * Columns in an index
       
    34 **    * Columns in a view
       
    35 **    * Terms in the SET clause of an UPDATE statement
       
    36 **    * Terms in the result set of a SELECT statement
       
    37 **    * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
       
    38 **    * Terms in the VALUES clause of an INSERT statement
       
    39 **
       
    40 ** The hard upper limit here is 32676.  Most database people will
       
    41 ** tell you that in a well-normalized database, you usually should
       
    42 ** not have more than a dozen or so columns in any table.  And if
       
    43 ** that is the case, there is no point in having more than a few
       
    44 ** dozen values in any of the other situations described above.
       
    45 */
       
    46 #ifndef SQLITE_MAX_COLUMN
       
    47 # define SQLITE_MAX_COLUMN 2000
       
    48 #endif
       
    49 
       
    50 /*
       
    51 ** The maximum length of a single SQL statement in bytes.
       
    52 ** The hard limit is 1 million.
       
    53 */
       
    54 #ifndef SQLITE_MAX_SQL_LENGTH
       
    55 # define SQLITE_MAX_SQL_LENGTH 1000000
       
    56 #endif
       
    57 
       
    58 /*
       
    59 ** The maximum depth of an expression tree. This is limited to 
       
    60 ** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might 
       
    61 ** want to place more severe limits on the complexity of an 
       
    62 ** expression. A value of 0 (the default) means do not enforce
       
    63 ** any limitation on expression tree depth.
       
    64 */
       
    65 #ifndef SQLITE_MAX_EXPR_DEPTH
       
    66 # define SQLITE_MAX_EXPR_DEPTH 1000
       
    67 #endif
       
    68 
       
    69 /*
       
    70 ** The maximum number of terms in a compound SELECT statement.
       
    71 ** The code generator for compound SELECT statements does one
       
    72 ** level of recursion for each term.  A stack overflow can result
       
    73 ** if the number of terms is too large.  In practice, most SQL
       
    74 ** never has more than 3 or 4 terms.  Use a value of 0 to disable
       
    75 ** any limit on the number of terms in a compount SELECT.
       
    76 */
       
    77 #ifndef SQLITE_MAX_COMPOUND_SELECT
       
    78 # define SQLITE_MAX_COMPOUND_SELECT 500
       
    79 #endif
       
    80 
       
    81 /*
       
    82 ** The maximum number of opcodes in a VDBE program.
       
    83 ** Not currently enforced.
       
    84 */
       
    85 #ifndef SQLITE_MAX_VDBE_OP
       
    86 # define SQLITE_MAX_VDBE_OP 25000
       
    87 #endif
       
    88 
       
    89 /*
       
    90 ** The maximum number of arguments to an SQL function.
       
    91 */
       
    92 #ifndef SQLITE_MAX_FUNCTION_ARG
       
    93 # define SQLITE_MAX_FUNCTION_ARG 100
       
    94 #endif
       
    95 
       
    96 /*
       
    97 ** The maximum number of in-memory pages to use for the main database
       
    98 ** table and for temporary tables.  The SQLITE_DEFAULT_CACHE_SIZE
       
    99 */
       
   100 #ifndef SQLITE_DEFAULT_CACHE_SIZE
       
   101 # define SQLITE_DEFAULT_CACHE_SIZE  2000
       
   102 #endif
       
   103 #ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
       
   104 # define SQLITE_DEFAULT_TEMP_CACHE_SIZE  500
       
   105 #endif
       
   106 
       
   107 /*
       
   108 ** The maximum number of attached databases.  This must be at least 2
       
   109 ** in order to support the main database file (0) and the file used to
       
   110 ** hold temporary tables (1).  And it must be less than 32 because
       
   111 ** we use a bitmask of databases with a u32 in places (for example
       
   112 ** the Parse.cookieMask field).
       
   113 */
       
   114 #ifndef SQLITE_MAX_ATTACHED
       
   115 # define SQLITE_MAX_ATTACHED 10
       
   116 #endif
       
   117 
       
   118 
       
   119 /*
       
   120 ** The maximum value of a ?nnn wildcard that the parser will accept.
       
   121 */
       
   122 #ifndef SQLITE_MAX_VARIABLE_NUMBER
       
   123 # define SQLITE_MAX_VARIABLE_NUMBER 999
       
   124 #endif
       
   125 
       
   126 /* Maximum page size.  The upper bound on this value is 32768.  This a limit
       
   127 ** imposed by the necessity of storing the value in a 2-byte unsigned integer
       
   128 ** and the fact that the page size must be a power of 2.
       
   129 */
       
   130 #ifndef SQLITE_MAX_PAGE_SIZE
       
   131 # define SQLITE_MAX_PAGE_SIZE 32768
       
   132 #endif
       
   133 
       
   134 
       
   135 /*
       
   136 ** The default size of a database page.
       
   137 */
       
   138 #ifndef SQLITE_DEFAULT_PAGE_SIZE
       
   139 # define SQLITE_DEFAULT_PAGE_SIZE 1024
       
   140 #endif
       
   141 #if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
       
   142 # undef SQLITE_DEFAULT_PAGE_SIZE
       
   143 # define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
       
   144 #endif
       
   145 
       
   146 /*
       
   147 ** Ordinarily, if no value is explicitly provided, SQLite creates databases
       
   148 ** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
       
   149 ** device characteristics (sector-size and atomic write() support),
       
   150 ** SQLite may choose a larger value. This constant is the maximum value
       
   151 ** SQLite will choose on its own.
       
   152 */
       
   153 #ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
       
   154 # define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
       
   155 #endif
       
   156 #if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
       
   157 # undef SQLITE_MAX_DEFAULT_PAGE_SIZE
       
   158 # define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
       
   159 #endif
       
   160 
       
   161 
       
   162 /*
       
   163 ** Maximum number of pages in one database file.
       
   164 **
       
   165 ** This is really just the default value for the max_page_count pragma.
       
   166 ** This value can be lowered (or raised) at run-time using that the
       
   167 ** max_page_count macro.
       
   168 */
       
   169 #ifndef SQLITE_MAX_PAGE_COUNT
       
   170 # define SQLITE_MAX_PAGE_COUNT 1073741823
       
   171 #endif
       
   172 
       
   173 /*
       
   174 ** Maximum length (in bytes) of the pattern in a LIKE or GLOB
       
   175 ** operator.
       
   176 */
       
   177 #ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
       
   178 # define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
       
   179 #endif