Add the %z format to the sqlite_mprintf() and related functions. (CVS 1028)
FossilOrigin-Name: eca1398eaac67d772aff2676a470d9a6d96a93ca
This commit is contained in:
+26
-1
@@ -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.24 2003/04/26 13:19:39 drh Exp $
|
||||
** $Id: test1.c,v 1.25 2003/06/16 03:08:19 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "tcl.h"
|
||||
@@ -161,6 +161,30 @@ static int test_exec_printf(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Usage: sqlite_mprintf_z_test SEPARATOR ARG0 ARG1 ...
|
||||
**
|
||||
** Test the %z format of mprintf(). Use multiple mprintf() calls to
|
||||
** concatenate arg0 through argn using separator as the separator.
|
||||
** Return the result.
|
||||
*/
|
||||
static int test_mprintf_z(
|
||||
void *NotUsed,
|
||||
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||
int argc, /* Number of arguments */
|
||||
char **argv /* Text of each argument */
|
||||
){
|
||||
char *zResult = 0;
|
||||
int i;
|
||||
|
||||
for(i=2; i<argc; i++){
|
||||
zResult = sqlite_mprintf("%z%s%s", zResult, argv[1], argv[i]);
|
||||
}
|
||||
Tcl_AppendResult(interp, zResult, 0);
|
||||
sqlite_freemem(zResult);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Usage: sqlite_get_table_printf DB FORMAT STRING
|
||||
**
|
||||
@@ -779,6 +803,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
{ "sqlite_mprintf_int", (Tcl_CmdProc*)sqlite_mprintf_int },
|
||||
{ "sqlite_mprintf_str", (Tcl_CmdProc*)sqlite_mprintf_str },
|
||||
{ "sqlite_mprintf_double", (Tcl_CmdProc*)sqlite_mprintf_double },
|
||||
{ "sqlite_mprintf_z_test", (Tcl_CmdProc*)test_mprintf_z },
|
||||
{ "sqlite_open", (Tcl_CmdProc*)sqlite_test_open },
|
||||
{ "sqlite_last_insert_rowid", (Tcl_CmdProc*)test_last_rowid },
|
||||
{ "sqlite_exec_printf", (Tcl_CmdProc*)test_exec_printf },
|
||||
|
||||
Reference in New Issue
Block a user