diff --git a/manifest b/manifest index c6f9d0cdad..257d90f70e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\stest\scode,\smake\sseveral\sattempts\sto\sconvert\sa\spointer\sto\sa\sstring\nand\stest\seach\sattempt\sto\smake\ssure\sit\sworks\sbefore\sreturnning,\sin\sorder\sto\nwork\saround\sincompatibilities\sbetween\svarious\ssystems.\s\sTicket\s#284.\s(CVS\s941) -D 2003-04-26T13:19:39 +C The\ssqlite_complete()\sfunction\sshould\signore\scarriage-return\scharacters.\r\n(Oops\s-\ssome\sunrelated\sedits\salso\smade\sit\sinto\sthis\scheck-in.)\s(CVS\s942) +D 2003-04-29T16:20:45 F Makefile.in 004acec253ecdde985c8ecd5b7c9accdb210378f F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -24,7 +24,7 @@ F src/auth.c 3be3c7434592117f049703966b940e0b07088ae2 F src/btree.c 077d75aee4ed63f3628698611ba43c87097d458d F src/btree.h 23c50e00709de16a5dce1fcea9c0429cc955ff0e F src/btree_rb.c 8e00e40be264716e1929987878672e55d9e0e76d -F src/build.c d5a26baeffa5bc49b4b7009a7723c6ab7e1b02d9 +F src/build.c 6312904cbf07862c0b80317540f467cde86cbb03 F src/copy.c 44b13fd4d2444fb53bff8a5ecee1c5f6f86a8263 F src/delete.c 0f7c26aaebc417ad66a2a1099e59cc4056512c31 F src/encode.c faf03741efe921755ec371cf4a6984536de00042 @@ -33,7 +33,7 @@ F src/func.c 882c3ed5a02be18cd904715c7ec62947a34a3605 F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8 F src/insert.c 19882be1edc4b1629b8f3097e2615164f2c9cecb -F src/main.c 6763d9a5556b7ac04aad3819699331df9172f029 +F src/main.c 5265058c9a598b4714dc9e528152b81fcb31e7ad F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565 F src/os.c 94b618c0c0a76210e53857d77c96d2f042dc33b1 F src/os.h 9e5bbddff123187295e3d00d49af06192cd1cd49 @@ -43,11 +43,11 @@ F src/parse.y 15ae47e7dd84304c1c6ae9205558405127977541 F src/pragma.c 118fe400d71b7fdcc03580d5eab6bb5aa00772a5 F src/printf.c fc5fdef6e92ad205005263661fe9716f55a49f3e F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe -F src/select.c dfc13cb62ba658c4463179713c40ee25a062b2ba +F src/select.c d1c876b9078894bc956cf1a5b38abd1a5abaf70b F src/shell.c 6557e37e6c34564b72d6b98da23a88eb6ed88d59 F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e F src/sqlite.h.in eec06462cba262c0ee03f38462a18a4bc66dda4e -F src/sqliteInt.h 0c7474068c37a5aad715810c8190266edcbd4f4c +F src/sqliteInt.h faf133e1441b7c7b93ad5d8a58201d4849033b75 F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63 F src/tclsqlite.c 9e25f98f1765afa0716144ef57abda75c88f688d F src/test1.c 4596acd9d9f2a49fda0160a8a6dee5bfc7c6c325 @@ -165,7 +165,7 @@ F www/speed.tcl cb4c10a722614aea76d2c51f32ee43400d5951be F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 -P 639957e9f793eddce027050d2655863d82fe8ac9 -R 55c305a0471c4f4afa1a6daa2bfcd3e3 +P 333011ffddc0be91f76811458f03ad1ec0331b51 +R 0f531c31d482e6152a0fa4a44f822132 U drh -Z f6cc1e6c8eb8613b9394102a1cbb5f97 +Z 98118f7ba2b9dbbb905b5ea8fd220094 diff --git a/manifest.uuid b/manifest.uuid index 1ab1dc9879..d7437eaf6c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -333011ffddc0be91f76811458f03ad1ec0331b51 \ No newline at end of file +c6bf62e41cf44e8ebf740b103204b00e8b826c90 \ No newline at end of file diff --git a/src/build.c b/src/build.c index 27cf944270..46a98c8832 100644 --- a/src/build.c +++ b/src/build.c @@ -23,7 +23,7 @@ ** ROLLBACK ** PRAGMA ** -** $Id: build.c,v 1.149 2003/04/22 20:30:38 drh Exp $ +** $Id: build.c,v 1.150 2003/04/29 16:20:45 drh Exp $ */ #include "sqliteInt.h" #include @@ -1976,10 +1976,23 @@ SrcList *sqliteSrcListAppend(SrcList *pList, Token *pTable, Token *pDatabase){ sqliteDequote(*pz); } } + pList->a[pList->nSrc].iCursor = -1; pList->nSrc++; return pList; } +/* +** Assign cursors to all tables in a SrcList +*/ +void sqliteSrcListAssignCursors(Parse *pParse, SrcList *pList){ + int i; + for(i=0; inSrc; i++){ + if( pList->a[i].iCursor<0 ){ + pList->a[i].iCursor = ++pParse->nTab; + } + } +} + /* ** Add an alias to the last identifier on the given identifier list. */ diff --git a/src/main.c b/src/main.c index 6d60f03376..f02c61de22 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.128 2003/04/26 02:31:54 drh Exp $ +** $Id: main.c,v 1.129 2003/04/29 16:20:46 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -574,6 +574,7 @@ int sqlite_complete(const char *zSql){ break; } case ' ': + case '\r': case '\t': case '\n': case '\f': { diff --git a/src/select.c b/src/select.c index 52a10d8da9..7dfdcc9f6e 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.134 2003/04/24 01:45:04 drh Exp $ +** $Id: select.c,v 1.135 2003/04/29 16:20:46 drh Exp $ */ #include "sqliteInt.h" @@ -859,7 +859,12 @@ Table *sqliteResultSetOfSelect(Parse *pParse, char *zTabName, Select *pSelect){ ** For the given SELECT statement, do three things. ** ** (1) Fill in the pTabList->a[].pTab fields in the SrcList that -** defines the set of tables that should be scanned. +** defines the set of tables that should be scanned. For views, +** fill pTabList->a[].pSelect with a copy of the SELECT statement +** that implements the view. A copy is made of the view's SELECT +** statement so that we can freely modify or delete that statement +** without worrying about messing up the presistent representation +** of the view. ** ** (2) Add terms to the WHERE clause to accomodate the NATURAL keyword ** on joins and the ON and USING clause of joins. @@ -917,11 +922,18 @@ static int fillInColumnList(Parse *pParse, Select *p){ return 1; } if( pTab->pSelect ){ + /* We reach here if the named table is a really a view */ if( sqliteViewGetColumnNames(pParse, pTab) ){ return 1; } - sqliteSelectDelete(pTabList->a[i].pSelect); - pTabList->a[i].pSelect = sqliteSelectDup(pTab->pSelect); + /* If pTabList->a[i].pSelect!=0 it means we are dealing with a + ** view within a view. The SELECT structure has already been + ** copied by the outer view so we can skip the copy step here + ** in the inner view. + */ + if( pTabList->a[i].pSelect==0 ){ + pTabList->a[i].pSelect = sqliteSelectDup(pTab->pSelect); + } } } } @@ -1632,7 +1644,7 @@ static int flattenSubquery( if( p->pOrderBy && pSub->pOrderBy ) return 0; /* If we reach this point, it means flattening is permitted for the - ** i-th entry of the FROM clause in the outer query. + ** iFrom-th entry of the FROM clause in the outer query. */ iParent = p->base + iFrom; iSub = pSub->base; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index c68ccd94c0..cec4bc1e93 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.181 2003/04/25 17:52:11 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.182 2003/04/29 16:20:46 drh Exp $ */ #include "config.h" #include "sqlite.h" @@ -669,6 +669,7 @@ struct SrcList { Table *pTab; /* An SQL table corresponding to zName */ Select *pSelect; /* A SELECT statement used in place of a table name */ int jointype; /* Type of join between this table and the next */ + int iCursor; /* The VDBE cursor number used to access this table */ Expr *pOn; /* The ON clause of a join */ IdList *pUsing; /* The USING clause of a join */ } a[1]; /* One entry for each identifier on the list */