Fix the load-extension mechanism so that tests build with or without it.

This check-in also includes prototypes for the new sqlite3_limit()
interface, but no implementation. (CVS 4892)

FossilOrigin-Name: bee38c2dda50592fef5fedab01311d5486240b95
This commit is contained in:
drh 2008-03-20 00:32:20 +00:00
parent 9323f76141
commit caa639f401
5 changed files with 87 additions and 23 deletions

View File

@ -1,5 +1,5 @@
C Fix\sbuild\swhether\scompiling\swith\sor\swithout\sauto-extension\senabled\s(CVS\s4891)
D 2008-03-19T23:52:35
C Fix\sthe\sload-extension\smechanism\sso\sthat\stests\sbuild\swith\sor\swithout\sit.\nThis\scheck-in\salso\sincludes\sprototypes\sfor\sthe\snew\ssqlite3_limit()\ninterface,\sbut\sno\simplementation.\s(CVS\s4892)
D 2008-03-20T00:32:20
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 90256feffbc822b56e4ad0ebaa62f5871c8f0334
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -104,7 +104,7 @@ F src/insert.c 358c80592c20a61a8d5b4a127215b5e25de652f4
F src/journal.c 807bed7a158979ac8d63953e1774e8d85bff65e2
F src/legacy.c cb1939fdeb91ea88fb44fbd2768a10e14bc44650
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
F src/loadext.c 841cf403aa17b9f81655575ea1319bfa256906ad
F src/loadext.c f26b22f7c84153c9d5dbd7c240848823c6e6b6dc
F src/main.c bb31f65f7b1870825a4c9a31f19354d566b7633c
F src/malloc.c 60e392a4c12c839517f9b0db7b995f825444fb35
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
@ -139,9 +139,9 @@ F src/random.c 8b6ab5418cf0f4dde551730825d67da1457c2b3c
F src/select.c d0a1e01a2a6c05bd60324e843c7e4581d3605950
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 22297fffa6f00a6c6d44020fa13b1184a1bb372d
F src/sqlite.h.in d8acd2881bdd1def5dfcc280ebc86a60f248ba0b
F src/sqlite.h.in c82088b99b3262c017ddadc14d45b2d5877cbeae
F src/sqlite3ext.h faacd0e6a81aabee0861c6d7883c9172e74ef5b3
F src/sqliteInt.h e7596d5491f65aafe00c0f63f41aedf2a8e007a3
F src/sqliteInt.h ed823fb087e57a09762bc1f4e0935761a8d57c7b
F src/sqliteLimit.h ee4430f88f69bf63527967bb35ca52af7b0ccb1e
F src/table.c 2c48c575dd59b3a6c5c306bc55f51a9402cf429a
F src/tclsqlite.c d42912617d4734b8f9195416badf5b27e512ded2
@ -624,7 +624,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 41d6ca31acbc0bd8555e5487ba3b695db5c9a81a
R 693688e3ad80e102aa500e44231d652a
U mlcreech
Z 7c18fbe1ac8b3b0218100603a8bf0e3e
P 7b9682c65f545b09d410173cf282f7c4f4438097
R 76d2140ea564d8c5d493dbf1333aa75b
U drh
Z b969d76f2e36df97ac59ac53a61f759c

View File

@ -1 +1 @@
7b9682c65f545b09d410173cf282f7c4f4438097
bee38c2dda50592fef5fedab01311d5486240b95

View File

@ -436,13 +436,15 @@ int sqlite3_enable_load_extension(sqlite3 *db, int onoff){
return SQLITE_OK;
}
#endif /* SQLITE_OMIT_LOADEXTENSION */
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
/*
** The following code is added regardless of whether or not extension
** loading is supported.
** The auto-extension code added regardless of whether or not extension
** loading is supported. We need a dummy sqlite3Apis pointer for that
** code if regular extension loading is not available. This is that
** dummy pointer.
*/
#ifdef SQLITE_OMIT_LOAD_EXTENSTION
#ifdef SQLITE_OMIT_LOAD_EXTENSION
const sqlite3_api_routines sqlite3Apis = { 0 };
#endif
@ -501,9 +503,6 @@ void sqlite3_reset_auto_extension(void){
sqlite3_mutex_leave(mutex);
}
#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** Load all automatic extensions.
*/
@ -539,5 +538,3 @@ int sqlite3AutoLoadExtensions(sqlite3 *db){
}
return rc;
}
#endif /* SQLITE_OMIT_LOADEXTENSION */

View File

