-C Fix\sa\ssegfault\sin\sthe\strigger\scode.\s(CVS\s884)
-D 2003-03-27T13:01:29
+C Regression\stests\snow\swork\s-\sexcept\sfor\ssome\schanges\sin\serror\smessage\ntext.\s\sThe\slibrary\sis\snow\ssafe\sto\suse\sfor\sexperimental\swork.\s(CVS\s885)
+D 2003-03-27T13:50:00
F Makefile.in 6917c2149a586f11b47c428f2ba748eb1da04f69
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/auth.c f37bfc9451b8c1fa52f34adff474560018892729
F src/btree.c 327819bb858d534072f5004973f8bcdd50f133d6
F src/btree.h 8209bfadf5845d4fdaa60f471bb360f894cd4095
-F src/build.c abd5da38923bba6c5dc14d0e24b8e05f68ff459b
-F src/delete.c e1552bd5a26418c32b8516cb5602bf5473651c68
+F src/build.c 0c14b18192a825a18c5c03df5c2db0e6f85ed44b
+F src/delete.c 923497248e0ff9097a595c6333ec6d67fe6650b5
F src/encode.c faf03741efe921755ec371cf4a6984536de00042
F src/expr.c eae205a27ec45232f234f281f8827c3be58b303d
F src/func.c 882c3ed5a02be18cd904715c7ec62947a34a3605
F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
-F src/insert.c 8d23a2d9995d5bee5b7eb44cb9dc354e0874e70a
+F src/insert.c 95e7ab3fb51909351273a6c6f8aa831201130ce7
F src/main.c e0d9a86541f0644be5c875c6d8f5062c325c653d
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
F src/os.c dfed46091f69cd2d1e601f8a214d41344f2b00b6
F src/shell.c 0d260a007e0668fc7dda2b0c89bd597ef2966ec6
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in 6f648803f2ffb9beb35cb1cfa42b323d55519171
-F src/sqliteInt.h c4338bc3c75784840d51fd8a744a63e444ec496d
+F src/sqliteInt.h 5335f694cba9f07538cf8207aab11d48e0b9a2f8
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
F src/tclsqlite.c 8167d40fd34036701e07492d07a6f9e5c4015241
F src/test1.c 7ad4e6308dde0bf5a0f0775ce20cb2ec37a328f8
F src/test3.c c12ea7f1c3fbbd58904e81e6cb10ad424e6fc728
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
F src/tokenize.c 675b4718d17c69fe7609dc8e85e426ef002be811
-F src/trigger.c 5e2b4cd05dc1ece62911bae2c6d0c1da486910b8
-F src/update.c 785e0e1c8df2043dc96ad7c298fb11aaa3ebc8af
+F src/trigger.c 64ad4be538e524b0dff0c377debf62fe54cc8c17
+F src/update.c ab8c48ce00747ccf8f449f7f51ae56e08b5428ba
F src/util.c 73b668d1ed468df650dc00685a5e4ffa6887feb4
F src/vdbe.c 7171dbe873760f403b2501e96fd3d1bd852b3ce8
F src/vdbe.h ed43771f1dc2b994d5c484fdf2eab357c6ef0ee3
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 9ac71c329e17a0934d2a824eacc33e9a2ebce7c3
-R 73acb81d40c3749321870765682932e8
+P 7672914b196cd55744edda8e5d8f1b7b86f898f9
+R ef1de606572d96575e808b13bdc2a270
U drh
-Z a17b58550476cb426e51600a2c69c02b
+Z 5cf2b764f7e1375be431b06267e44f31
-7672914b196cd55744edda8e5d8f1b7b86f898f9
\ No newline at end of file
+8a593e9c2d57e758739a7ef54fa40ca6a0071a9a
\ No newline at end of file
** ROLLBACK
** PRAGMA
**
-** $Id: build.c,v 1.134 2003/03/27 12:51:24 drh Exp $
+** $Id: build.c,v 1.135 2003/03/27 13:50:00 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
Table *p = 0;
int i;
for(i=0; i<db->nDb; i++){
- if( zDatabase!=0 && sqliteStrICmp(zDatabase, db->aDb[i].zName) ) continue;
- p = sqliteHashFind(&db->aDb[i].tblHash, zName, strlen(zName)+1);
+ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
+ if( zDatabase!=0 && sqliteStrICmp(zDatabase, db->aDb[j].zName) ) continue;
+ p = sqliteHashFind(&db->aDb[j].tblHash, zName, strlen(zName)+1);
if( p ) break;
}
return p;
Index *p = 0;
int i;
for(i=0; i<db->nDb; i++){
- if( zDb && sqliteStrICmp(zDb, db->aDb[i].zName) ) continue;
- p = sqliteHashFind(&db->aDb[i].idxHash, zName, strlen(zName)+1);
+ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
+ if( zDb && sqliteStrICmp(zDb, db->aDb[j].zName) ) continue;
+ p = sqliteHashFind(&db->aDb[j].idxHash, zName, strlen(zName)+1);
if( p ) break;
}
return p;
if( pTable!=0 ){
assert( pName!=0 );
assert( pTable->nSrc==1 );
- pTab = sqliteTableNameToTable(pParse,
- pTable->a[0].zName, pTable->a[0].zDatabase);
+ pTab = sqliteSrcListLookup(pParse, pTable);
}else{
assert( pName==0 );
pTab = pParse->pNewTable;
if( sqlite_malloc_failed ) goto copy_cleanup;
assert( pTableName->nSrc==1 );
- pTab = sqliteTableNameToTable(pParse, pTableName->a[0].zName,
- pTableName->a[0].zDatabase);
- if( pTab==0 ) goto copy_cleanup;
+ pTab = sqliteSrcListLookup(pParse, pTableName);
+ if( pTab==0 || sqliteIsReadOnly(pParse, pTab) ) goto copy_cleanup;
zFile = sqliteStrNDup(pFilename->z, pFilename->n);
sqliteDequote(zFile);
if( sqliteAuthCheck(pParse, SQLITE_INSERT, pTab->zName, zFile)
** This file contains C code routines that are called by the parser
** to handle DELETE FROM statements.
**
-** $Id: delete.c,v 1.48 2003/03/27 12:51:24 drh Exp $
+** $Id: delete.c,v 1.49 2003/03/27 13:50:00 drh Exp $
*/
#include "sqliteInt.h"
-
/*
-** Given a table name, find the corresponding table and make sure the
-** table is writeable. Generate an error and return NULL if not. If
-** everything checks out, return a pointer to the Table structure.
+** Look up every table that is named in pSrc. If any table is not found,
+** add an error message to pParse->zErrMsg and return NULL. If all tables
+** are found, return a pointer to the last table.
*/
-Table *sqliteTableNameToTable(Parse *pParse, const char *zTab, const char *zDb){
- Table *pTab;
- pTab = sqliteFindTable(pParse->db, zTab, zDb);
- if( pTab==0 ){
- if( zDb==0 || zDb[0]==0 ){
- sqliteSetString(&pParse->zErrMsg, "no such table: ", zTab, 0);
- }else{
- sqliteSetString(&pParse->zErrMsg, "no such table: ", zDb, ".", zTab, 0);
+Table *sqliteSrcListLookup(Parse *pParse, SrcList *pSrc){
+ Table *pTab = 0;
+ int i;
+ for(i=0; i<pSrc->nSrc; i++){
+ const char *zTab = pSrc->a[i].zName;
+ const char *zDb = pSrc->a[i].zDatabase;
+ pTab = sqliteFindTable(pParse->db, zTab, zDb);
+ if( pTab==0 ){
+ if( zDb==0 || zDb[0]==0 ){
+ sqliteSetString(&pParse->zErrMsg, "no such table: ", zTab, 0);
+ }else{
+ sqliteSetString(&pParse->zErrMsg, "no such table: ", zDb, ".", zTab, 0);
+ }
+ pParse->nErr++;
+ break;
}
- pParse->nErr++;
- return 0;
+ pSrc->a[i].pTab = pTab;
}
+ return pTab;
+}
+
+/*
+** Check to make sure the given table is writable. If it is not
+** writable, generate an error message and return 1. If it is
+** writable return 0;
+*/
+int sqliteIsReadOnly(Parse *pParse, Table *pTab){
if( pTab->readOnly || pTab->pSelect ){
sqliteSetString(&pParse->zErrMsg,
- pTab->pSelect ? "view " : "table ",
- zTab,
+ pTab->pSelect ? "view " : "table ", pTab->zName,
" may not be modified", 0);
pParse->nErr++;
- return 0;
+ return 1;
}
- return pTab;
+ return 0;
}
/*
** will be calling are designed to work with multiple tables and expect
** an SrcList* parameter instead of just a Table* parameter.
*/
- pTab = pTabList->a[0].pTab = sqliteTableNameToTable(pParse, zTab, zDb);
- if( pTab==0 ){
+ pTab = sqliteSrcListLookup(pParse, pTabList);
+ if( pTab==0 || sqliteIsReadOnly(pParse, pTab) ){
goto delete_from_cleanup;
}
assert( pTab->pSelect==0 ); /* This table is not a view */
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.75 2003/03/27 12:51:25 drh Exp $
+** $Id: insert.c,v 1.76 2003/03/27 13:50:00 drh Exp $
*/
#include "sqliteInt.h"
){
Table *pTab; /* The table to insert into */
char *zTab; /* Name of the table into which we are inserting */
- char *zDb; /* Name of the database holding zTab */
int i, j, idx; /* Loop counters */
Vdbe *v; /* Generate code into this virtual machine */
Index *pIdx; /* For looping over indices of the table */
assert( pTabList->nSrc==1 );
zTab = pTabList->a[0].zName;
if( zTab==0 ) goto insert_cleanup;
- zDb = pTabList->a[0].zDatabase;
- pTab = sqliteTableNameToTable(pParse, zTab, zDb);
+ pTab = sqliteSrcListLookup(pParse, pTabList);
if( pTab==0 ){
goto insert_cleanup;
}
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.165 2003/03/27 12:51:25 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.166 2003/03/27 13:50:00 drh Exp $
*/
#include "config.h"
#include "sqlite.h"
#endif
};
+/*
+** The following are the indices of in sqlite.aDb[] of the main database
+** file and the file used to store TEMP tables.
+*/
+#define DB_TMP 0
+#define DB_MAIN 1
+
/*
** Possible values for the sqlite.flags.
*/
int,int,int);
void sqliteSelectDelete(Select*);
void sqliteSelectUnbind(Select*);
-Table *sqliteTableNameToTable(Parse*, const char*, const char*);
+Table *sqliteSrcListLookup(Parse*, SrcList*);
+int sqliteIsReadOnly(Parse*, Table*);
void sqliteDeleteFrom(Parse*, SrcList*, Expr*);
void sqliteUpdate(Parse*, SrcList*, ExprList*, Expr*, int);
WhereInfo *sqliteWhereBegin(Parse*, int, SrcList*, Expr*, int, ExprList**);
*/
if( sqlite_malloc_failed ) goto trigger_cleanup;
assert( pTableName->nSrc==1 );
- tab = sqliteTableNameToTable(pParse, pTableName->a[0].zName,
- pTableName->a[0].zDatabase);
+ tab = sqliteSrcListLookup(pParse, pTableName);
if( !tab ){
goto trigger_cleanup;
}
zName = pName->a[0].zName;
nName = strlen(zName);
for(i=0; i<db->nDb; i++){
- if( zDb && sqliteStrICmp(db->aDb[i].zName, zDb) ) continue;
- pTrigger = sqliteHashFind(&(db->aDb[i].trigHash), zName, nName+1);
+ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
+ if( zDb && sqliteStrICmp(db->aDb[j].zName, zDb) ) continue;
+ pTrigger = sqliteHashFind(&(db->aDb[j].trigHash), zName, nName+1);
if( pTrigger ) break;
}
if( !pTrigger ){
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
-** $Id: update.c,v 1.56 2003/03/27 12:51:25 drh Exp $
+** $Id: update.c,v 1.57 2003/03/27 13:50:00 drh Exp $
*/
#include "sqliteInt.h"
** will be calling are designed to work with multiple tables and expect
** an SrcList* parameter instead of just a Table* parameter.
*/
- pTab = pTabList->a[0].pTab = sqliteTableNameToTable(pParse, zTab, zDb);
- if( pTab==0 ) goto update_cleanup;
+ pTab = sqliteSrcListLookup(pParse, pTabList);
+ if( pTab==0 || sqliteIsReadOnly(pParse, pTab) ) goto update_cleanup;
assert( pTab->pSelect==0 ); /* This table is not a VIEW */
aXRef = sqliteMalloc( sizeof(int) * pTab->nCol );
if( aXRef==0 ) goto update_cleanup;