Add comments to test1.c. (CVS 1659)

FossilOrigin-Name: be6bd6c99dde902aafd02d8a72f3d42826caabe8
This commit is contained in:
drh 2004-06-22 12:46:53 +00:00
parent 83f4707ab2
commit 241db313b4
4 changed files with 93 additions and 41 deletions

View File

@ -1,5 +1,5 @@
C Add\sos_tst.c\sto\sthe\sTESTSRC\smacro\sin\smain.mk.\s(CVS\s1658)
D 2004-06-22T12:30:20
C Add\scomments\sto\stest1.c.\s(CVS\s1659)
D 2004-06-22T12:46:54
F Makefile.in 0a3d7aaefa50717bd550b0cf568a51072c4c103c
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -62,7 +62,7 @@ F src/sqlite.h.in 1f400a561fca3b1df73677d2d97046425d47cae4
F src/sqliteInt.h dd796b6abc6d50505fe33c54f0143d7000681a41
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
F src/tclsqlite.c 8d093146332b2f0cbf2a8ebe8597d481619308a3
F src/test1.c 9a9d9069c1c390c8be81038f77aed976bb58844c
F src/test1.c cd1284a7e62b2523cfee146a758a3c2416d25657
F src/test2.c dafd8bd314a554bf376c6d3a8c83fd69219f5a40
F src/test3.c 7247090d15a5a43823079b6fd8dad1ed3cccdedf
F src/test4.c a921a69821fd30209589228e64f94e9f715b6fe2
@ -87,7 +87,7 @@ F test/attach3.test c4cc0b806783ce3d860af6b80c947f93ffb14270
F test/auth.test a211eab0542ec024b578d771b09242dd9bb1aba3
F test/bigfile.test a1101b46528ad7282fb9b323d25da18672a3bd0a
F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
F test/bind.test 4ccea5041be85914608ba67097a85248c3e3134d
F test/bind.test 028f65c44d5addfedaf81eb4c0b69a63d2439241
F test/blob.test 8727a7b46b2073a369cfc9bcb6f54dd366b9d884
F test/btree.test f1dc208d59b1c28f853ba09dd2553fc3382d22b6
F test/btree2.test aa4a6d05b1ea90b1acaf83ba89039dd302a88635
@ -227,7 +227,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl af528563442e3039928f9018327a18157e53a44f
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P ecdb93d3c92e34f7d85aa2fd703880669397b216
R 1e01c88734384dabe83d06ec8278258d
P d0def160e5cf37cde771c2d9b18904a2a1f8c358
R 8248cc6658aa6d7649f6f797445f6e81
U drh
Z 86334b34bd6d33aac7e9e0c5563c0932
Z e125e35ec1374207bd595447efc0138e

View File

@ -1 +1 @@
d0def160e5cf37cde771c2d9b18904a2a1f8c358
be6bd6c99dde902aafd02d8a72f3d42826caabe8

View File

