1# Copyright (c) 2001 D. Richard Hipp 2# 3# This program is free software; you can redistribute it and/or 4# modify it under the terms of the GNU General Public 5# License as published by the Free Software Foundation; either 6# version 2 of the License, or (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11# General Public License for more details. 12# 13# You should have received a copy of the GNU General Public 14# License along with this library; if not, write to the 15# Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16# Boston, MA 02111-1307, USA. 17# 18# Author contact information: 19# [email protected] 20# http://www.hwaci.com/drh/ 21# 22#*********************************************************************** 23# This file implements regression tests for SQLite library. The 24# focus of this file is testing the sqlite_exec_printf() and 25# sqlite_get_table_printf() APIs. 26# 27# $Id: tableapi.test,v 1.1 2001/04/07 15:24:34 drh Exp $ 28 29set testdir [file dirname $argv0] 30source $testdir/tester.tcl 31 32do_test tableapi-1.0 { 33 set ::dbx [sqlite_open testdb] 34 catch {sqlite_exec_printf $::dbx {DROP TABLE xyz} {}} 35 sqlite_exec_printf $::dbx {CREATE TABLE %s(a int, b text)} xyz 36} {0 {}} 37do_test tableapi-1.1 { 38 sqlite_exec_printf $::dbx { 39 INSERT INTO xyz VALUES(1,'%q') 40 } {Hi Y'all} 41} {0 {}} 42do_test tableapi-1.2 { 43 sqlite_exec_printf $::dbx {SELECT * FROM xyz} {} 44} {0 {a b 1 {Hi Y'all}}} 45 46do_test tableapi-2.1 { 47 sqlite_get_table_printf $::dbx { 48 SELECT * FROM xyz WHERE b='%q' 49 } {Hi Y'all} 50} {0 1 2 a b 1 {Hi Y'all}} 51 52do_test tableapi-99.0 { 53 sqlite_close $::dbx 54} {} 55 56finish_test 57