Remove code for SQL cursors. (CVS 2312)

FossilOrigin-Name: 2eb90870556c90b8d85da3d5eb7554f74ec922c2
This commit is contained in:
danielk1977
2005-02-04 04:07:16 +00:00
parent 62d54916c4
commit 6a67fe8edf
18 changed files with 58 additions and 634 deletions
+21 -1
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API.
#
# $Id: capi2.test,v 1.24 2005/01/20 22:48:48 drh Exp $
# $Id: capi2.test,v 1.25 2005/02/04 04:07:18 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@@ -252,6 +252,26 @@ do_test capi2-3.19 {
list [sqlite3_finalize $VM] [sqlite3_errmsg $DB]
} {SQLITE_CONSTRAINT {t2.a may not be NULL}}
do_test capi2-3.20 {
execsql {
CREATE TABLE a1(message_id, name , UNIQUE(message_id, name) );
INSERT INTO a1 VALUES(1, 1);
}
} {}
do_test capi2-3.21 {
set VM [sqlite3_prepare $DB {INSERT INTO a1 VALUES(1, 1)} -1 TAIL]
sqlite3_step $VM
} {SQLITE_ERROR}
do_test capi2-3.22 {
sqlite3_errcode $DB
} {SQLITE_ERROR}
do_test capi2-3.23 {
sqlite3_finalize $VM
} {SQLITE_CONSTRAINT}
do_test capi2-3.24 {
sqlite3_errcode $DB
} {SQLITE_CONSTRAINT}
# Two or more virtual machines exists at the same time.
#
do_test capi2-4.1 {
+1 -2
View File
@@ -13,7 +13,7 @@
# This file implements tests to make sure SQLite does not crash or
# segfault if it sees a corrupt database file.
#
# $Id: corrupt.test,v 1.4 2005/01/20 02:17:02 danielk1977 Exp $
# $Id: corrupt.test,v 1.5 2005/02/04 04:07:18 danielk1977 Exp $
catch {file delete -force test.db}
catch {file delete -force test.db-journal}
@@ -81,7 +81,6 @@ for {set i [expr {1*256}]} {$i<$fsize-256} {incr i 256} {
seek $fd $i
puts -nonewline $fd $junk
close $fd
sqlite3 db test.db
do_test corrupt-2.$tn.1 {
sqlite3 db test.db
catchsql {SELECT count(*) FROM sqlite_master}
-136
View File
@@ -1,136 +0,0 @@
# 2004 November 22
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The
# focus of this script is DECLARE...CURSOR functionality
#
# $Id: cursor.test,v 1.2 2004/11/23 01:47:31 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_OMIT_CURSOR is defined, omit this file.
ifcapable {!cursor} {
finish_test
return
}
########
# Test the logic that creates and destroys cursors
########
do_test cursor-1.1 {
execsql {
CREATE TABLE t1(a,b,c);
CREATE INDEX t1i1 ON t1(a);
CREATE INDEX t1i2 ON t1(b,c);
}
execsql {
DECLARE c1 CURSOR FOR SELECT c FROM t1 ORDER BY a;
}
} {}
ifcapable schema_pragmas {
do_test cursor-1.2 {
execsql {PRAGMA cursor_list}
} {0 c1}
}
do_test cursor-1.3 {
execsql {
DECLARE c2 CURSOR FOR SELECT a FROM t1 ORDER BY b, c;
}
} {}
ifcapable schema_pragmas {
do_test cursor-1.4 {
execsql {PRAGMA cursor_list}
} {0 c1 1 c2}
}
do_test cursor-1.5 {
catchsql {
CLOSE c3;
}
} {1 {no such cursor: c3}}
ifcapable schema_pragmas {
do_test cursor-1.6 {
execsql {PRAGMA cursor_list}
} {0 c1 1 c2}
}
do_test cursor-1.7 {
catchsql {
CLOSE c1;
}
} {0 {}}
ifcapable schema_pragmas {
do_test cursor-1.8 {
execsql {PRAGMA cursor_list}
} {1 c2}
}
do_test cursor-1.9 {
catchsql {
CLOSE c1;
}
} {1 {no such cursor: c1}}
ifcapable schema_pragmas {
do_test cursor-1.10 {
execsql {PRAGMA cursor_list}
} {1 c2}
}
do_test cursor-1.11 {
catchsql {
DECLARE c2 CURSOR FOR SELECT * FROM t1;
}
} {1 {another cursor named c2 already exists}}
do_test cursor-1.12 {
catchsql {
DECLARE c3 CURSOR FOR SELECT * FROM t1;
}
} {0 {}}
ifcapable schema_pragmas {
do_test cursor-1.13 {
execsql {PRAGMA cursor_list}
} {0 c3 1 c2}
}
do_test cursor-1.14 {
execsql {
CLOSE c2;
CLOSE c3;
}
} {}
ifcapable schema_pragmas {
do_test cursor-1.15 {
execsql {PRAGMA cursor_list}
} {}
}
set all {}
for {set i 1} {$i<=50} {incr i} {
lappend all [expr {$i-1}] x$i
do_test cursor-2.1.$i.1 {
execsql "DECLARE x$i CURSOR FOR SELECT * FROM t1"
} {}
ifcapable schema_pragmas {
do_test cursor-2.1.$i.2 {
execsql {PRAGMA cursor_list}
} $all
}
}
for {set i 1} {$i<=50} {incr i} {
set all [lrange $all 2 end]
do_test cursor-2.2.$i.1 {
execsql "CLOSE x$i"
} {}
ifcapable schema_pragmas {
do_test cursor-2.2.$i.2 {
execsql {PRAGMA cursor_list}
} $all
}
}
finish_test