extensions/sqlite/sqlite-source/sqliteLimit.h
author Asher Baker <asherkin@gmail.com>
Thu Apr 26 16:58:18 2012 +0100 (2012-04-26)
changeset 3488 bee90c8ef6c3
parent 1952 b7aa2b626807
permissions -rw-r--r--
Fixed client serials not being unique on Windows (bug 5285, r=psychonic).
     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$
    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 here is the same as SQLITE_MAX_LENGTH.
    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 /*
   127 ** The default size of a database page.
   128 */
   129 #ifndef SQLITE_DEFAULT_PAGE_SIZE
   130 # define SQLITE_DEFAULT_PAGE_SIZE 1024
   131 #endif
   132 
   133 /*
   134 ** Ordinarily, if no value is explicitly provided, SQLite creates databases
   135 ** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
   136 ** device characteristics (sector-size and atomic write() support),
   137 ** SQLite may choose a larger value. This constant is the maximum value
   138 ** SQLite will choose on it's own.
   139 */
   140 #ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
   141 # define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
   142 #endif
   143 
   144 /* Maximum page size.  The upper bound on this value is 32768.  This a limit
   145 ** imposed by the necessity of storing the value in a 2-byte unsigned integer
   146 ** and the fact that the page size must be a power of 2.
   147 */
   148 #ifndef SQLITE_MAX_PAGE_SIZE
   149 # define SQLITE_MAX_PAGE_SIZE 32768
   150 #endif
   151 
   152 /*
   153 ** Maximum number of pages in one database file.
   154 **
   155 ** This is really just the default value for the max_page_count pragma.
   156 ** This value can be lowered (or raised) at run-time using that the
   157 ** max_page_count macro.
   158 */
   159 #ifndef SQLITE_MAX_PAGE_COUNT
   160 # define SQLITE_MAX_PAGE_COUNT 1073741823
   161 #endif
   162 
   163 /*
   164 ** Maximum length (in bytes) of the pattern in a LIKE or GLOB
   165 ** operator.
   166 */
   167 #ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
   168 # define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
   169 #endif