@ -30,7 +30,7 @@
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
**
** @(#) $Id: sqlite.h.in,v 1.294 2008/03/19 21:45:51 drh Exp $
** @(#) $Id: sqlite.h.in,v 1.295 2008/03/20 00:32:20 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
@ -2155,6 +2155,68 @@ const void *sqlite3_errmsg16(sqlite3*);
*/
typedef struct sqlite3_stmt sqlite3_stmt;
/*
** CAPI3REF: Run-time Limits {F12760}
**
** This interface allows the size of various constructs to be limited
** on a connection by connection basis. The first parameter is the
** [database connection] whose limit is to be set or queried. The
** second parameter is one of the [limit categories] that define a
** class of constructs to be size limited. The third parameter is the
** new limit for that construct. The function returns the old limit.
**
** If the new limit is a negative number, the limit is unchanged.
** If the new limit is zero, the construct becomes unlimited. Actually,
** there is a hard upper bound on the size of all constructs that
** is determined at compile-time. For the limit category of
** SQLITE_LIMIT_XYZ the hard upper bound is the compile-time
** constant SQLITE_MAX_XYZ. Attempts to increase a limit above its
** hard upper bound are silently truncated.
**
** This interface is currently considered experimental and is subject
** to change or removal without prior notice.
**
** INVARIANTS:
**
** {F12763} A successful call to [sqlite3_limit(D,C,V)] where V is
** positive changes the
** limit on the size of construct C in [database connetion] D
** to the lessor of V and the hard upper bound on the size
** of C that is set at compile-time.
**
** {F12763} A successful call to [sqlite3_limit(D,C,V)] where V is zero
** changes the limit on the size of construct C in
** [database connetion] D to be the hard upper bound on the size
** of C that is set at compile-time.
**
** {F12766} A successful call to [sqlite3_limit(D,C,V)] where V is negative
** leaves the state of [database connection] D unchanged.
**
** {F12769} A successful call to [sqlite3_limit(D,C,V)] returns the
** value of the limit on the size of construct C in
** in [database connetion] D as it was prior to the call.
*/
int sqlite3_limit(sqlite3*, int id, int newVal);
/*
** CAPI3REF: Run-Time Limit Categories {F12790}
** KEYWORDS: {limit category} {limit categories}
**
** These constants define various aspects of a [database connection]
** that can be limited in size by calls to [sqlite3_limit()].
*/
#define SQLITE_LIMIT_LENGTH 0
#define SQLITE_LIMIT_SQL_LENGTH 1
#define SQLITE_LIMIT_COLUMN 2
#define SQLITE_LIMIT_EXPR_DEPTH 3
#define SQLITE_LIMIT_COMPOUND_SELECT 4
#define SQLITE_LIMIT_VDBE_OP 5
#define SQLITE_LIMIT_FUNCTION_ARG 6
#define SQLITE_LIMIT_ATTACHED 7
#define SQLITE_LIMIT_PAGE_COUNT 8
#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 9
#define SQLITE_LIMIT_VARIABLE_NUMBER 10
/*
** CAPI3REF: Compiling An SQL Statement {F13010}
**

View File

@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.674 2008/03/19 14:15:35 drh Exp $
** @(#) $Id: sqliteInt.h,v 1.675 2008/03/20 00:32:20 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@ -531,6 +531,11 @@ struct Schema {
#define DB_UnresetViews 0x0002 /* Some views have defined column names */
#define DB_Empty 0x0004 /* The file is empty (length 0 bytes) */
/*
** The number of different kinds of things that can be limited
** using the sqlite3_limit() interface.
*/
#define SQLITE_N_LIMIT (SQLITE_LIMIT_VARIABLE_NUMBER+1)
/*
** Each database is an instance of the following structure.
@ -578,6 +583,7 @@ struct sqlite3 {
int nChange; /* Value returned by sqlite3_changes() */
int nTotalChange; /* Value returned by sqlite3_total_changes() */
sqlite3_mutex *mutex; /* Connection mutex */
int aLimit[SQLITE_N_LIMIT]; /* Limits */
struct sqlite3InitInfo { /* Information used during initialization */
int iDb; /* When back is being initialized */
int newTnum; /* Rootpage of table being initialized */
@ -2064,12 +2070,11 @@ void *sqlite3ParserAlloc(void*(*)(size_t));
void sqlite3ParserFree(void*, void(*)(void*));
void sqlite3Parser(void*, int, Token, Parse*);
int sqlite3AutoLoadExtensions(sqlite3*);
#ifndef SQLITE_OMIT_LOAD_EXTENSION
void sqlite3CloseExtensions(sqlite3*);
int sqlite3AutoLoadExtensions(sqlite3*);
#else
# define sqlite3CloseExtensions(X)
# define sqlite3AutoLoadExtensions(X) SQLITE_OK
#endif
#ifndef SQLITE_OMIT_SHARED_CACHE