I see that change 3948 implemented the max_page_count pragma, which is very,
very useful in my environment.  I was surprised by the fact that its value
is per-connection and not per-database, as I had assumed that the maximum
file size was an attribute of the file and not of the running instance. :)

I could see two ways to proceed:  either change the database file format to
use one of the meta-fields to hold the max_page_count value (the same way it
holds the default_cache_size), or document that the setting for
max_page_count is not persistent and needs to be re-set after each
sqlite3_open.  In addition the pragma setting does not appear to apply to
any attached databases, and therefore only to the main database.  (My
framework doesn't implement attach yet, for various hysterical reasons.)

Since I don't feel qualified to change the file format, I went ahead and
wrote up the clarifying statement for your use.  Of course, *I* would prefer
that maximum_page_count be persistent, but in the meantime here's the
change. :)

In my framework a database has one or more connections which correspond to
the sqlite3 object managed by sqlite3_open and sqlite3_close.  In addition I
have a threaded_database object which manages per-thread connections and
attempts to maintain some semblance of common state between them.  Thus when
I implemented "sqlite::uint64
connection.set_maximum_database_size(sqlite::uint64)",
I discovered that I had to set it on each of the connections currently in
existence, and on each of the future connections that might be created.
That was fun.

(As an aside, I had to implement set_maximum_database_size by querying the
current page_size and dividing, and then setting the page_count.)


BEFORE:


  -

  *PRAGMA max_page_count;
  PRAGMA max_page_count = **N**;*

  Query or set the maximum number of pages in the database file. Both
  forms of the pragma return the maximum page count. The second form attempts
  to modify the maximum page count. The maximum page count cannot be reduced
  below the current database size.

AFTER:

PRAGMA max_page_count;
PRAGMA max_page_count = N;

Query or set the maximum number of pages in the main database file.  Both
forms of the pragma return the maximum page count.  The second form attempts
to modify the maximum page count of the main database on the current sqlite3
instance.  The maximum page count cannot be reduced below the current
database size.  If there are multiple sqlite3 instances referring to this
database file, each can have its own, differing max_page_count setting.




I,
Andrew Finkenstadt,
dedicate this documentation change and its corresponding notes and
discussion to the public domain.

Reply via email to