diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/printf.c | 75 | ||||
-rw-r--r-- | src/sqlite.h.in | 6 | ||||
-rw-r--r-- | src/sqliteInt.h | 6 | ||||
-rw-r--r-- | src/tclsqlite.c | 9 | ||||
-rw-r--r-- | src/test1.c | 31 |
5 files changed, 24 insertions, 103 deletions
diff --git a/src/printf.c b/src/printf.c index 2ed674a88..22421f64f 100644 --- a/src/printf.c +++ b/src/printf.c @@ -811,78 +811,3 @@ void sqlite3DebugPrintf(const char *zFormat, ...){ fflush(stdout); } #endif - -/* -** The following four routines implement the varargs versions of the -** sqlite3_exec() and sqlite3_get_table() interfaces. See the sqlite.h -** header files for a more detailed description of how these interfaces -** work. -** -** These routines are all just simple wrappers. -*/ -int sqlite3_exec_vprintf( - sqlite *db, /* An open database */ - const char *sqlFormat, /* printf-style format string for the SQL */ - sqlite_callback xCallback, /* Callback function */ - void *pArg, /* 1st argument to callback function */ - char **errmsg, /* Error msg written here */ - va_list ap /* Arguments to the format string. */ -){ - char *zSql; - int rc; - - zSql = sqlite3_vmprintf(sqlFormat, ap); - rc = sqlite3_exec(db, zSql, xCallback, pArg, errmsg); - free(zSql); - return rc; -} -int sqlite3_exec_printf( - sqlite *db, /* An open database */ - const char *sqlFormat, /* printf-style format string for the SQL */ - sqlite_callback xCallback, /* Callback function */ - void *pArg, /* 1st argument to callback function */ - char **errmsg, /* Error msg written here */ - ... /* Arguments to the format string. */ -){ - va_list ap; - int rc; - - va_start(ap, errmsg); - rc = sqlite3_exec_vprintf(db, sqlFormat, xCallback, pArg, errmsg, ap); - va_end(ap); - return rc; -} -int sqlite3_get_table_vprintf( - sqlite *db, /* An open database */ - const char *sqlFormat, /* printf-style format string for the SQL */ - char ***resultp, /* Result written to a char *[] that this points to */ - int *nrow, /* Number of result rows written here */ - int *ncolumn, /* Number of result columns written here */ - char **errmsg, /* Error msg written here */ - va_list ap /* Arguments to the format string */ -){ - char *zSql; - int rc; - - zSql = sqlite3_vmprintf(sqlFormat, ap); - rc = sqlite3_get_table(db, zSql, resultp, nrow, ncolumn, errmsg); - free(zSql); - return rc; -} -int sqlite3_get_table_printf( - sqlite *db, /* An open database */ - const char *sqlFormat, /* printf-style format string for the SQL */ - char ***resultp, /* Result written to a char *[] that this points to */ - int *nrow, /* Number of result rows written here */ - int *ncol, /* Number of result columns written here */ - char **errmsg, /* Error msg written here */ - ... /* Arguments to the format string */ -){ - va_list ap; - int rc; - - va_start(ap, errmsg); - rc = sqlite3_get_table_vprintf(db, sqlFormat, resultp, nrow, ncol, errmsg, ap); - va_end(ap); - return rc; -} diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 632b5b7b2..d3f314a25 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -12,7 +12,7 @@ ** This header file defines the interface that the SQLite library ** presents to client programs. ** -** @(#) $Id: sqlite.h.in,v 1.110 2004/07/22 02:40:38 drh Exp $ +** @(#) $Id: sqlite.h.in,v 1.111 2004/07/26 12:24:23 drh Exp $ */ #ifndef _SQLITE_H_ #define _SQLITE_H_ @@ -51,8 +51,10 @@ typedef struct sqlite sqlite3; */ #if defined(_MSC_VER) || defined(__BORLANDC__) typedef __int64 sqlite_int64; + typedef unsigned __int64 sqlite_uint64; #else typedef long long int sqlite_int64; + typedef unsigned long long int sqlite_uint64; #endif @@ -363,6 +365,7 @@ char *sqlite3_mprintf(const char*,...); char *sqlite3_vmprintf(const char*, va_list); void sqlite3_free(char *z); +#ifndef SQLITE_OMIT_AUTHORIZATION /* ** This routine registers a callback with the SQLite library. The ** callback is invoked (at compile-time, not at run-time) for each @@ -376,6 +379,7 @@ int sqlite3_set_authorizer( int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pUserData ); +#endif /* ** The second parameter to the access authorization function above will diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 39561702a..884283232 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.311 2004/07/24 17:38:29 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.312 2004/07/26 12:24:23 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -114,8 +114,10 @@ #ifndef INTPTR_TYPE # if SQLITE_PTR_SZ==4 # define INTPTR_TYPE int +# define UINTPTR_TYPE unsigned int # else # define INTPTR_TYPE sqlite_int64 +# define UINTPTR_TYPE sqlite_uint64 # endif #endif typedef sqlite_int64 i64; /* 8-byte signed integer */ @@ -126,7 +128,7 @@ typedef INT16_TYPE i16; /* 2-byte signed integer */ typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ typedef UINT8_TYPE i8; /* 1-byte signed integer */ typedef INTPTR_TYPE ptr; /* Big enough to hold a pointer */ -typedef unsigned INTPTR_TYPE uptr; /* Big enough to hold a pointer */ +typedef UINTPTR_TYPE uptr; /* Big enough to hold a pointer */ /* ** Macros to determine whether the machine is big or little endian, diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 6e92f404e..ab6821e6f 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.97 2004/07/23 00:01:39 drh Exp $ +** $Id: tclsqlite.c,v 1.98 2004/07/26 12:24:23 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -437,6 +437,10 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ ** callback string is returned. */ case DB_AUTHORIZER: { +#ifdef SQLITE_OMIT_AUTHORIZATION + Tcl_AppendResult(interp, "authorization not available in this build", 0); + return TCL_ERROR; +#else if( objc>3 ){ Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?"); return TCL_ERROR; @@ -457,15 +461,14 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ }else{ pDb->zAuth = 0; } -#ifndef SQLITE_OMIT_AUTHORIZATION if( pDb->zAuth ){ pDb->interp = interp; sqlite3_set_authorizer(pDb->db, auth_callback, pDb); }else{ sqlite3_set_authorizer(pDb->db, 0, 0); } -#endif } +#endif break; } diff --git a/src/test1.c b/src/test1.c index 61758fcd1..5fc284c1b 100644 --- a/src/test1.c +++ b/src/test1.c @@ -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.95 2004/07/22 15:02:26 drh Exp $ +** $Id: test1.c,v 1.96 2004/07/26 12:24:23 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -27,24 +27,6 @@ # define PTR_FMT "%p" #endif -int sqlite3_exec_printf( - sqlite *db, /* An open database */ - const char *sqlFormat, /* printf-style format string for the SQL */ - sqlite_callback xCallback, /* Callback function */ - void *pArg, /* 1st argument to callback function */ - char **errmsg, /* Error msg written here */ - ... /* Arguments to the format string. */ -); -int sqlite3_get_table_printf( - sqlite *db, /* An open database */ - const char *sqlFormat, /* printf-style format string for the SQL */ - char ***resultp, /* Result written to a char *[] that this points to */ - int *nrow, /* Number of result rows written here */ - int *ncol, /* Number of result columns written here */ - char **errmsg, /* Error msg written here */ - ... /* Arguments to the format string */ -); - static const char * errorName(int rc){ const char *zName = 0; switch( rc ){ @@ -190,6 +172,7 @@ static int test_exec_printf( Tcl_DString str; int rc; char *zErr = 0; + char *zSql; char zBuf[30]; if( argc!=4 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -198,7 +181,9 @@ static int test_exec_printf( } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; Tcl_DStringInit(&str); - rc = sqlite3_exec_printf(db, argv[2], exec_printf_cb, &str, &zErr, argv[3]); + zSql = sqlite3_mprintf(argv[2], argv[3]); + rc = sqlite3_exec(db, zSql, exec_printf_cb, &str, &zErr); + sqlite3_free(zSql); sprintf(zBuf, "%d", rc); Tcl_AppendElement(interp, zBuf); Tcl_AppendElement(interp, rc==SQLITE_OK ? Tcl_DStringValue(&str) : zErr); @@ -252,6 +237,7 @@ static int test_get_table_printf( char **aResult; int i; char zBuf[30]; + char *zSql; if( argc!=4 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " DB FORMAT STRING", 0); @@ -259,8 +245,9 @@ static int test_get_table_printf( } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; Tcl_DStringInit(&str); - rc = sqlite3_get_table_printf(db, argv[2], &aResult, &nRow, &nCol, - &zErr, argv[3]); + zSql = sqlite3_mprintf(argv[2],argv[3]); + rc = sqlite3_get_table(db, zSql, &aResult, &nRow, &nCol, &zErr); + sqlite3_free(zSql); sprintf(zBuf, "%d", rc); Tcl_AppendElement(interp, zBuf); if( rc==SQLITE_OK ){ |