On Thu, Jul 08, 2010 at 08:23:55AM -0400, Richard Hipp scratched on the wall:
> On Thu, Jul 8, 2010 at 7:10 AM, Richard Hipp <d...@sqlite.org> wrote:
> 
> > Though, I will admit, this is confusing, and I was thinking last night
> > about ways we could possibly change it....
> 
> Current behavior:
> 
> (1) PRAGMA name.journal_mode=MODE; -- set the mode to MODE for database
> "name".
> 
> (2) PRAGMA name.journal_mode; -- return current journal mode for database
> "name".
> 
> (3) PRAGMA journal_mode=MODE;  -- set the mode to MODE for all attached
> databases and also apply MODE to all databases ATTACH-ed in the future.
> 
> (4) PRAGMA journal_mode; -- report the most recent setting by (3).  Report
> "delete" if there have been no prior occurences of (3).
> 
> First Proposed Change:
> 
> (1) and (2) are the same.
> 
> (3) PRAGMA journal_mode=MODE;  -- set the mode to MODE for all attached
> databases.  Databases created by subsequent ATTACH use MODE.  Existing
> databases added by ATTACH use MODE if and only if doing so does not require
> them to change in or out of WAL mode.

> (4) PRAGMA journal_mode;  -- report the most recent setting by (3).  Or if
> (3) has never been used, work the same as "PRAGMA main.journal_mode;"

  Contexts are generally bad.  This is even more true if there might
  ever be a way to change the compile time default journal mode to
  anything other than "delete."  Then there is no way to get the default.


  There are a few pragmas that use this general approach... where
  getting/setting an unqualified setting changes the default, not
  "main".  It might be better if all unqualified statements refer
  to main, and pragmas like this have a default.journal_mode (get/set)
  or all.journal_mode (set) syntax.


> Second Proposed Change:
> 
> Remove the WAL mode from "PRAGMA journal_mode".  The journal_mode pragma
> only specifies the various rollback journal modes.  Enable the WAL using a
> separate pragma such as  "PRAGMA wal=ON; PRAGMA wal=OFF;"
>
> Thoughts?  Comments? 

  I like this.  I suspect in the future we will have a "PRAGMA
  wal_mode" as well, so this makes a bit more sense.

  But as an extension, does it make even more sense to have "PRAGMA
  wal=[on|off]" or "PRAGMA transaction=[wal|journal]" ? 




> Other suggestions?

  This has nothing to do with WAL, but it might be nice to expose
  the logic that does SQL-type => SQLite-affinity mappings
  (i.e. sqlite3AffinityType()):

    int sqlite3_get_affinity( const char *type );

  Takes a string that contains an SQL type.  Returns one of:

  SQLITE_AFF_TEXT, SQLITE_AFF_NONE, SQLITE_AFF_NUMERIC,
  SQLITE_AFF_INTEGER, SQLITE_AFF_REAL.


   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to