** 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"
#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
}
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,
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;
}
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,
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;
}
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,
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;
}
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,
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;
}
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,
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;
}
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,
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;
}
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,
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;
}
** 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[]
** 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[]
**
*/
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[]
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 },
{ "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 },