Instructions for importing a new release of SQLite from sqlite.org. Note: our current base version is 3.6.18. First, you need to be on Linux. # Determine the versions of the release you want and the release we currently # have. (See the VERSION file to determine which release we currently have.) # You may wish to consult http://www.sqlite.org/changes.html to find out what # changes have been made in each release. # Note - this is just an example. Always refer to the version above for our # real current version. # Set some variables to remember the versions, e.g.: BASE=3.6.18 LATEST=3.6.22 # Get to the src/third_party directory in your Chromium client: cd src/third_party # Download the .tar.gz files for the releases: # (If the URL changes you might need to find the new one.) wget http://www.sqlite.org/sqlite-$BASE.tar.gz wget http://www.sqlite.org/sqlite-$LATEST.tar.gz # Extract the vanilla current and desired versions: tar xzf sqlite-$BASE.tar.gz tar xzf sqlite-$LATEST.tar.gz # Use kdiff3 to merge the changes: kdiff3 -m sqlite-$BASE sqlite-$LATEST sqlite # Resolve any conflicts. Figure out if we've got everything we should # have (see below), or if we can omit any changes we no longer need. # Change to the sqlite directory: cd sqlite # Run the google_generate_preprocessed.sh script: ./google_generate_preprocessed.sh # Find a sucker. Send review. # TODO(shess) Describe an appropriate comment style. Seems like it # should at least include the SQLite version number. -------------------------------------------- For reference, all of our local patches are also kept as .patch files in the sqlite directory. Here is a list of the patches, in the order they should be applied to a vanilla SQLite (of the version we currently have) to get, in principle, exactly what is checked in: misc.patch preload-cache.patch safe-tolower.patch sqlite-poison.patch fts2.patch So, e.g. you could do this to apply all our patches to vanilla SQLite: cd sqlite-$LATEST patch -p0 < ../sqlite/misc.patch patch -p0 < ../sqlite/preload-cache.patch patch -p0 < ../sqlite/safe-tolower.patch patch -p0 < ../sqlite/sqlite-poison.patch patch -p0 < ../sqlite/fts2.patch This will only be the case if all changes we make also update the corresponding patch files. Therefore please remember to do that whenever you make a change! Descriptions of the changes we've made can be found at the bottom of this file. -------------------------------------------- How to run the SQLite tests for the Chromium version of SQLite on Linux. Prerequisties: On my corp Ubuntu 8.04 workstation, I needed to install the following packages: sudo apt-get install tcl8.4-dev libicu-dev cd src/third_party/sqlite mkdir build cd build make -f ../Makefile.linux-gcc testfixture make -f ../Makefile.linux-gcc test > /tmp/test.log egrep -v 'Ok$' /tmp/test.log # For an ideal test run, you would see: # 0 errors out of 57887 tests # However, the current situation on my corp Linux Ubuntu 8.04 machine, with # test run on a locally mounted directory, is the failure of: # "rollback-2.3", "tkt3457-1.4" # I do not know why, but it is not related to our fts2.c changes -- I backed # them out to check. Chris Evans , Oct 1, 2009 -------------------------------------------- As of Oct 1, 2009, these are our changes from sqlite_vendor: - A large number of fts2 robustness fixes against corrupt data in its metadata tables. - fts2.c disables fts2_tokenizer(). - sqlite3Poison() in src/btree.c. - BEGIN defaults to BEGIN IMMEDIATE in parse.y. - Tweak to SQLITE_EXTENSION_INIT* in sqlite3ext.h. - That implied a change in src/test_autoext.c for testing. - Added fts.test and fts1.test in tests, modified quick.test. - src/os_symbian.cc. - Modifications to Makefile.linux-gcc and main.mk for compiling SQLite tests. - Compile warning (cast to void* for sqlite3_free) fixed in func.c. - Avoid using tolower() in fts code which causes problem in some locales, see: safe-tolower.patch http://crbug.com/15261 http://www.sqlite.org/src/tktview/991789d9f3136a0460dc83a33e815c1aa9757c26 - Check that the third argument to memset() is nonzero in expr.c to avoid a linker warning when the compiler can optimize it to a constant zero (e.g. see http://www.sqlite.org/cvstrac/tktview?tn=3765,39) Changes from Chrome: - I marked all changes I made with "evanm", so you can find them with "grep evanm *". - Most files include sqlite3ext.h with SQLITE_CORE #defined, but two don't: fts2_tokenizer.c and icu.c. Without this #define, the calls in fts2_tokenizer.c try to go through some pointer to the sqlite API instead of calling the functions directly (to work as a loadable module), but then crash (because the other files never initialize that loadable module support). As a hack I #defined it in these files, but it'd be nice to figure out what really ought to happen here (perhaps this file is new and hasn't been tested to verify it works right). Update: Seems this is an issue we get because we're using fts2 instead of fts3. - shell_icu_win.c and shell_icu_linux.c are Chrome-specific files used to load our ICU data. shell.c has been modifed to call into these files. - fts2_icu.c has a critical bug. U8_NEXT is used over a UTF-16 string. It's rep$ by U16_NEXT (jungshik) - Added a new function sqlite3Preload we use to prime the database cache. It allows much faster performance by reading the file in one contiguous operation rather than bringing it in organically, which involves a lot of seeking. This change also required sqlite3PcacheGetCachesize to be compiled even outside SQLITE_TEST. - Added a new function chromium_sqlite3_initialize_win_sqlite3_file() at the end of os_win.c. It allows the Windows-specific Chromium VFS to reuse most of the win32 SQLite VFS. - Added a new function initUnixFile() and made fillInUnixFile() non-static in os_unix.c. It allows the Linux-specific Chromium VFS to reuse most of the unix SQLite VFS.