On Thu, Sep 03, 2009 at 03:47:50PM -0400, Wilson, Ronald scratched on the wall:

> >   You can convert a V1 database into a V4 database by opening it,
> >   setting the legacy PRAGMA to false, and the VACUUMing the database.

> If this is true, the documentation doesn't even hint at the feature:
> "This flag only affects newly created databases. It has no effect on
> databases that already exist."

  I agree that the docs are a bit light on this point.

  I would have never guessed about the VACUUM thing, if it wasn't for
  the fact I ran across this line in the 3.2.8 to 3.3.0 section of
  <http://www.sqlite.org/formatchng.html>:
  
     "Once a database file is created, its format is fixed. So
     a database file created by SQLite 3.2.8 and merely modified
     by version 3.3.0 or later will retain the old format. 
     Except, the VACUUM command recreates the database so
     running VACUUM on 3.3.0 or later will change the file
     format to the latest edition."

  That is, the way VACUUM essentially works is that it copies everything
  to a temp database, creates a brand-new-from-scratch database, and
  copies everything back.  When it creates the new database, that
  database takes on the current defaults.

  If you stop and think about it, it isn't that big of a surprise.  You
  can use VACUUM to change the page size and a bunch of other "fixed"
  parameters.  However, it might be nice if the docs were a bit more
  forthcoming about this point.

> One way to test it would be to try opening an up-converted database in a
> version previous to 3.3.0, which I don't have handy.

  The other way (which is what I did) is to just dump the first ~50 
  bytes of the file and see what version is set.  See "44..47" here:
  <http://www.sqlite.org/fileformat.html#database_header>. 
  
  It would be kind of nice if there was some PRAGMA command that
  dumped all this type of info for the current "main" database.  I
  don't remember if sqlite3_analyzer does or not.

   -j

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

"Our opponent is an alien starship packed with atomic bombs.  We have
 a protractor."   "I'll go home and see if I can scrounge up a ruler
 and a piece of string."  --from Anathem by Neal Stephenson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to