SQLite

Check-in [46c4b792e0]
Login

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

Overview
Comment::-) (CVS 38)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 46c4b792e0a0e61c417f5c1771e013d90d652507
User & Date: drh 2000-06-02 14:27:23.000
Context
2000-06-02
14:38
:-) (CVS 39) (check-in: 721d58f4e1 user: drh tags: trunk)
14:27
:-) (CVS 38) (check-in: 46c4b792e0 user: drh tags: trunk)
13:27
:-) (CVS 37) (check-in: 2b55f9b790 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
**
*************************************************************************
** 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.6 2000/06/02 13:27:59 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







|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
**
*************************************************************************
** 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.7 2000/06/02 14:27:23 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

  /* Attempt to read the schema */
  rc = sqliteInit(db, pzErrMsg);
  if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
    sqlite_close(db);
    return 0;
  }else{
    sqliteFree(pzErrMsg);
    *pzErrMsg = 0;
  }
  return db;
}

/*
** Close an existing SQLite database







|







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

  /* Attempt to read the schema */
  rc = sqliteInit(db, pzErrMsg);
  if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
    sqlite_close(db);
    return 0;
  }else{
    sqliteFree(*pzErrMsg);
    *pzErrMsg = 0;
  }
  return db;
}

/*
** Close an existing SQLite database
Changes to test/all.test.
18
19
20
21
22
23
24
25
26
27
28
29
30
31







32
33
34

35
36
37
# 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







|






>
>
>
>
>
>
>
|
|
|
>



18
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
# Author contact information:
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file runs all tests.
#
# $Id: all.test,v 1.2 2000/06/02 14:27:23 drh Exp $

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

if {[file exists ./sqlite_test_count]} {
  set COUNT [exec cat ./sqlite_test_count]
} else {
  set COUNT 1
}

for {set Counter 0} {$Counter<$COUNT} {incr Counter} {
  foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
    if {[file tail $testfile]=="all.test"} continue
    source $testfile
  }
}

really_finish_test
Changes to test/select2.test.
19
20
21
22
23
24
25
26
27
28
29
30
31

32
33
34



35
36
37
38
39
40
41
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the SELECT statement.
#
# $Id: select2.test,v 1.1 2000/06/02 13:28:16 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

execsql {CREATE TABLE tbl1(f1 int, f2 int)}

for {set i 0} {$i<=30} {incr i} {
  execsql "INSERT INTO tbl1 VALUES([expr {$i%9}],[expr {$i%10}])"
}




# Do a second query inside a first.
#
do_test select2-1.1 {
  set sql {SELECT DISTINCT f1 FROM tbl1 ORDER BY f1}
  set r {}
  db eval $sql data {







|





>

|

>
>
>







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
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the SELECT statement.
#
# $Id: select2.test,v 1.2 2000/06/02 14:27:23 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

execsql {CREATE TABLE tbl1(f1 int, f2 int)}
set f [open ./testdata1.txt w]
for {set i 0} {$i<=30} {incr i} {
  puts $f "[expr {$i%9}]\t[expr {$i%10}]\n"
}
close $f
execsql {COPY tbl1 FROM './testdata1.txt'}
# file delete -force ./testdata1.txt

# Do a second query inside a first.
#
do_test select2-1.1 {
  set sql {SELECT DISTINCT f1 FROM tbl1 ORDER BY f1}
  set r {}
  db eval $sql data {