Fix problems for 64-bit machines and when SQLITE_OMIT_AUTHORIZATION is defined. (CVS 1868)
FossilOrigin-Name: e3cad1ab6226089265b4d15c6fc67cc33a31425f
This commit is contained in:
parent
be5c89acd0
commit
1211de3709
24
manifest
24
manifest
@ -1,5 +1,5 @@
|
||||
C Various\ssize\soptimizations.\s(CVS\s1867)
|
||||
D 2004-07-26T00:31:09
|
||||
C Fix\sproblems\sfor\s64-bit\smachines\sand\swhen\sSQLITE_OMIT_AUTHORIZATION\sis\sdefined.\s(CVS\s1868)
|
||||
D 2004-07-26T12:24:23
|
||||
F Makefile.in 4a5e570a9e2d35b09c31b3cf01b78cea764ade4b
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -55,15 +55,15 @@ F src/pager.c e0865a9afa64f59c6dc1cc1ab50bc700f67ee28b
|
||||
F src/pager.h 67739fe649f33be55dba522ca8a9cc4e42d14f71
|
||||
F src/parse.y 0bcc53bba498081a544e50c8845bf4857ebfccb9
|
||||
F src/pragma.c c8be18093f0492f9983406647808781ca0073d8b
|
||||
F src/printf.c 36090f6d7b4946539de97c1850675ce55ef66c16
|
||||
F src/printf.c 17b28a1eedfe8129b05de981719306c18c3f1327
|
||||
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
|
||||
F src/select.c aefda626660086addca4ce85c34aeef5d0f44c25
|
||||
F src/shell.c 93c96c847228c02fb84bb381875d87ee71fbbeb4
|
||||
F src/sqlite.h.in 80de11cde2c9f78eff4dab0aad1eb5196d6e2a3f
|
||||
F src/sqliteInt.h d2aebb8c8941bc9cab4506de313f304d358c93b8
|
||||
F src/sqlite.h.in d5d542e3cfd25c79f46239d1722d8333f1b16796
|
||||
F src/sqliteInt.h 691d584330cadab3801280caa49eb479fe2446a3
|
||||
F src/table.c 4521c278892f60e4d630788c0ea5cf4db1e75c49
|
||||
F src/tclsqlite.c 3ce001b3c301876a9c8163472077a4c10e0d49f3
|
||||
F src/test1.c ef00096c283ccfec1b2ae5fdaccb85fb06e24281
|
||||
F src/tclsqlite.c cece44ee1d4427185e4ac85ddec79f31ac26965a
|
||||
F src/test1.c 9389fafc3c3a2a3b6bf4f7cffe1c7e8ccdd0be38
|
||||
F src/test2.c f4c2f3928f1998fd8cb75a81e33a60e025ea85d4
|
||||
F src/test3.c 94d0a2a90bccd85802488cb42c69ec8afd2e4646
|
||||
F src/test4.c a921a69821fd30209589228e64f94e9f715b6fe2
|
||||
@ -85,7 +85,7 @@ F test/all.test 3b692eb43583b52c99c344b2fa8934512d179016
|
||||
F test/attach.test 3acdffccbf5f78b07746771b9490758718e28856
|
||||
F test/attach2.test b175333059e86c82dbf593fc922522ecb0f8aff8
|
||||
F test/attach3.test 6d060986ff004ebb89e1876a331d96c6bb62269e
|
||||
F test/auth.test 23d1dbf2235635409fee36535a344edc7494aea2
|
||||
F test/auth.test e74b015545f608c06d5b84d17acdf7146eb818af
|
||||
F test/bigfile.test 62722ac4b420dfbcdceb137b8634e2cf2865fe27
|
||||
F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
|
||||
F test/bind.test 94c3df3da774b48c6946c81b1d7f1b1646e0bd46
|
||||
@ -163,7 +163,7 @@ F test/sort.test 30fb9ea782a78da849a562d53233ec62d421bf61
|
||||
F test/subselect.test cca16490d78613174bf90a8416fc21a383ec7c71
|
||||
F test/table.test fd9a0f4992230e4ca89cd37ae3191a12750df1d0
|
||||
F test/tableapi.test b21ab097e87a5484bb61029e69e1a4e5c5e65ede
|
||||
F test/tclsqlite.test 0ef39b0228a32601432cec20208ec4b35e9b5cdb
|
||||
F test/tclsqlite.test 9bb1ee91e4ab661b3240423daaf4efff76874565
|
||||
F test/temptable.test 63a16e3ad19adf073cfbcdf7624c92ac5236522c
|
||||
F test/tester.tcl f36cc22d0532725073ca78272d7834d56dceb6d9
|
||||
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
|
||||
@ -240,7 +240,7 @@ F www/tclsqlite.tcl 06a86cba4d7fc88e2bcd633b57702d3d16abebb5
|
||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P ebdb661e0eefe123c422d3c1c371e325bb6cf673
|
||||
R b582908bbe936abff9e10f0211707e80
|
||||
P 1186e3ce0b660f1cf8d03a275b0331da64d21f1b
|
||||
R b7f10566eff3aa0dfd83fa0feca386c3
|
||||
U drh
|
||||
Z 252f8c5e2aa916f947cdd3f9490bfe4a
|
||||
Z 90e1afaea1f04ab99169d72a613f82ba
|
||||
|
@ -1 +1 @@
|
||||
1186e3ce0b660f1cf8d03a275b0331da64d21f1b
|
||||
e3cad1ab6226089265b4d15c6fc67cc33a31425f
|
75
src/printf.c
75
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
31
src/test1.c
31
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 ){
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this script is testing the ATTACH and DETACH commands
|
||||
# and related functionality.
|
||||
#
|
||||
# $Id: auth.test,v 1.16 2004/06/29 12:39:08 drh Exp $
|
||||
# $Id: auth.test,v 1.17 2004/07/26 12:24:24 drh Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -20,6 +20,10 @@ source $testdir/tester.tcl
|
||||
|
||||
# disable this test if the SQLITE_OMIT_AUTHORIZATION macro is
|
||||
# defined during compilation.
|
||||
if {[catch {db auth {}} msg]} {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
do_test auth-1.1.1 {
|
||||
db close
|
||||
|
@ -15,7 +15,7 @@
|
||||
# interface is pretty well tested. This file contains some addition
|
||||
# tests for fringe issues that the main test suite does not cover.
|
||||
#
|
||||
# $Id: tclsqlite.test,v 1.27 2004/07/19 17:25:25 drh Exp $
|
||||
# $Id: tclsqlite.test,v 1.28 2004/07/26 12:24:24 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -74,10 +74,12 @@ do_test tcl-1.7 {
|
||||
set v [catch {db} msg]
|
||||
lappend v $msg
|
||||
} {1 {wrong # args: should be "db SUBCOMMAND ..."}}
|
||||
do_test tcl-1.8 {
|
||||
set v [catch {db authorizer 1 2 3} msg]
|
||||
lappend v $msg
|
||||
} {1 {wrong # args: should be "db authorizer ?CALLBACK?"}}
|
||||
if {[catch {db auth {}}]==0} {
|
||||
do_test tcl-1.8 {
|
||||
set v [catch {db authorizer 1 2 3} msg]
|
||||
lappend v $msg
|
||||
} {1 {wrong # args: should be "db authorizer ?CALLBACK?"}}
|
||||
}
|
||||
do_test tcl-1.9 {
|
||||
set v [catch {db busy 1 2 3} msg]
|
||||
lappend v $msg
|
||||
|
Loading…
Reference in New Issue
Block a user