aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2007-11-05 14:30:22 +0000
committerdrh <drh@noemail.net>2007-11-05 14:30:22 +0000
commitf54cc03585ca60680defb7ce217ef76d6a40816f (patch)
tree9f69adcae421da34c008cebccdc6dc359e6be288 /src
parentd949fd3b34916ddac4044179461237b39381eed4 (diff)
downloadsqlite-f54cc03585ca60680defb7ce217ef76d6a40816f.tar.gz
sqlite-f54cc03585ca60680defb7ce217ef76d6a40816f.zip
Make sure the default page size never exceeds the maximum page size. (CVS 4525)
FossilOrigin-Name: 9c2731f143d52f8bf27f309612c38a1be22e3019
Diffstat (limited to 'src')
-rw-r--r--src/sqliteLimit.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h
index cec417d4c..b4a8020cf 100644
--- a/src/sqliteLimit.h
+++ b/src/sqliteLimit.h
@@ -12,7 +12,7 @@
**
** This file defines various limits of what SQLite can process.
**
-** @(#) $Id: sqliteLimit.h,v 1.2 2007/08/24 11:52:29 danielk1977 Exp $
+** @(#) $Id: sqliteLimit.h,v 1.3 2007/11/05 14:30:23 drh Exp $
*/
/*
@@ -123,12 +123,25 @@
# define SQLITE_MAX_VARIABLE_NUMBER 999
#endif
+/* Maximum page size. The upper bound on this value is 32768. This a limit
+** imposed by the necessity of storing the value in a 2-byte unsigned integer
+** and the fact that the page size must be a power of 2.
+*/
+#ifndef SQLITE_MAX_PAGE_SIZE
+# define SQLITE_MAX_PAGE_SIZE 32768
+#endif
+
+
/*
** The default size of a database page.
*/
#ifndef SQLITE_DEFAULT_PAGE_SIZE
# define SQLITE_DEFAULT_PAGE_SIZE 1024
#endif
+#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
+# undef SQLITE_DEFAULT_PAGE_SIZE
+# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
+#endif
/*
** Ordinarily, if no value is explicitly provided, SQLite creates databases
@@ -140,15 +153,12 @@
#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
#endif
-
-/* Maximum page size. The upper bound on this value is 32768. This a limit
-** imposed by the necessity of storing the value in a 2-byte unsigned integer
-** and the fact that the page size must be a power of 2.
-*/
-#ifndef SQLITE_MAX_PAGE_SIZE
-# define SQLITE_MAX_PAGE_SIZE 32768
+#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
+# undef SQLITE_MAX_DEFAULT_PAGE_SIZE
+# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
#endif
+
/*
** Maximum number of pages in one database file.
**