sqliteLimit.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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,v 1.5 2007/12/13 21:54:11 drh Exp $
  16. */
  17. /*
  18. ** The maximum length of a TEXT or BLOB in bytes. This also
  19. ** limits the size of a row in a table or index.
  20. **
  21. ** The hard limit is the ability of a 32-bit signed integer
  22. ** to count the size: 2^31-1 or 2147483647.
  23. */
  24. #ifndef SQLITE_MAX_LENGTH
  25. # define SQLITE_MAX_LENGTH 1000000000
  26. #endif
  27. /*
  28. ** This is the maximum number of
  29. **
  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
  37. **
  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.
  43. */
  44. #ifndef SQLITE_MAX_COLUMN
  45. # define SQLITE_MAX_COLUMN 2000
  46. #endif
  47. /*
  48. ** The maximum length of a single SQL statement in bytes.
  49. ** The hard limit is 1 million.
  50. */
  51. #ifndef SQLITE_MAX_SQL_LENGTH
  52. # define SQLITE_MAX_SQL_LENGTH 1000000
  53. #endif
  54. /*
  55. ** The maximum depth of an expression tree. This is limited to
  56. ** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
  57. ** want to place more severe limits on the complexity of an
  58. ** expression. A value of 0 (the default) means do not enforce
  59. ** any limitation on expression tree depth.
  60. */
  61. #ifndef SQLITE_MAX_EXPR_DEPTH
  62. # define SQLITE_MAX_EXPR_DEPTH 1000
  63. #endif
  64. /*
  65. ** The maximum number of terms in a compound SELECT statement.
  66. ** The code generator for compound SELECT statements does one
  67. ** level of recursion for each term. A stack overflow can result
  68. ** if the number of terms is too large. In practice, most SQL
  69. ** never has more than 3 or 4 terms. Use a value of 0 to disable
  70. ** any limit on the number of terms in a compount SELECT.
  71. */
  72. #ifndef SQLITE_MAX_COMPOUND_SELECT
  73. # define SQLITE_MAX_COMPOUND_SELECT 500
  74. #endif
  75. /*
  76. ** The maximum number of opcodes in a VDBE program.
  77. ** Not currently enforced.
  78. */
  79. #ifndef SQLITE_MAX_VDBE_OP
  80. # define SQLITE_MAX_VDBE_OP 25000
  81. #endif
  82. /*
  83. ** The maximum number of arguments to an SQL function.
  84. */
  85. #ifndef SQLITE_MAX_FUNCTION_ARG
  86. # define SQLITE_MAX_FUNCTION_ARG 100
  87. #endif
  88. /*
  89. ** The maximum number of in-memory pages to use for the main database
  90. ** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE
  91. */
  92. #ifndef SQLITE_DEFAULT_CACHE_SIZE
  93. # define SQLITE_DEFAULT_CACHE_SIZE 2000
  94. #endif
  95. #ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
  96. # define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500
  97. #endif
  98. /*
  99. ** The maximum number of attached databases. This must be at least 2
  100. ** in order to support the main database file (0) and the file used to
  101. ** hold temporary tables (1). And it must be less than 32 because
  102. ** we use a bitmask of databases with a u32 in places (for example
  103. ** the Parse.cookieMask field).
  104. */
  105. #ifndef SQLITE_MAX_ATTACHED
  106. # define SQLITE_MAX_ATTACHED 10
  107. #endif
  108. /*
  109. ** The maximum value of a ?nnn wildcard that the parser will accept.
  110. */
  111. #ifndef SQLITE_MAX_VARIABLE_NUMBER
  112. # define SQLITE_MAX_VARIABLE_NUMBER 999
  113. #endif
  114. /* Maximum page size. The upper bound on this value is 32768. This a limit
  115. ** imposed by the necessity of storing the value in a 2-byte unsigned integer
  116. ** and the fact that the page size must be a power of 2.
  117. */
  118. #ifndef SQLITE_MAX_PAGE_SIZE
  119. # define SQLITE_MAX_PAGE_SIZE 32768
  120. #endif
  121. /*
  122. ** The default size of a database page.
  123. */
  124. #ifndef SQLITE_DEFAULT_PAGE_SIZE
  125. # define SQLITE_DEFAULT_PAGE_SIZE 1024
  126. #endif
  127. #if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
  128. # undef SQLITE_DEFAULT_PAGE_SIZE
  129. # define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
  130. #endif
  131. /*
  132. ** Ordinarily, if no value is explicitly provided, SQLite creates databases
  133. ** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
  134. ** device characteristics (sector-size and atomic write() support),
  135. ** SQLite may choose a larger value. This constant is the maximum value
  136. ** SQLite will choose on its own.
  137. */
  138. #ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
  139. # define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
  140. #endif
  141. #if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
  142. # undef SQLITE_MAX_DEFAULT_PAGE_SIZE
  143. # define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
  144. #endif
  145. /*
  146. ** Maximum number of pages in one database file.
  147. **
  148. ** This is really just the default value for the max_page_count pragma.
  149. ** This value can be lowered (or raised) at run-time using that the
  150. ** max_page_count macro.
  151. */
  152. #ifndef SQLITE_MAX_PAGE_COUNT
  153. # define SQLITE_MAX_PAGE_COUNT 1073741823
  154. #endif
  155. /*
  156. ** Maximum length (in bytes) of the pattern in a LIKE or GLOB
  157. ** operator.
  158. */
  159. #ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
  160. # define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
  161. #endif