SQLite

Check-in [e34143c24f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment::-) (CVS 8)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e34143c24f1b3eff0c9f1e22702f099674e0ef4e
User & Date: drh 2000-05-29 23:48:23.000
Context
2000-05-29
23:58
:-) (CVS 9) (check-in: 84333008b7 user: drh tags: trunk)
23:48
:-) (CVS 8) (check-in: e34143c24f user: drh tags: trunk)
23:30
:-) (CVS 7) (check-in: fdf4b31a18 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to Makefile.in.
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
gdbmdump:	$(TOP)/tool/gdbmdump.c
	$(TCC) $(GDBM_FLAGS) -o gdbmdump $(TOP)/tool/gdbmdump.c $(LIBGDBM)

tclsqlite:	$(TOP)/src/tclsqlite.c libsqlite.a
	$(TCC) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite \
		$(TOP)/src/tclsqlite.c libsqlite.a $(LIBGDBM) $(LIBTCL)

regression:	tclsqlite
	for i in $(TOP)/test/*.test; do ./tclsqlite $$i; done


TARBALL = \
  sqlite/COPYRIGHT \
  sqlite/doc/*.html \
  sqlite/src/*.h \
  sqlite/src/*.c \
  sqlite/tool/*.c \







|
<
|







113
114
115
116
117
118
119
120

121
122
123
124
125
126
127
128
gdbmdump:	$(TOP)/tool/gdbmdump.c
	$(TCC) $(GDBM_FLAGS) -o gdbmdump $(TOP)/tool/gdbmdump.c $(LIBGDBM)

tclsqlite:	$(TOP)/src/tclsqlite.c libsqlite.a
	$(TCC) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite \
		$(TOP)/src/tclsqlite.c libsqlite.a $(LIBGDBM) $(LIBTCL)

test:	tclsqlite

	./tclsqlite $(TOP)/test/all.test

TARBALL = \
  sqlite/COPYRIGHT \
  sqlite/doc/*.html \
  sqlite/src/*.h \
  sqlite/src/*.c \
  sqlite/tool/*.c \
Changes to README.
24
25
26
27
28
29
30
31
32
33
34
35
36
    sqlite.h           A header file for SQLite

    sqlite             Command line program for accessing SQLite databases

There are some other make targets of interest:


   make regression        This runs a regression test on the library.

   make gdbmdump          This builds a utility named "gdbmdump" that
                          writes out the contents of a GDBM file in a
                          readable format.  It is useful for testing and
                          debugging the library.







|





24
25
26
27
28
29
30
31
32
33
34
35
36
    sqlite.h           A header file for SQLite

    sqlite             Command line program for accessing SQLite databases

There are some other make targets of interest:


   make test              This runs a regression test on the library.

   make gdbmdump          This builds a utility named "gdbmdump" that
                          writes out the contents of a GDBM file in a
                          readable format.  It is useful for testing and
                          debugging the library.
Changes to src/util.c.
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.3 2000/05/29 23:30:51 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>

/*
** Allocate new memory and set it to zero.  Return NULL if







|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.4 2000/05/29 23:48:23 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>

/*
** Allocate new memory and set it to zero.  Return NULL if
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
  return *a - *b;
}
int sqliteStrNICmp(const char *zLeft, const char *zRight, int N){
  register unsigned char *a, *b;
  a = (unsigned char *)zLeft;
  b = (unsigned char *)zRight;
  while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
  return N<=0 ? 0 : *a - *b;
}

/* Notes on string comparisions.
**
** We want the main string comparision function used for sorting to
** sort both numbers and alphanumeric words into the correct sequence.
** The same routine should do both without prior knowledge of which







|







185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
  return *a - *b;
}
int sqliteStrNICmp(const char *zLeft, const char *zRight, int N){
  register unsigned char *a, *b;
  a = (unsigned char *)zLeft;
  b = (unsigned char *)zRight;
  while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
  return N<0 ? 0 : *a - *b;
}

/* Notes on string comparisions.
**
** We want the main string comparision function used for sorting to
** sort both numbers and alphanumeric words into the correct sequence.
** The same routine should do both without prior knowledge of which
Added test/all.test.










































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright (c) 1999, 2000 D. Richard Hipp
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
# 
# You should have received a copy of the GNU General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA  02111-1307, USA.
#
# Author contact information:
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file runs all tests.
#
# $Id: all.test,v 1.1 2000/05/29 23:48:23 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
rename finish_test really_finish_test
proc finish_test {} {}

foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
  if {[file tail $testfile]=="all.test"} continue
  source $testfile
}

really_finish_test
Changes to test/tester.tcl.
19
20
21
22
23
24
25
26
27












28
29
30
31
32
33
34
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.1 2000/05/29 20:41:51 drh Exp $













set nErr 0
set nTest 0

# Invoke the do_test procedure to run a single test 
#
proc do_test {name cmd expected} {
  global argv nErr nTest







|

>
>
>
>
>
>
>
>
>
>
>
>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.2 2000/05/29 23:48:23 drh Exp $

# Create a test database
#
file delete -force testdb
file mkdir testdb
sqlite db testdb

# Abort early if this script has been run before.
#
if {[info exists nTest]} return

# Set the test counters to zero
#
set nErr 0
set nTest 0

# Invoke the do_test procedure to run a single test 
#
proc do_test {name cmd expected} {
  global argv nErr nTest
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
proc finish_test {} {
  global nTest nErr
  puts "$nErr errors out of $nTest tests"
  exit $nErr
}

# Create a test database
#
file delete -force testdb
file mkdir testdb
sqlite db testdb

# A procedure to execute SQL
#
proc execsql {sql} {
  set result {}
  db eval $sql data {
    foreach f [lsort [array names data]] {
      if {$f=="*"} continue
      lappend result $data($f)
    }
  }
  return $result
}







<
<
<
<
<
<












74
75
76
77
78
79
80






81
82
83
84
85
86
87
88
89
90
91
92
#
proc finish_test {} {
  global nTest nErr
  puts "$nErr errors out of $nTest tests"
  exit $nErr
}







# A procedure to execute SQL
#
proc execsql {sql} {
  set result {}
  db eval $sql data {
    foreach f [lsort [array names data]] {
      if {$f=="*"} continue
      lappend result $data($f)
    }
  }
  return $result
}