aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/func.c5
-rw-r--r--src/main.c9
-rw-r--r--src/parse.y4
-rw-r--r--src/pragma.c17
-rw-r--r--src/sqliteInt.h10
-rw-r--r--src/test_config.c8
-rw-r--r--src/vdbe.c6
-rw-r--r--src/vdbeInt.h57
-rw-r--r--src/vdbeapi.c177
9 files changed, 37 insertions, 256 deletions
diff --git a/src/func.c b/src/func.c
index 673b77e30..c48896d4e 100644
--- a/src/func.c
+++ b/src/func.c
@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.237 2009/06/03 01:24:54 drh Exp $
+** $Id: func.c,v 1.238 2009/06/19 14:06:03 drh Exp $
*/
#include "sqliteInt.h"
#include <stdlib.h>
@@ -1319,9 +1319,6 @@ void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
db->mallocFailed = 1;
}
}
-#ifdef SQLITE_SSE
- (void)sqlite3SseFunctions(db);
-#endif
}
/*
diff --git a/src/main.c b/src/main.c
index fa1c3b5e8..f1fd8f6d0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.557 2009/06/09 19:53:58 drh Exp $
+** $Id: main.c,v 1.558 2009/06/19 14:06:03 drh Exp $
*/
#include "sqliteInt.h"
@@ -583,13 +583,6 @@ int sqlite3_close(sqlite3 *db){
}
sqlite3_mutex_enter(db->mutex);
-#ifdef SQLITE_SSE
- {
- extern void sqlite3SseCleanup(sqlite3*);
- sqlite3SseCleanup(db);
- }
-#endif
-
sqlite3ResetInternalSchema(db, 0);
/* If a transaction is open, the ResetInternalSchema() call above
diff --git a/src/parse.y b/src/parse.y
index 254f0297a..613a7f782 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -14,7 +14,7 @@
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
-** @(#) $Id: parse.y,v 1.282 2009/06/12 13:53:52 drh Exp $
+** @(#) $Id: parse.y,v 1.283 2009/06/19 14:06:03 drh Exp $
*/
// All token codes are small integers with #defines that begin with "TK_"
@@ -1108,7 +1108,6 @@ cmd ::= VACUUM nm. {sqlite3Vacuum(pParse);}
///////////////////////////// The PRAGMA command /////////////////////////////
//
-%ifndef SQLITE_OMIT_PARSER
%ifndef SQLITE_OMIT_PRAGMA
cmd ::= PRAGMA nm(X) dbnm(Z). {sqlite3Pragma(pParse,&X,&Z,0,0);}
cmd ::= PRAGMA nm(X) dbnm(Z) EQ nmnum(Y). {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
@@ -1124,7 +1123,6 @@ nmnum(A) ::= ON(X). {A = X;}
nmnum(A) ::= DELETE(X). {A = X;}
nmnum(A) ::= DEFAULT(X). {A = X;}
%endif SQLITE_OMIT_PRAGMA
-%endif SQLITE_OMIT_PARSER
plus_num(A) ::= plus_opt number(X). {A = X;}
minus_num(A) ::= MINUS number(X). {A = X;}
number(A) ::= INTEGER|FLOAT(X). {A = X;}
diff --git a/src/pragma.c b/src/pragma.c
index 372649bc1..f77fc1c38 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -11,13 +11,13 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.212 2009/06/03 11:25:07 danielk1977 Exp $
+** $Id: pragma.c,v 1.213 2009/06/19 14:06:03 drh Exp $
*/
#include "sqliteInt.h"
/* Ignore this whole file if pragmas are disabled
*/
-#if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)
+#if !defined(SQLITE_OMIT_PRAGMA)
/*
** Interpret the given string as a safety level. Return 0 for OFF,
@@ -1348,17 +1348,6 @@ void sqlite3Pragma(
}else
#endif
-#ifdef SQLITE_SSE
- /*
- ** Check to see if the sqlite_statements table exists. Create it
- ** if it does not.
- */
- if( sqlite3StrICmp(zLeft, "create_sqlite_statement_table")==0 ){
- extern int sqlite3CreateStatementsTable(Parse*);
- sqlite3CreateStatementsTable(pParse);
- }else
-#endif
-
#if SQLITE_HAS_CODEC
if( sqlite3StrICmp(zLeft, "key")==0 && zRight ){
sqlite3_key(db, zRight, sqlite3Strlen30(zRight));
@@ -1423,4 +1412,4 @@ pragma_out:
sqlite3DbFree(db, zRight);
}
-#endif /* SQLITE_OMIT_PRAGMA || SQLITE_OMIT_PARSER */
+#endif /* SQLITE_OMIT_PRAGMA */
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 67fc1344f..b0d047b71 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.885 2009/06/18 17:22:39 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.886 2009/06/19 14:06:03 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -848,9 +848,6 @@ struct sqlite3 {
BusyHandler busyHandler; /* Busy callback */
int busyTimeout; /* Busy handler timeout, in msec */
Db aDbStatic[2]; /* Static space for the 2 default backends */
-#ifdef SQLITE_SSE
- sqlite3_stmt *pFetch; /* Used by SSE to fetch stored statements */
-#endif
Savepoint *pSavepoint; /* List of active savepoints */
int nSavepoint; /* Number of non-transaction savepoints */
int nStatement; /* Number of nested statement-transactions */
@@ -2890,11 +2887,6 @@ void sqlite3Put4byte(u8*, u32);
#define sqlite3ConnectionClosed(x)
#endif
-
-#ifdef SQLITE_SSE
-#include "sseInt.h"
-#endif
-
#ifdef SQLITE_DEBUG
void sqlite3ParserTrace(FILE*, char *);
#endif
diff --git a/src/test_config.c b/src/test_config.c
index a2aad3008..8bf021566 100644
--- a/src/test_config.c
+++ b/src/test_config.c
@@ -16,7 +16,7 @@
** The focus of this file is providing the TCL testing layer
** access to compile-time constants.
**
-** $Id: test_config.c,v 1.49 2009/06/09 13:42:25 drh Exp $
+** $Id: test_config.c,v 1.50 2009/06/19 14:06:03 drh Exp $
*/
#include "sqliteLimit.h"
@@ -359,12 +359,6 @@ Tcl_SetVar2(interp, "sqlite_options", "long_double",
Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY);
#endif
-#ifdef SQLITE_OMIT_PARSER
- Tcl_SetVar2(interp, "sqlite_options", "parser", "0", TCL_GLOBAL_ONLY);
-#else
- Tcl_SetVar2(interp, "sqlite_options", "parser", "1", TCL_GLOBAL_ONLY);
-#endif
-
#if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS)
Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
diff --git a/src/vdbe.c b/src/vdbe.c
index 41539f03c..7dccdc4fe 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.855 2009/06/18 00:41:56 drh Exp $
+** $Id: vdbe.c,v 1.856 2009/06/19 14:06:03 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@@ -4560,7 +4560,7 @@ case OP_ParseSchema: {
break;
}
-#if !defined(SQLITE_OMIT_ANALYZE) && !defined(SQLITE_OMIT_PARSER)
+#if !defined(SQLITE_OMIT_ANALYZE)
/* Opcode: LoadAnalysis P1 * * * *
**
** Read the sqlite_stat1 table for database P1 and load the content
@@ -4572,7 +4572,7 @@ case OP_LoadAnalysis: {
rc = sqlite3AnalysisLoad(db, pOp->p1);
break;
}
-#endif /* !defined(SQLITE_OMIT_ANALYZE) && !defined(SQLITE_OMIT_PARSER) */
+#endif /* !defined(SQLITE_OMIT_ANALYZE) */
/* Opcode: DropTable P1 * * P4 *
**
diff --git a/src/vdbeInt.h b/src/vdbeInt.h
index 65e249570..8eef7359e 100644
--- a/src/vdbeInt.h
+++ b/src/vdbeInt.h
@@ -15,7 +15,7 @@
** 6000 lines long) it was split up into several smaller files and
** this header information was factored out.
**
-** $Id: vdbeInt.h,v 1.171 2009/06/05 14:17:25 drh Exp $
+** $Id: vdbeInt.h,v 1.172 2009/06/19 14:06:03 drh Exp $
*/
#ifndef _VDBEINT_H_
#define _VDBEINT_H_
@@ -262,22 +262,25 @@ struct Context {
** method function.
*/
struct Vdbe {
- sqlite3 *db; /* The whole database */
- Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
- int nOp; /* Number of instructions in the program */
- int nOpAlloc; /* Number of slots allocated for aOp[] */
- Op *aOp; /* Space to hold the virtual machine's program */
- int nLabel; /* Number of labels used */
- int nLabelAlloc; /* Number of slots allocated in aLabel[] */
- int *aLabel; /* Space to hold the labels */
- Mem **apArg; /* Arguments to currently executing user function */
- Mem *aColName; /* Column names to return */
- int nCursor; /* Number of slots in apCsr[] */
- VdbeCursor **apCsr; /* One element of this array for each open cursor */
- int nVar; /* Number of entries in aVar[] */
- Mem *aVar; /* Values for the OP_Variable opcode. */
- char **azVar; /* Name of variables */
- int okVar; /* True if azVar[] has been initialized */
+ sqlite3 *db; /* The database connection that owns this statement */
+ Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
+ int nOp; /* Number of instructions in the program */
+ int nOpAlloc; /* Number of slots allocated for aOp[] */
+ Op *aOp; /* Space to hold the virtual machine's program */
+ int nLabel; /* Number of labels used */
+ int nLabelAlloc; /* Number of slots allocated in aLabel[] */
+ int *aLabel; /* Space to hold the labels */
+ Mem **apArg; /* Arguments to currently executing user function */
+ Mem *aColName; /* Column names to return */
+ Mem *pResultSet; /* Pointer to an array of results */
+ u16 nResColumn; /* Number of columns in one row of the result set */
+ u16 nCursor; /* Number of slots in apCsr[] */
+ VdbeCursor **apCsr; /* One element of this array for each open cursor */
+ u8 errorAction; /* Recovery action to do in case of an error */
+ u8 okVar; /* True if azVar[] has been initialized */
+ u16 nVar; /* Number of entries in aVar[] */
+ Mem *aVar; /* Values for the OP_Variable opcode. */
+ char **azVar; /* Name of variables */
u32 magic; /* Magic number for sanity checking */
int nMem; /* Number of memory locations currently allocated */
Mem *aMem; /* The memory locations */
@@ -287,11 +290,7 @@ struct Vdbe {
Context *contextStack; /* Stack used by opcodes ContextPush & ContextPop*/
int pc; /* The program counter */
int rc; /* Value to return */
- int errorAction; /* Recovery action to do in case of an error */
- int nResColumn; /* Number of columns in one row of the result set */
- char **azResColumn; /* Values for one row of result */
char *zErrMsg; /* Error message written here */
- Mem *pResultSet; /* Pointer to an array of results */
u8 explain; /* True if EXPLAIN present on SQL command */
u8 changeCntOn; /* True to update the change-counter */
u8 expired; /* True if the VM needs to be recompiled */
@@ -301,23 +300,15 @@ struct Vdbe {
u8 readOnly; /* True for read-only statements */
u8 isPrepareV2; /* True if prepared with prepare_v2() */
int nChange; /* Number of db changes made since last reset */
- i64 startTime; /* Time when query started - used for profiling */
int btreeMask; /* Bitmask of db->aDb[] entries referenced */
+ i64 startTime; /* Time when query started - used for profiling */
BtreeMutexArray aMutex; /* An array of Btree used here and needing locks */
int aCounter[2]; /* Counters used by sqlite3_stmt_status() */
- char *zSql; /* Text of the SQL statement that generated this */
+ char *zSql; /* Text of the SQL statement that generated this */
void *pFree; /* Free this when deleting the vdbe */
-#ifdef SQLITE_DEBUG
- FILE *trace; /* Write an execution trace here, if not NULL */
-#endif
int iStatement; /* Statement number (or 0 if has not opened stmt) */
-#ifdef SQLITE_SSE
- int fetchId; /* Statement number used by sqlite3_fetch_statement */
- int lru; /* Counter used for LRU cache replacement */
-#endif
-#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
- Vdbe *pLruPrev;
- Vdbe *pLruNext;
+#ifdef SQLITE_DEBUG
+ FILE *trace; /* Write an execution trace here, if not NULL */
#endif
};
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index d40578fb3..45eeda066 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -13,167 +13,11 @@
** This file contains code use to implement APIs that are part of the
** VDBE.
**
-** $Id: vdbeapi.c,v 1.165 2009/06/06 14:13:27 danielk1977 Exp $
+** $Id: vdbeapi.c,v 1.166 2009/06/19 14:06:03 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
-#if 0 && defined(SQLITE_ENABLE_MEMORY_MANAGEMENT)
-/*
-** The following structure contains pointers to the end points of a
-** doubly-linked list of all compiled SQL statements that may be holding
-** buffers eligible for release when the sqlite3_release_memory() interface is
-** invoked. Access to this list is protected by the SQLITE_MUTEX_STATIC_LRU2
-** mutex.
-**
-** Statements are added to the end of this list when sqlite3_reset() is
-** called. They are removed either when sqlite3_step() or sqlite3_finalize()
-** is called. When statements are added to this list, the associated
-** register array (p->aMem[1..p->nMem]) may contain dynamic buffers that
-** can be freed using sqlite3VdbeReleaseMemory().
-**
-** When statements are added or removed from this list, the mutex
-** associated with the Vdbe being added or removed (Vdbe.db->mutex) is
-** already held. The LRU2 mutex is then obtained, blocking if necessary,
-** the linked-list pointers manipulated and the LRU2 mutex relinquished.
-*/
-struct StatementLruList {
- Vdbe *pFirst;
- Vdbe *pLast;
-};
-static struct StatementLruList sqlite3LruStatements;
-
-/*
-** Check that the list looks to be internally consistent. This is used
-** as part of an assert() statement as follows:
-**
-** assert( stmtLruCheck() );
-*/
-#ifndef NDEBUG
-static int stmtLruCheck(){
- Vdbe *p;
- for(p=sqlite3LruStatements.pFirst; p; p=p->pLruNext){
- assert(p->pLruNext || p==sqlite3LruStatements.pLast);
- assert(!p->pLruNext || p->pLruNext->pLruPrev==p);
- assert(p->pLruPrev || p==sqlite3LruStatements.pFirst);
- assert(!p->pLruPrev || p->pLruPrev->pLruNext==p);
- }
- return 1;
-}
-#endif
-
-/*
-** Add vdbe p to the end of the statement lru list. It is assumed that
-** p is not already part of the list when this is called. The lru list
-** is protected by the SQLITE_MUTEX_STATIC_LRU mutex.
-*/
-static void stmtLruAdd(Vdbe *p){
- sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
-
- if( p->pLruPrev || p->pLruNext || sqlite3LruStatements.pFirst==p ){
- sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
- return;
- }
-
- assert( stmtLruCheck() );
-
- if( !sqlite3LruStatements.pFirst ){
- assert( !sqlite3LruStatements.pLast );
- sqlite3LruStatements.pFirst = p;
- sqlite3LruStatements.pLast = p;
- }else{
- assert( !sqlite3LruStatements.pLast->pLruNext );
- p->pLruPrev = sqlite3LruStatements.pLast;
- sqlite3LruStatements.pLast->pLruNext = p;
- sqlite3LruStatements.pLast = p;
- }
-
- assert( stmtLruCheck() );
-
- sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
-}
-
-/*
-** Assuming the SQLITE_MUTEX_STATIC_LRU2 mutext is already held, remove
-** statement p from the least-recently-used statement list. If the
-** statement is not currently part of the list, this call is a no-op.
-*/
-static void stmtLruRemoveNomutex(Vdbe *p){
- if( p->pLruPrev || p->pLruNext || p==sqlite3LruStatements.pFirst ){
- assert( stmtLruCheck() );
- if( p->pLruNext ){
- p->pLruNext->pLruPrev = p->pLruPrev;
- }else{
- sqlite3LruStatements.pLast = p->pLruPrev;
- }
- if( p->pLruPrev ){
- p->pLruPrev->pLruNext = p->pLruNext;
- }else{
- sqlite3LruStatements.pFirst = p->pLruNext;
- }
- p->pLruNext = 0;
- p->pLruPrev = 0;
- assert( stmtLruCheck() );
- }
-}
-
-/*
-** Assuming the SQLITE_MUTEX_STATIC_LRU2 mutext is not held, remove
-** statement p from the least-recently-used statement list. If the
-** statement is not currently part of the list, this call is a no-op.
-*/
-static void stmtLruRemove(Vdbe *p){
- sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
- stmtLruRemoveNomutex(p);
- sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
-}
-
-/*
-** Try to release n bytes of memory by freeing buffers associated
-** with the memory registers of currently unused vdbes.
-*/
-int sqlite3VdbeReleaseMemory(int n){
- Vdbe *p;
- Vdbe *pNext;
- int nFree = 0;
-
- sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
- for(p=sqlite3LruStatements.pFirst; p && nFree<n; p=pNext){
- pNext = p->pLruNext;
-
- /* For each statement handle in the lru list, attempt to obtain the
- ** associated database mutex. If it cannot be obtained, continue
- ** to the next statement handle. It is not possible to block on
- ** the database mutex - that could cause deadlock.
- */
- if( SQLITE_OK==sqlite3_mutex_try(p->db->mutex) ){
- nFree += sqlite3VdbeReleaseBuffers(p);
- stmtLruRemoveNomutex(p);
- sqlite3_mutex_leave(p->db->mutex);
- }
- }
- sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
-
- return nFree;
-}
-
-/*
-** Call sqlite3Reprepare() on the statement. Remove it from the
-** lru list before doing so, as Reprepare() will free all the
-** memory register buffers anyway.
-*/
-int vdbeReprepare(Vdbe *p){
- stmtLruRemove(p);
- return sqlite3Reprepare(p);
-}
-
-#else /* !SQLITE_ENABLE_MEMORY_MANAGEMENT */
- #define stmtLruRemove(x)
- #define stmtLruAdd(x)
- #define vdbeReprepare(x) sqlite3Reprepare(x)
-#endif
-
-
#ifndef SQLITE_OMIT_DEPRECATED
/*
** Return TRUE (non-zero) of the statement supplied as an argument needs
@@ -209,7 +53,6 @@ int sqlite3_finalize(sqlite3_stmt *pStmt){
sqlite3_mutex *mutex = v->db->mutex;
#endif
sqlite3_mutex_enter(mutex);
- stmtLruRemove(v);
rc = sqlite3VdbeFinalize(v);
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(mutex);
@@ -233,7 +76,6 @@ int sqlite3_reset(sqlite3_stmt *pStmt){
Vdbe *v = (Vdbe*)pStmt;
sqlite3_mutex_enter(v->db->mutex);
rc = sqlite3VdbeReset(v);
- stmtLruAdd(v);
sqlite3VdbeMakeReady(v, -1, 0, 0, 0);
assert( (rc & (v->db->errMask))==rc );
rc = sqlite3ApiExit(v->db, rc);
@@ -477,7 +319,6 @@ static int sqlite3Step(Vdbe *p){
db->activeVdbeCnt++;
if( p->readOnly==0 ) db->writeVdbeCnt++;
p->pc = 0;
- stmtLruRemove(p);
}
#ifndef SQLITE_OMIT_EXPLAIN
if( p->explain ){
@@ -537,19 +378,6 @@ end_of_step:
** sqlite3Step() to do most of the work. If a schema error occurs,
** call sqlite3Reprepare() and try again.
*/
-#ifdef SQLITE_OMIT_PARSER
-int sqlite3_step(sqlite3_stmt *pStmt){
- int rc = SQLITE_MISUSE;
- if( pStmt ){
- Vdbe *v;
- v = (Vdbe*)pStmt;
- sqlite3_mutex_enter(v->db->mutex);
- rc = sqlite3Step(v);
- sqlite3_mutex_leave(v->db->mutex);
- }
- return rc;
-}
-#else
int sqlite3_step(sqlite3_stmt *pStmt){
int rc = SQLITE_MISUSE;
if( pStmt ){
@@ -559,7 +387,7 @@ int sqlite3_step(sqlite3_stmt *pStmt){
sqlite3_mutex_enter(db->mutex);
while( (rc = sqlite3Step(v))==SQLITE_SCHEMA
&& cnt++ < 5
- && (rc = vdbeReprepare(v))==SQLITE_OK ){
+ && (rc = sqlite3Reprepare(v))==SQLITE_OK ){
sqlite3_reset(pStmt);
v->expired = 0;
}
@@ -586,7 +414,6 @@ int sqlite3_step(sqlite3_stmt *pStmt){
}
return rc;
}
-#endif
/*
** Extract the user data from a sqlite3_context structure and return a