Small. Fast. Reliable.
Choose any three.
*** 49,74 ****
  	+#endif
  	+
  	 /*
! 	 ** Macros fterface adding patch-sets, bug tracking, and Wiki           
!             to CVS.  http://www.hwaci.com/sw/cvstrac/.           
             
! *: SQL Relay: A persistent database connection pooling, proxying and load           
!               balancing system with APIs for a wide range of programming           
!               languages.   http://www.firstworks.com/  
!               --> http://sqlrelay.sourceforge.net    
   
   
      
! *: Zee Cookbook: A cookbook application for Sharp Zaurus PDA.    
!    hb interface adding patch-sets, bug tracking, and Wiki           
!             to CVS.  http://www.hwaci.com/sw/cvstrac/.           
             
! *: SQL Relay: A persistent database connection pooling, proxying and load           
!               balancing system with APIs for a wide range of programming           
!               languages.   http://www.firstworks.com/  
!               --> http://sqlrelay.sourceforge.net    
   
   
      
! *: Zee Cookbook: A cookbook application for Sharp Zaurus PDA.    
!    h
--- 49,597 ----
  	+#endif
  	+
  	 /*
! 	 ** Macros for performance tracing.  Normally turned off
! 	 */
! 	@@ -232,9 +236,9 @@
! 	   int *pReadonly
! 	 ){
! 	 #if OS_UNIX
! 	-  id->fd = open(zFilename, O_RDWR|O_CREAT, 0644);
! 	+  id->fd = open(zFilename, O_RDWR|O_CREAT|O_BINARY, 0644);
! 	   if( id->fd<0 ){
! 	-    id->fd = open(zFilename, O_RDONLY);
! 	+    id->fd = open(zFilename, O_RDONLY|O_BINARY);
! 	     if( id->fd<0 ){
! 	       return SQLITE_CANTOPEN; 
! 	     }
! 	@@ -306,7 +310,7 @@
! 	 #ifndef O_NOFOLLOW
! 	 # define O_NOFOLLOW 0
! 	 #endif
! 	-  id->fd = open(zFilename, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600);
! 	+  id->fd = open(zFilename, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_BINARY, 0600);
! 	   if( id->fd<0 ){
! 	     return SQLITE_CANTOPEN;
! 	   }
! 	@@ -359,7 +363,7 @@
! 	 */
! 	 int sqliteOsOpenReadOnly(const char *zFilename, OsFile *id){
! 	 #if OS_UNIX
! 	-  id->fd = open(zFilename, O_RDONLY);
! 	+  id->fd = open(zFilename, O_RDONLY|O_BINARY);
! 	   if( id->fd<0 ){
! 	     return SQLITE_CANTOPEN;
! 	   }
! 	@@ -682,9 +686,13 @@
! 	     lock.l_type = F_RDLCK;
! 	     lock.l_whence = SEEK_SET;
! 	     lock.l_start = lock.l_len = 0L;
! 	+#ifdef __DJGPP__
! 	+    {
! 	+#else
! 	     if( fcntl(id->fd, F_SETLK, &lock)!=0 ){
! 	       rc = SQLITE_BUSY;
! 	     }else{
! 	+#endif
! 	       rc = SQLITE_OK;
! 	       id->pLock->cnt = 1;
! 	       id->locked = 1;
! 	@@ -736,9 +744,13 @@
! 	     lock.l_type = F_WRLCK;
! 	     lock.l_whence = SEEK_SET;
! 	     lock.l_start = lock.l_len = 0L;
! 	+#ifdef __DJGPP__
! 	+    {
! 	+#else
! 	     if( fcntl(id->fd, F_SETLK, &lock)!=0 ){
! 	       rc = SQLITE_BUSY;
! 	     }else{
! 	+#endif
! 	       rc = SQLITE_OK;
! 	       id->pLock->cnt = -1;
! 	       id->locked = 1;
! 	@@ -798,9 +810,13 @@
! 	     lock.l_type = F_UNLCK;
! 	     lock.l_whence = SEEK_SET;
! 	     lock.l_start = lock.l_len = 0L;
! 	+#ifdef __DJGPP__
! 	+    {
! 	+#else
! 	     if( fcntl(id->fd, F_SETLK, &lock)!=0 ){
! 	       rc = SQLITE_BUSY;
! 	     }else{
! 	+#endif
! 	       rc = SQLITE_OK;
! 	       id->pLock->cnt = 0;
! 	     }
  
! This is needed, because files need to be explicitely opened in binary mode and the check for locking always fails in DJGPP.
  
+ DJGPP: http://www.delorie.com/djgpp
  
+ ====
  
! *Microsoft Visual Studio.NET*
  
! See HowToCompileWithVsNet.
  
+ ====
  
+ *MSVC and SQLite DLL*
  
! Creation of an import library from the sqlitedll.zip
! (http://www.sqlite.org/sqlitedll.zip) for MS Visual C++
! is achieved by the following command:
! 
! LIB /DEF:sqlite.def
! 
! This makes the files sqlite.lib and sqlite.exp files.
! The sqlite.lib can then be used to link your programs
! against the SQLite DLL.
! 
! 
! 
! =====
! 
! *Crosscompile linux x86 -> linux arm*
! 
! 1. Install skiff toolchain or similar, make shure you have arm-linux-gcc in your PATH.
! 
! 2. Unpack sqlite sources and create a directory _sqlite-arm_ in the same dir. 
! 
! 3. Edit _configure_ script in the sqlite dir and comment following lines out as shown - have fun finding them ;-)
! 
!   if test "$cross_compiling" = "yes"; then
!    { { echo "$as_me:12710: error: unable to find a compiler for building build tools" >&5
!    echo "$as_me: error: unable to find a compiler for building build tools" >&2;}
!    { (exit 1); exit 1; }; }
!   fi
! 
!   . . .
! 
!   else
!     test "$cross_compiling" = yes &&
!     { { echo "$as_me:13264: error: cannot check for file existence when cross compiling" >&5
!     echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
!     { (exit 1); exit 1; }; }
! 
!   . . .
! 
!   else
!    test "$cross_compiling" = yes &&
!    { { echo "$as_me:13464: error: cannot check for file existence when cross compiling" >&5
!   echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
!    { (exit 1); exit 1; }; }
! 
!   . . .
! 
!   else
!    test "$cross_compiling" = yes &&
!    { { echo "$as_me:13490: error: cannot check for file existence when cross compiling" >&5
!   echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
!    { (exit 1); exit 1; }; }
! 
! 
! 4. Save the configure script, change into the build directory you created and call the edited configure script from the sqlite directory by using the following option:
! 
! ../sqlite/configure --host=arm-linux
! 
! 5. 
! After that configure should have created a Makefile and a libtool script in your build directory.
! Open the Makefile using your favorite text editor and edit the following line:
! 
! 
! BCC = arm-linux-gcc -g -O2
! 
! to see:
! 
! BCC = gcc -g -O2
! 
! 
! 6. run _make_
! Now you should find a ".libs" directory in your build directory containing sqlite shared object files, like libsqlite.so.
! 
! Source (somewhat altered): http://www.kecher.de/howtos/SQLite-JDBC-Howto.html
! 
! =====
! *Win32 recompile with mingw32/msys*
! 
! 
! 1. Download mingw from http://prdownloads.sourceforge.net/mingw/MinGW-2.0.0-3.exe
! 
! 2. Download msys from http://prdownloads.sourceforge.net/mingw/MSYS-1.0.8.exe
! 
! 3. Install mingw to c:\mingw and msys to c:\mingw
! 
! 4. Download the FULL sqlite source (http://www.sqlite.org/sqlite-2.8.0.tar.gz)
!    and extract it into c:\mingw\sqlite
! 
! 5. start the msys.bat and cd to /home/drh/sqlite and ./configure with mingw/msys
! 
! 6. edit src/os.h, go to ~ line 90 (behind the #ifndef OS_UNIX block) and add
! 
!    #define OS_WIN 1
!    #define OS_MAC 0
!    #define OS_UNIX 0
! 
! 
! 
! to the source to force the os type. I don't know why but the os type isn't guessed right and redefined in the os.h... Whatever, force it ;) The defines from the makefile don't work.
! 
! 7. call mingw32-make to compile! make isn't used anymore (see http://www.mingw.org/mingwfaq.shtml#faq-mingw32-make.exe)
! 
! 
! 8. create a file called sqlite.def which contains
! 
!    EXPORTS
!    sqlite_open
!    sqlite_close
!    sqlite_exec
!    sqlite_last_insert_rowid
!    sqlite_error_string
!    sqlite_interrupt
!    sqlite_complete
!    sqlite_busy_handler
!    sqlite_busy_timeout
!    sqlite_get_table
!    sqlite_free_table
!    sqlite_mprintf
!    sqlite_vmprintf
!    sqlite_exec_printf
!    sqlite_exec_vprintf
!    sqlite_get_table_printf
!    sqlite_get_table_vprintf
!    sqlite_freemem
!    sqlite_libversion
!    sqlite_libencoding
!    sqlite_changes
!    sqlite_create_function
!    sqlite_create_aggregate
!    sqlite_function_type
!    sqlite_user_data
!    sqlite_aggregate_context
!    sqlite_aggregate_count
!    sqlite_set_result_string
!    sqlite_set_result_int
!    sqlite_set_result_double
!    sqlite_set_result_error
!    sqliteMalloc
!    sqliteFree
!    sqliteRealloc
!    sqlite_set_authorizer
!    sqlite_trace
!    sqlite_compile
!    sqlite_step
!    sqlite_finalize
! 
! 9. dllwrap --dllname sqlite.dll --def sqlite.def *.o
! (or if this doesn't work, dllwrap --def sqlite.def -v --export-all --driver-name gcc --dlltool-name dlltool --as as --target i386-mingw32 -dllname sqlite.dll -lmsvcrt *.o)
! 
! 10. strip sqlite.dll
! 
! 11. Ready.
! 
! ====
! *Win32 recompile with borland c++ builder*
! 
! 1. Download preprocessed source from http://www.sqlite.org/sqlite_source.zip
! 
! 2. Unzip the source to a project directory, e.g. C:\sqlite
! 
! 3. Fire up your borland c++ builder and create a new dll project, plain C without mfc or something like that
! 
! 4. Save the project as (e.g.) C:\sqlite\sqlite.bpr
! 
! 5. Add the sqlite source files from c:\sqlite to the project
! 
! 6. Remove the unit1.* files from your project
! 
! 7. Even if .def files are not the clean way, it will be easier than rewriting the sourcecode. Create the file sqlite.def with the following content and  add it to the project:
! 
!    LIBRARY sqlite.dll
!    EXPORTS
!    sqlite_open    = _sqlite_open
!    sqlite_close   = _sqlite_close
!    sqlite_exec    = _sqlite_exec
!    sqlite_last_insert_rowid   = _sqlite_last_insert_rowid
!    sqlite_error_string   = _sqlite_error_string
!    sqlite_interrupt   = _sqlite_interrupt
!    sqlite_complete   = _sqlite_complete
!    sqlite_busy_handler   = _sqlite_busy_handler
!    sqlite_busy_timeout   = _sqlite_busy_timeout
!    sqlite_get_table   = _sqlite_get_table
!    sqlite_free_table   = _sqlite_free_table
!    sqlite_mprintf   = _sqlite_mprintf
!    sqlite_vmprintf   = _sqlite_vmprintf
!    sqlite_exec_printf   = _sqlite_exec_printf
!    sqlite_exec_vprintf    = _sqlite_exec_vprintf
!    sqlite_get_table_printf   = _sqlite_get_table_printf
!    sqlite_get_table_vprintf   = _sqlite_get_table_vprintf
!    sqlite_freemem   = _sqlite_freemem
!    sqlite_libversion   = _sqlite_libversion
!    sqlite_libencoding   = _sqlite_libencoding
!    sqlite_changes   = _sqlite_changes
!    sqlite_create_function   = _sqlite_create_function
!    sqlite_create_aggregate   = _sqlite_create_aggregate
!    sqlite_function_type   = _sqlite_function_type
!    sqlite_user_data   = _sqlite_user_data
! 
! 
!    sqlite_aggregate_context   = _sqlite_aggregate_context
!    sqlite_aggregate_count   = _sqlite_aggregate_count
!    sqlite_set_result_string   = _sqlite_set_result_string
!    sqlite_set_result_int   = _sqlite_set_result_int
!    sqlite_set_result_double   = _sqlite_set_result_double
!    sqlite_set_result_error   = _sqlite_set_result_error
!    sqliteMalloc   = _sqliteMalloc
!    sqliteFree   = _sqliteFree
!    sqliteRealloc   = _sqliteRealloc
!    sqlite_set_authorizer   = _sqlite_set_authorizer
!    sqlite_trace   = _sqlite_trace
!    sqlite_compile   = _sqlite_compile
!    sqlite_step   = _sqlite_step
!    sqlite_finalize   = _sqlite_finalize
! 
! 
! 9. Fire up the compiler.
! 
! 10. Ready.
! 
! 
! ====
! *Mac OS X build*
! 
! I used the standard Unix build instructions...
! 
!   $ tar xzf sqlite.tar.gz       Unpacks into directory named "sqlite" 
!   $ mkdir bld                   Create a separate build directory 
!   $ cd bld
!   $ ../sqlite/configure --disable-shared
!   $ make                        Builds "sqlite" and "libsqlite.a" 
!   $ make test                   Optional: run regression tests 
! 
! *But* don't forget the implied
! 
!   $ make install
! 
! step!
! 
! The --disable-shared option is required for Mac OS X because libtool
! is busted and will generate an invalid shared library.
! 
! The usability of the sqlite shell is greatly enhanced if you have readline support. If you install GNU readline first, sqlite will link to it automatically. 
! 
! ====
! 
! Under AIX 4.3.3 with gcc
! 
!   fmedico <at> yahoo.com
! 
!   mkdir sqlite
!   cd sqlite
!   unzip ../sqlite_source.zip
!   rm tclsqlite.c libsqlite.a sqlite 2> /dev/null
!   for i in *.c; do gcc -g -O2 -c $i; done
!   rm shell.o
!   ar cr libsqlite.a *.o
!   ranlib libsqlite.a
!   gcc -o sqlite shell.c libsqlite.a
! 
! ====
! 
! *Cygwin*
! 
! 1. Run configure
! 
! 2. edit src/os.h, go to ~ line 90 (behind the #ifndef OS_UNIX block) and add ala mingw solution above
! 
!    #define OS_WIN 1
!    #define OS_MAC 0
!    #define OS_UNIX 0
! 
! A similar change has already been checked into the CVS tree and should
! appear with release 2.8.6.
! 
! ===
! 
! *Boost.Jam*
! 
! This assumes you're a C++ type who likes http://boost.org
! 
! Haven't gotten into the tcl interface, so the C_SOURCES variable bears
! 
! 
! 
! inspection.
! 
! 
! 
! Acquire boost, and boost jam.
! 
! Navigate to <boost path>/libs
! 
! 
! 
! mkdir sqlite
! 
! cd sqlite
! 
! mkdir src
! 
! mkdir build
! 
! cd src
! 
! <unzip the sqlite source code here>
! 
! cd ../build
! 
! <save the following text as Jamfile>
! 
! #  (C) Copyright  2002. Permission to copy, use, modify, sell and
! 
! #  distribute this software is granted provided this copyright notice appears
! 
! #  in all copies. This software is provided "as is" without express or implied
! 
! #  warranty, and with no claim as to its suitability for any purpose.
! 
! #
! 
! #
! 
! # Boost.sqlite build 
! 
! #
! 
! # To run all tests quietly: jam test
! 
! #
! 
! # Declares the following targets:
! 
! #   1. sqlite, a library to be linked with all
! 
! #      Boost.sqlite modules
! 
! #
! 
! # declare the location of this subproject relative to the root
! 
! subproject libs/sqlite/build ;
! 
! 
! 
! # Base names of the source files for libboost_sqlite
! 
! C_SOURCES = attach auth     btree   btree_rb build
! 
!             copy   delete   expr    func     hash
! 
!             insert main     opcodes os       pager
! 
!             parse  pragma   printf  random   select
! 
!             table  tokenize trigger vdbe     where
! 
!             update util     vacuum  
! 
!           ;
! 
! EXE_ONLY  = shell
! 
!           ;
! 
! 
! 
! dll sqlite : ../src/$(C_SOURCES).c
! 
!     : <sysinclude>$(BOOST_ROOT) 
! 
!     : debug release 
! 
!     ;
! 
! 
! 
! lib sqlite : ../src/$(C_SOURCES).c
! 
!     : <sysinclude>$(BOOST_ROOT) 
! 
!     : debug release 
! 
!     ;
! 
! 
! 
! exe sqlite       : ../src/$(C_SOURCES).c ../src/$(EXE_ONLY).c
! 
!     : <sysinclude>$(BOOST_ROOT) 
! 
!     : debug release 
! 
!     ;
! 
! 
! 
! 
! 
! Now you can just build sqlite along with the rest of boost.  Tested on VC7.1 and GCC 3.3.1.  Boost jam builds debug, release, static, and dynamically linked targets with a lack of fuss and 
! bother.
! 
! 
! ====
! 
! *AIX 5.2 with large file support*
! 
! I used the IBM compiler _xlc_ with specific cflags to build SQLite 2.8.7.
! AIX uses a slightly different define to enable 64 bit I/O in the system
! headers *_LARGE_FILES*.  SQLite expects *_LARGE_FILE*, so I define both
! flags.  The final two flags are *-q32* which builds as a 32 bit application
! and *-qlonglong*, which enables the _long long_ datatype.
! 
! 
! Here are the steps I used:
! 
!    ./configure
! 
! edit Makefile, change the TCC macro:
! 
!      TCC = xlc -q32 -qlonglong  -D_LARGE_FILE=1 -D_LARGE_FILES=1 -DUSE_TCL_STUBS=1 -O2 -DOS_UNIX=1 -DOS_WIN=0 -DHAVE_USLEEP=1 -I. -I${TOP}/src
! 
!    make
! 
! Tom Poindexter 2003-12-17
! 
! 
! ====
! 
! *Building a statically linked libtclsqlite*
! 
! I use SQLite as part of a Starkit-based application. See http://equi4.com/tclkit.html and http://equi4.com/starkit.html
! 
! In assembling a Starkit for Linux, one problem is incompatibility between
! different verions of glibc (e.g. RedHat 7.2 using glibc2.2, RedHat 8.0 using
! glibc2.3).  There is a static build of tclkit for linux that avoids this problem by statically linking all libraries.  I wanted the SQLite extension for Tcl to have the same feature.  
! 
! Here are steps to build a statically linked Tcl extension:
! 
! First, make sure that the -DUSE_TCL_STUBS=1 macro is defined in your TCC makefile macro.  We will be linking manually, so if using gcc, get the
! path to the libgcc.a for your installation:
! 
!    gcclib=`gcc -print-libgcc-file-name`
! 
! Add the following lines to your SQLite Makefile:
! 
!    echo '' >>Makefile
!    echo 'static-libtclsqlite.so:       tclsqlite.lo $(LIBOBJ)' >>Makefile
!    echo "          ld -shared -soname libtclsqlite.so  -o libtclsqlite.so *.o -L/usr/local/lib -ltclstub8.4  -static -ldl -lm -lc  $gcclib" >>Makefile
! 
! 
! Note that a tab should be inserted a the first character of the second line. Adjust your path to your Tcl install if not /usr/local/lib in order to find libtclstub8.4.a.  Now build:
! 
!    make
!    make static-libtclsqlite.so
! 
! Tom Poindexter 2003-12-17
! 
! ====