**
*************************************************************************
** Main file for the SQLite library. The routines in this file
** implement the programmer interface to the library. Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.18 2000/08/22 13:40:51 drh Exp $
*/
#include "sqliteInt.h"
/*
** This is the callback routine for the code that initializes the
** database. Each callback contains text of a CREATE TABLE or
** CREATE INDEX statement that must be parsed to yield the internal
................................................................................
** argument.
*/
static int sqlite_default_busy_callback(
void *Timeout, /* Maximum amount of time to wait */
const char *NotUsed, /* The name of the table that is busy */
int count /* Number of times table has been busy */
){
int rc;
#if defined(HAVE_USLEEP) && HAVE_USLEEP
int delay = 10000;
int prior_delay = 0;
int timeout = (int)Timeout;
int i;
for(i=1; i<count; i++){

**
*************************************************************************
** Main file for the SQLite library. The routines in this file
** implement the programmer interface to the library. Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.19 2000/10/11 19:28:52 drh Exp $
*/
#include "sqliteInt.h"
/*
** This is the callback routine for the code that initializes the
** database. Each callback contains text of a CREATE TABLE or
** CREATE INDEX statement that must be parsed to yield the internal
................................................................................
** argument.
*/
static int sqlite_default_busy_callback(
void *Timeout, /* Maximum amount of time to wait */
const char *NotUsed, /* The name of the table that is busy */
int count /* Number of times table has been busy */
){
#if defined(HAVE_USLEEP) && HAVE_USLEEP
int delay = 10000;
int prior_delay = 0;
int timeout = (int)Timeout;
int i;
for(i=1; i<count; i++){

Changes to src/printf.c.

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

**
** + When compiled using GCC on a SPARC, this version of printf is
** faster than the library printf for SUN OS 4.1.
**
** + All functions are fully reentrant.
**
*/
#include "sqliteInt.h"
/*
** Undefine COMPATIBILITY to make some slight changes in the way things
** work. I think the changes are an improvement, but they are not
** backwards compatible.
*/
/* #define COMPATIBILITY / * Compatible with SUN OS 4.1 */

>
>

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

**
** + When compiled using GCC on a SPARC, this version of printf is
** faster than the library printf for SUN OS 4.1.
**
** + All functions are fully reentrant.
**
*/
#include <ctype.h>
#include "sqliteInt.h"
/*
** Undefine COMPATIBILITY to make some slight changes in the way things
** work. I think the changes are an improvement, but they are not
** backwards compatible.
*/
/* #define COMPATIBILITY / * Compatible with SUN OS 4.1 */

Changes to src/table.c.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

** This routine is called once for each row in the result table. Its job
** is to fill in the TabResult structure appropriately, allocating new
** memory as necessary.
*/
static int sqlite_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
TabResult *p = (TabResult*)pArg;
int need;
int i, len;
char *z, *zVal;
/* Make sure there is enough space in p->azResult to hold everything
** we need to remember from this invocation of the callback.
*/
if( p->nRow==0 ){
p->nColumn = nCol;
need = nCol*2;

|
|

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

** This routine is called once for each row in the result table. Its job
** is to fill in the TabResult structure appropriately, allocating new
** memory as necessary.
*/
static int sqlite_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
TabResult *p = (TabResult*)pArg;
int need;
int i;
char *z;
/* Make sure there is enough space in p->azResult to hold everything
** we need to remember from this invocation of the callback.
*/
if( p->nRow==0 ){
p->nColumn = nCol;
need = nCol*2;

** inplicit conversion from one type to the other occurs as necessary.
**
** Most of the code in this file is taken up by the sqliteVdbeExec()
** function which does the work of interpreting a VDBE program.
** But other routines are also provided to help in building up
** a program instruction by instruction.
**
** $Id: vdbe.c,v 1.41 2000/09/14 01:21:10 drh Exp $
*/
#include "sqliteInt.h"
#include <unistd.h>
/*
** SQL is translated into a sequence of instructions to be
** executed by a virtual machine. Each instruction is an instance
** of the following structure.
*/
typedef struct VdbeOp Op;

|
>

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

** inplicit conversion from one type to the other occurs as necessary.
**
** Most of the code in this file is taken up by the sqliteVdbeExec()
** function which does the work of interpreting a VDBE program.
** But other routines are also provided to help in building up
** a program instruction by instruction.
**
** $Id: vdbe.c,v 1.42 2000/10/11 19:28:53 drh Exp $
*/
#include "sqliteInt.h"
#include <unistd.h>
#include <ctype.h>
/*
** SQL is translated into a sequence of instructions to be
** executed by a virtual machine. Each instruction is an instance
** of the following structure.
*/
typedef struct VdbeOp Op;

}
proc chng {date desc} {
puts "<DT><B>$date</B></DT>"
puts "<DD><P><UL>$desc</UL></P></DD>"
}
chng {2000 Oct 11 (Not Released)} {<li>Added notes on how to compile for Windows95/98.</li><li>Add Doug Lea's memory allocator to the distribution, for completeness.</li><li>Removed a few variables that were not being used. Etc.</li>}
chng {2000 Oct 8 (1.0.9)} {
<li>Added the <b>sqlite_..._printf()</b> interface routines.</li>
<li>Modified the <b>sqlite</b> shell program to use the new interface
routines.</li>
<li>Modified the <b>sqlite</b> shell program to print the schema for
the built-in SQLITE_MASTER table, if explicitly requested.</li>

#
# Run this Tcl script to generate the crosscompile.html file.
#
set rcsid {$Id: crosscompile.tcl,v 1.3 2000/10/11 19:28:53 drh Exp $}
puts {<html>
<head>
<title>Notes On How To Compile SQLite Using The MinGW Cross-Compiler</title>
</head>
<body bgcolor=white>
<h1 align=center>
................................................................................
<p><a href="http://www.mingw.org/">MinGW</a> or
<a href="http://www.mingw.org/">Minimalist GNU For Windows</a>
is a version of the popular GCC compiler that builds Win95/Win98/WinNT
binaries. See the website for details.</p>
<p>This page describes how you can use MinGW configured as a
cross-compiler running under RedHat 6.0 Linux to generate a
binary for SQLite that runs under WinNT.
Some additional steps (described <a href="#win95">below</a>)are needed to target Win95/98.</p>
}
proc Code {body} {
puts {<blockquote><pre>}
regsub -all {&} [string trim $body] {\&amp;} body
regsub -all {>} $body {\&gt;} body
regsub -all {<} $body {\&lt;} body
................................................................................
<p>Configure and build SQLite:</p>
<blockquote><pre>
../sqlite/configure --with-hints=./mingw.hints
make
</pre></blockquote>
</li>
</ol>
<a name="win95"><h2>Targetting Windows95/98 instead of WindowsNT</h2><p>A small amount of additional work is needed to get SQLite runningunder Windows95/98. The first problem is that the LockFile() andUnlockFile() API that the Roth GDBM port uses does not work underWindows95. The easiest workaround is to just disable file lockingin the GDBM library. You can do so by appending a few lines of codeto the end of one of the GDBM source files and compiling the libraryusing a special command-line option. Replace step (4) above asfollows:</p><ol><li value="4"><p>Append text to the <b>systems.h</b> source file as follows:</p><blockquote><pre>cat &gt;&gt;systems.h &lt;&lt;\END#ifdef NO_LOCKS#undef UNLOCK_FILE#define UNLOCK_FILE(x)#undef READLOCK_FILE#define READLOCK_FILE(x)#undef WRITELOCK_FILE#define WRITELOCK_FILE(x)#endifEND</pre></blockquote><p>Then manually build the GDBM library with the extra"NO_LOCKS" define as follows:</p><blockquote><pre>i386-mingw32-gcc -DWIN32=1 -DNO_LOCKS -O2 -c *.ci386-mingw32-ar cr libgdbm.a *.oi386-mingw32-ranlib libgdbm.acd ..</pre></blockquote></p></li></ol><p>Note that the locking problem has been reported and may actuallybe fixed in the Roth GDBM distribution by the time you read this.You should probably check before you make the above changes.</p><p>The above is all you have to do to get SQLite to work on Windows95.But one more step is required to get it to work <i>well</i>. Itturns out that SQLite make heavy use of <b>malloc()</b> and<b>free()</b> and the implementation of this functionson Windows95 is particular poor. Large database queries will runmore than 10 times faster if you substitute a better memory allocatorsuch as the one by<a href="http://g.oswego.edu/dl/html/malloc.html">Doug Lea</a>.A copy of Doug's allocator is included in the <b>contrib</b>directory of the source tree. Speed improvements are also reportedon WindowsNT when alternative memory allocators are used, thoughthe speedup is not as dramatic as it is with WIndows95.</p>
}
puts {
<p><hr /></p>
<p><a href="index.html"><img src="/goback.jpg" border=0 />
Back to the SQLite Home Page</a>
</p>
</body></html>}

This page was generated in about
0.105s by
Fossil 2.6 [9b4e157b1e] 2018-08-12 10:42:50