Often, PRAGMA are documented like mmap_size, like:

> Query or change the maximum number of bytes that are set aside
> for memory-mapped I/O on a single database. The first
> form (without an argument) queries the current limit. The
> second form (with a numeric argument) sets the limit for the
> specified database, or for all databases if the optional
> database name is omitted.

I notice that mmap_size _also_ returns the set value, which is useful to
query since it could be constrained by compile-time options or
sqlite3_config settings.  Like:

   sqlite> pragma mmap_size = 3221225472;  -- 3GB
   2147418112  -- 2GB - 64KB

Sometimes pragma don't do this:

   sqlite> pragma auto_vacuum = 1;
   sqlite> pragma auto_vacuum;
   1

Might it be useful to have a general policy that all PRAGMA calls return a
result consistent with the first form, even if an argument is passed?  As
things currently stand, you really shouldn't depend on behavior like
mmap_size's current implementation to do set-and-query, but you also can't
write code as if setting pragma do not return results.

-scott

Reply via email to