mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add the "onecolumn" method to the TCL language bindings. (CVS 1076)
FossilOrigin-Name: c7b4c28fbc0bca5645af5750fd353f4eca400b40
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
# interface is pretty well tested. This file contains some addition
|
||||
# tests for fringe issues that the main test suite does not cover.
|
||||
#
|
||||
# $Id: tclsqlite.test,v 1.13 2003/04/23 12:25:25 drh Exp $
|
||||
# $Id: tclsqlite.test,v 1.14 2003/08/19 14:31:02 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -29,7 +29,7 @@ do_test tcl-1.1 {
|
||||
do_test tcl-1.2 {
|
||||
set v [catch {db bogus} msg]
|
||||
lappend v $msg
|
||||
} {1 {bad option "bogus": must be authorizer, busy, changes, close, complete, errorcode, eval, function, last_insert_rowid, timeout, or trace}}
|
||||
} {1 {bad option "bogus": must be authorizer, busy, changes, close, complete, errorcode, eval, function, last_insert_rowid, onecolumn, timeout, or trace}}
|
||||
do_test tcl-1.3 {
|
||||
execsql {CREATE TABLE t1(a int, b int)}
|
||||
execsql {INSERT INTO t1 VALUES(10,20)}
|
||||
@ -90,5 +90,23 @@ if {[sqlite -encoding]=="iso8859" && [sqlite -tcl-uses-utf]} {
|
||||
} "a b\306"
|
||||
}
|
||||
|
||||
# Test the onecolumn method
|
||||
#
|
||||
do_test tcl-3.1 {
|
||||
execsql {
|
||||
INSERT INTO t1 SELECT a*2, b*2 FROM t1;
|
||||
INSERT INTO t1 SELECT a*2+1, b*2+1 FROM t1;
|
||||
INSERT INTO t1 SELECT a*2+3, b*2+3 FROM t1;
|
||||
}
|
||||
db onecolumn {SELECT * FROM t1 ORDER BY a}
|
||||
} {10}
|
||||
do_test tcl-3.2 {
|
||||
db onecolumn {SELECT * FROM t1 WHERE a<0}
|
||||
} {}
|
||||
do_test tcl-3.3 {
|
||||
set rc [catch {db onecolumn} errmsg]
|
||||
lappend rc $errmsg
|
||||
} {1 {wrong # args: should be "db onecolumn SQL"}}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user