@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.81 2004/06/22 12:18:32 danielk1977 Exp $
** $Id: test1.c,v 1.82 2004/06/22 12:46:54 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@ -998,10 +998,12 @@ static int sqlite3_crashseed(
#endif
return TCL_OK;
#ifdef OS_TEST
bad_args:
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), "<seed>", 0);
return TCL_ERROR;
#endif
}
@ -1027,7 +1029,14 @@ static int test_breakpoint(
return TCL_OK; /* Do nothing */
}
static int test_bind_int32(
/*
** Usage: sqlite3_bind_int STMT N VALUE
**
** Test the sqlite3_bind_int interface. STMT is a prepared statement.
** N is the index of a wildcard in the prepared statement. This command
** binds a 32-bit integer VALUE to that wildcard.
*/
static int test_bind_int(
void * clientData,
Tcl_Interp *interp,
int objc,
@ -1040,7 +1049,7 @@ static int test_bind_int32(
if( objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), " <STMT> <param no.> <value>", 0);
Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE", 0);
return TCL_ERROR;
}
@ -1056,6 +1065,14 @@ static int test_bind_int32(
return TCL_OK;
}
/*
** Usage: sqlite3_bind_int64 STMT N VALUE
**
** Test the sqlite3_bind_int64 interface. STMT is a prepared statement.
** N is the index of a wildcard in the prepared statement. This command
** binds a 64-bit integer VALUE to that wildcard.
*/
static int test_bind_int64(
void * clientData,
Tcl_Interp *interp,
@ -1069,7 +1086,7 @@ static int test_bind_int64(
if( objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), " <STMT> <param no.> <value>", 0);
Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE", 0);
return TCL_ERROR;
}
@ -1085,6 +1102,14 @@ static int test_bind_int64(
return TCL_OK;
}
/*
** Usage: sqlite3_bind_double STMT N VALUE
**
** Test the sqlite3_bind_double interface. STMT is a prepared statement.
** N is the index of a wildcard in the prepared statement. This command
** binds a 64-bit integer VALUE to that wildcard.
*/
static int test_bind_double(
void * clientData,
Tcl_Interp *interp,
@ -1098,7 +1123,7 @@ static int test_bind_double(
if( objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), " <STMT> <param no.> <value>", 0);
Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE", 0);
return TCL_ERROR;
}
@ -1114,6 +1139,13 @@ static int test_bind_double(
return TCL_OK;
}
/*
** Usage: sqlite3_bind_null STMT N
**
** Test the sqlite3_bind_null interface. STMT is a prepared statement.
** N is the index of a wildcard in the prepared statement. This command
** binds a NULL to the wildcard.
*/
static int test_bind_null(
void * clientData,
Tcl_Interp *interp,
@ -1126,7 +1158,7 @@ static int test_bind_null(
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), " <STMT> <param no.>", 0);
Tcl_GetStringFromObj(objv[0], 0), " STMT N", 0);
return TCL_ERROR;
}
@ -1141,6 +1173,14 @@ static int test_bind_null(
return TCL_OK;
}
/*
** Usage: sqlite3_bind_text STMT N STRING BYTES
**
** Test the sqlite3_bind_text interface. STMT is a prepared statement.
** N is the index of a wildcard in the prepared statement. This command
** binds a UTF-8 string STRING to the wildcard. The string is BYTES bytes
** long.
*/
static int test_bind_text(
void * clientData,
Tcl_Interp *interp,
@ -1155,8 +1195,7 @@ static int test_bind_text(
if( objc!=5 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), " <STMT> <param no.> <value>"
" <bytes>", 0);
Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE BYTES", 0);
return TCL_ERROR;
}
@ -1173,6 +1212,14 @@ static int test_bind_text(
return TCL_OK;
}
/*
** Usage: sqlite3_bind_text16 STMT N STRING BYTES
**
** Test the sqlite3_bind_text16 interface. STMT is a prepared statement.
** N is the index of a wildcard in the prepared statement. This command
** binds a UTF-16 string STRING to the wildcard. The string is BYTES bytes
** long.
*/
static int test_bind_text16(
void * clientData,
Tcl_Interp *interp,
@ -1187,8 +1234,7 @@ static int test_bind_text16(
if( objc!=5 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), " <STMT> <param no.> <value>"
" <bytes>", 0);
Tcl_GetStringFromObj(objv[0], 0), " STMT N VALUE BYTES", 0);
return TCL_ERROR;
}
@ -1205,6 +1251,13 @@ static int test_bind_text16(
return TCL_OK;
}
/*
** Usage: sqlite3_bind_blob STMT N DATA BYTES
**
** Test the sqlite3_bind_blob interface. STMT is a prepared statement.
** N is the index of a wildcard in the prepared statement. This command
** binds a BLOB to the wildcard. The BLOB is BYTES bytes in size.
*/
static int test_bind_blob(
void * clientData,
Tcl_Interp *interp,
@ -1219,8 +1272,7 @@ static int test_bind_blob(
if( objc!=5 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), " <STMT> <param no.> <value>"
" <bytes>", 0);
Tcl_GetStringFromObj(objv[0], 0), " STMT N DATA BYTES", 0);
return TCL_ERROR;
}
@ -1703,7 +1755,7 @@ static int test_data_count(
** Usage: sqlite3_column_name STMT column
*/
static int test_stmt_utf8(
void * clientData,
void * clientData, /* Pointer to SQLite API function to be invoke */
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
@ -1736,7 +1788,7 @@ static int test_stmt_utf8(
** Usage: sqlite3_column_name STMT column
*/
static int test_stmt_utf16(
void * clientData,
void * clientData, /* Pointer to SQLite API function to be invoked */
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
@ -1774,7 +1826,7 @@ static int test_stmt_utf16(
**
*/
static int test_stmt_int(
void * clientData,
void * clientData, /* Pointer to SQLite API function to be invoked */
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
@ -1973,9 +2025,9 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
Tcl_ObjCmdProc *xProc;
void *clientData;
} aObjCmd[] = {
{ "sqlite3_bind_int32", test_bind_int32, 0 },
{ "sqlite3_bind_int64", test_bind_int64 , 0 },
{ "sqlite3_bind_double", test_bind_double, 0 },
{ "sqlite3_bind_int", test_bind_int, 0 },
{ "sqlite3_bind_int64", test_bind_int64, 0 },
{ "sqlite3_bind_double", test_bind_double, 0 },
{ "sqlite3_bind_null", test_bind_null ,0 },
{ "sqlite3_bind_text", test_bind_text ,0 },
{ "sqlite3_bind_text16", test_bind_text16 ,0 },
@ -2000,15 +2052,15 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_column_blob", test_column_blob ,0 },
{ "sqlite3_column_double", test_column_double ,0 },
{ "sqlite3_column_int64", test_column_int64 ,0 },
{ "sqlite3_column_int", test_stmt_int ,sqlite3_column_int },
{ "sqlite3_column_bytes", test_stmt_int ,sqlite3_column_bytes },
{ "sqlite3_column_bytes16", test_stmt_int ,sqlite3_column_bytes16 },
{ "sqlite3_column_text", test_stmt_utf8, sqlite3_column_text},
{ "sqlite3_column_decltype", test_stmt_utf8, sqlite3_column_decltype},
{ "sqlite3_column_name", test_stmt_utf8, sqlite3_column_name},
{ "sqlite3_column_text16", test_stmt_utf16, sqlite3_column_text16},
{ "sqlite3_column_decltype16", test_stmt_utf16,sqlite3_column_decltype16},
{ "sqlite3_column_name16", test_stmt_utf16, sqlite3_column_name16},
{ "sqlite3_column_int", test_stmt_int, sqlite3_column_int },
{ "sqlite3_column_bytes", test_stmt_int, sqlite3_column_bytes },
{ "sqlite3_column_bytes16", test_stmt_int, sqlite3_column_bytes16 },
{ "sqlite3_column_text", test_stmt_utf8, sqlite3_column_text },
{ "sqlite3_column_decltype", test_stmt_utf8, sqlite3_column_decltype },
{ "sqlite3_column_name", test_stmt_utf8, sqlite3_column_name },
{ "sqlite3_column_text16", test_stmt_utf16, sqlite3_column_text16 },
{ "sqlite3_column_decltype16", test_stmt_utf16, sqlite3_column_decltype16},
{ "sqlite3_column_name16", test_stmt_utf16, sqlite3_column_name16 },
/* Functions from os.h */
{ "sqlite3OsOpenReadWrite",test_sqlite3OsOpenReadWrite, 0 },

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the sqlite_bind API.
#
# $Id: bind.test,v 1.12 2004/06/19 00:16:31 drh Exp $
# $Id: bind.test,v 1.13 2004/06/22 12:46:54 drh Exp $
#
set testdir [file dirname $argv0]
@ -94,16 +94,16 @@ do_test bind-2.1 {
# 32 bit Integers
do_test bind-2.2 {
sqlite3_bind_int32 $VM 1 123
sqlite3_bind_int32 $VM 2 456
sqlite3_bind_int32 $VM 3 789
sqlite3_bind_int $VM 1 123
sqlite3_bind_int $VM 2 456
sqlite3_bind_int $VM 3 789
sqlite_step $VM N VALUES COLNAMES
sqlite3_reset $VM
execsql {SELECT rowid, * FROM t1}
} {1 123 456 789}
do_test bind-2.3 {
sqlite3_bind_int32 $VM 2 -2000000000
sqlite3_bind_int32 $VM 3 2000000000
sqlite3_bind_int $VM 2 -2000000000
sqlite3_bind_int $VM 3 2000000000
sqlite_step $VM N VALUES COLNAMES
sqlite3_reset $VM
execsql {SELECT rowid, * FROM t1}