diff --git a/manifest b/manifest index f88d1a06e6..4746b2bffb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Test\scoverage\simprovements\son\sprintf.\s(CVS\s5385) -D 2008-07-09T16:51:51 +C Remove\sunused\scode.\s\sTest\scoverage\senhancements.\s\sModify\sthe\salgorithm\sused\nto\sselect\scolumn\snames\sfor\sVIEWs\sof\sjoins\sso\sthat\sthe\sconstructed\scolumn\nnames\somits\sthe\sunderlying\stable\snames.\s(CVS\s5386) +D 2008-07-10T00:32:42 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -95,9 +95,9 @@ F src/attach.c b18ba42c77f7d3941f5d23d2ca20fa1d841a4e91 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2 -F src/btree.c fbc557de64457effea261699c11fc0cf7696ccd6 -F src/btree.h b1bd7e0b8c2e33658aaf447cb0d1d94f74664b6b -F src/btreeInt.h 8f6e0817365ac822da0afffedc664ba03047718b +F src/btree.c 61c4752f4e05a5905d95170b0b5ddb24fb143b02 +F src/btree.h 9373128fbd6509a281e0d356cb15f9cffbfa876c +F src/btreeInt.h d59e58d39950a17c0fb7e004c90ab7696d3e7df5 F src/build.c bac7233d984be3805aaa41cf500f7ee12dc97249 F src/callback.c aa492a0ad8c2d454edff9fb8a57fae13743cf71d F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c @@ -131,27 +131,27 @@ F src/os.c 292b3b4a49fe5bf6cf2f1cf0af186ebd334e80b8 F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892 F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 F src/os_os2.c 6c33e61f0fab256b0136650cdee35c3eaab2fa04 -F src/os_unix.c 3d19f0491e0b32e5b757c7e6f310f2f6d3aea3f4 +F src/os_unix.c 1df6108efdb7957a9f28b9700600e58647c9c12d F src/os_win.c 2bf2f8cd700299564cc236262c2668e1e02c626a -F src/pager.c 2cd554d474cfa0228ece30645fe7bb7d1f6824c7 +F src/pager.c 08169a94414b03d80fc2c026a1d0fdf5367bdcbe F src/pager.h 6aa3050a3c684475a5a9dbad5ff1cebad612acba F src/parse.y 097bff733e89fbf554a07d9327046718ce364011 F src/pragma.c 6fad83fbcc7ec6e76d91fe2805fe972ff3af6a0c F src/prepare.c c9bb0aacb7a571d049805699ed18f2bb136ea091 -F src/printf.c 2a759d2759f43f07a84771c43e8045d7f742bb04 +F src/printf.c 8e5d410220cf8650f502caf71f0de979a3f9031e F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a -F src/select.c e6edf11f024a5207e34683a25f33a700a2f1b43b +F src/select.c 0c887fe1a88ee40a11e71127f4e91a0d864508cd F src/shell.c 484e7297e066f22830f9c15d7abbcdd2acb097b0 F src/sqlite.h.in 8a00ed8707a16ee724e9e500b07e9af3a6fcc9be F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e -F src/sqliteInt.h ebf2eab46462b926fdb60277741b4b8659091bee +F src/sqliteInt.h ca0dc923bcc51bef0064f34628bd6daeb0d68d38 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/status.c b8d7b1f6b518e71986dfa65058de7a714efd61be F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8 F src/tclsqlite.c 4dd9ee4cb44846ad9bcc4d0da8088c1e7d4b33d9 F src/test1.c 30bdb22f911efd492c4f49565eae014330231ece F src/test2.c c46d146019ab6e37474e66b3c789e5237d9ea7b7 -F src/test3.c 01ff03164cf6a2bededa3b44ecd481603e2644fc +F src/test3.c 3e9efdcac31466ccd1723fb074d65a4876d2f70f F src/test4.c ff4ecde3cafc71337b04e8cb7da5bb88e85d70e7 F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4 F src/test6.c 0a0304a69cfa4962a429d084c6d451ff9e4fb572 @@ -160,7 +160,7 @@ F src/test8.c 3b85c05b15ccfc6844093791e83d5c8a1e0354ca F src/test9.c 4615ef08750245a2d96aaa7cbe2fb4aff2b57acc F src/test_async.c da9f58f49faccd3a26ba89f58de125862351b6e2 F src/test_autoext.c f53b0cdf7bf5f08100009572a5d65cdb540bd0ad -F src/test_btree.c c1308ba0b88ab577fa56c9e493a09829dfcded9c +F src/test_btree.c fd982a4242449a462f5a87f120d6e8fcc5e24a83 F src/test_config.c 7d3c3bb37e12d8ed22c5e0900e1361178b0580a3 F src/test_devsym.c 6012cb8e3acf812513511025a4fa5d626e0ba19b F src/test_func.c ade4f0117cc96c5a05682e1ef38b84320a866ad9 @@ -179,14 +179,14 @@ F src/tokenize.c b5fdc79fb7e00077b9c02af7a0da3b89c9f3398e F src/trigger.c bdb56bb9db1a7b18f8505484051221ab5123f21d F src/update.c 4e698fcc0c91c241a960304c4236dc3a49603155 F src/utf.c 8d52f620a7153d90b058502124fe51d821fcdf57 -F src/util.c fbfb7fe4344e93245d8fc2ef975c6d2340f81388 +F src/util.c 06dbffe992bfc69dd8e4462a6baf9528b706fa17 F src/vacuum.c ef342828002debc97514617af3424aea8ef8522c -F src/vdbe.c 4b3c7d0c7f68ec241bebe075c26a46a1618a32cb +F src/vdbe.c 14d98d1d47041a99a9c98034842772dbbcc062fb F src/vdbe.h c46155c221418bea29ee3a749d5950fcf85a70e2 F src/vdbeInt.h 30535c1d30ba1b5fb58d8f0e1d1261af976558aa F src/vdbeapi.c a7c6b8db324cf7eccff32de871dea36aa305c994 F src/vdbeaux.c 734d27d1e18bb4fb3c7f94d499039a8d3bbf8407 -F src/vdbeblob.c 9345f6dcd675fdcfdb537d2d2f487542d9ea136a +F src/vdbeblob.c a20fe9345062b1a1b4cc187dc5fad45c9414033b F src/vdbefifo.c c46dae1194e4277bf007144d7e5b0c0b1c24f136 F src/vdbemem.c 0c72b58ffd759676ce4829f42bacb83842a58c21 F src/vtab.c 2096c03ec5540a43c8c73a8f43407dfd3549a982 @@ -237,7 +237,7 @@ F test/collate5.test e54df13eb9e1140273680b3153c6e19b39e59888 F test/collate6.test 8be65a182abaac8011a622131486dafb8076e907 F test/collate7.test e23677b1fd271505302643a98178952bb65b6f21 F test/collate8.test 7ed2461305ac959886a064dc1e3cf15e155a183f -F test/collate9.test 0867eabc1222ab0bc308fc09a7fb30770334c3cd +F test/collate9.test 3adcc799229545940df2f25308dd1ad65869145a F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 F test/colmeta.test 087c42997754b8c648819832241daf724f813322 F test/conflict.test bb29b052c60a1f7eb6382be77902061d1f305318 @@ -441,7 +441,7 @@ F test/rtree.test a8404a59bbc3a7827db9bfb334790c852f0391b3 F test/safety.test b69e2b2dd5d52a3f78e216967086884bbc1a09c6 F test/schema.test a8b000723375fd42c68d310091bdbd744fde647c F test/schema2.test 35e1c9696443d6694c8980c411497c2b5190d32e -F test/select1.test 6cea013e127fd8091ce1f80984a5bbe687088587 +F test/select1.test 0c7ed6dbe1c54b45dc850d8a7df8a8462bb3e34e F test/select2.test 06a2660de57673e2d076c29c0fd73f961a930f87 F test/select3.test 2ce595f8fb8e2ac10071d3b4e424cadd4634a054 F test/select4.test 0618c9377013840194b7901e6224d841cd3e7193 @@ -470,8 +470,8 @@ F test/speed3.test e312d7e442a5047d730569fdae2ba99bc94e1a13 F test/speed4.test 20d8ea20bea3ca09c3ef3b5ec820a17e58e132cb F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b -F test/sqllimits1.test b0444644e8dfe3fdd6d4f00729e2f4d5ed69757a -F test/subquery.test 8203f85db56ba022a57a0589890090c8feed4e59 +F test/sqllimits1.test bfa4ffaeb287f04f0f082abcb5d7581daaaa9bf3 +F test/subquery.test d78fe135ff01a3f91f0b62915740f90b35f7e951 F test/subselect.test 974e87f8fc91c5f00dd565316d396a5a6c3106c4 F test/substr.test 4be572ac017143e59b4058dc75c91a0d0dc6d4e0 F test/sync.test ded6b39d8d8ca3c0c5518516c6371b3316d3e3a3 @@ -553,7 +553,7 @@ F test/vacuum2.test d3b9691541fe6ed5c711f547a1c7d70e9760ac6f F test/vacuum3.test 6149b24613f487915ca9cedfbb9147d5759714ec F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/veryquick.test fdd8108de66eec378291d9a0e46e30d129eef1ca -F test/view.test 041ccaf4c96f6c90d564c9ea37d1c1fa21fdb470 +F test/view.test 5799906511d6c77cfe3516d3d1189224350ef732 F test/vtab1.test 4421276b9010022d623879531a05a58fefaad771 F test/vtab2.test 1da49b015582965a8fc386aa23d051a5a622b08e F test/vtab3.test f38d6d7d19f08bffdadce4d5b8cba078f8118587 @@ -600,7 +600,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 417aa1580abec8cc335dcb6ac36245c081a31ef8 -R 4491ab2e53ba152326327f2a45cdeff6 +P 2d8f7bebf0f13f3a95f1e2163e35d43229cabfea +R 3109bd577402694337300dc1871ab087 U drh -Z 410f438828d348b456a7ce8e20b13c60 +Z 3f0e22a5269e1c2844744b0925a32b3d diff --git a/manifest.uuid b/manifest.uuid index 3b1234278d..1ad3318a51 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2d8f7bebf0f13f3a95f1e2163e35d43229cabfea \ No newline at end of file +636cd723296a8b1709011fdd99b236ffddf3f1b0 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index a1564ec3db..a23cb7f250 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.474 2008/07/09 11:49:47 danielk1977 Exp $ +** $Id: btree.c,v 1.475 2008/07/10 00:32:42 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. @@ -493,16 +493,9 @@ static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){ */ #define findCell(pPage, iCell) \ ((pPage)->aData + get2byte(&(pPage)->aData[(pPage)->cellOffset+2*(iCell)])) -#ifdef SQLITE_TEST -u8 *sqlite3BtreeFindCell(MemPage *pPage, int iCell){ - assert( iCell>=0 ); - assert( iCellaData[pPage->hdrOffset+3]) ); - return findCell(pPage, iCell); -} -#endif /* -** This a more complex version of sqlite3BtreeFindCell() that works for +** This a more complex version of findCell() that works for ** pages that do contain overflow cells. See insert */ static u8 *findOverflowCell(MemPage *pPage, int iCell){ @@ -5799,8 +5792,6 @@ int sqlite3BtreeInsert( rc = insertCell(pPage, pCur->idx, newCell, szNew, 0, 0); if( rc!=SQLITE_OK ) goto end_insert; rc = balance(pPage, 1); - /* sqlite3BtreePageDump(pCur->pBt, pCur->pgnoRoot, 1); */ - /* fflush(stdout); */ if( rc==SQLITE_OK ){ moveToRoot(pCur); } diff --git a/src/btree.h b/src/btree.h index 591022fe29..43e7853d4c 100644 --- a/src/btree.h +++ b/src/btree.h @@ -13,7 +13,7 @@ ** subsystem. See comments in the source code for a detailed description ** of what each interface routine does. ** -** @(#) $Id: btree.h,v 1.99 2008/05/29 03:01:24 shane Exp $ +** @(#) $Id: btree.h,v 1.100 2008/07/10 00:32:42 drh Exp $ */ #ifndef _BTREE_H_ #define _BTREE_H_ @@ -174,7 +174,6 @@ void sqlite3BtreeCacheOverflow(BtCursor *); #ifdef SQLITE_TEST int sqlite3BtreeCursorInfo(BtCursor*, int*, int); void sqlite3BtreeCursorList(Btree*); -int sqlite3BtreePageDump(Btree*, int, int recursive); #endif /* diff --git a/src/btreeInt.h b/src/btreeInt.h index 1bb5c6bf5b..0ec07aa9de 100644 --- a/src/btreeInt.h +++ b/src/btreeInt.h @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btreeInt.h,v 1.23 2008/07/08 19:34:07 drh Exp $ +** $Id: btreeInt.h,v 1.24 2008/07/10 00:32:42 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -631,9 +631,6 @@ int sqlite3BtreeGetPage(BtShared*, Pgno, MemPage**, int); int sqlite3BtreeInitPage(MemPage *pPage, MemPage *pParent); void sqlite3BtreeParseCellPtr(MemPage*, u8*, CellInfo*); void sqlite3BtreeParseCell(MemPage*, int, CellInfo*); -#ifdef SQLITE_TEST -u8 *sqlite3BtreeFindCell(MemPage *pPage, int iCell); -#endif int sqlite3BtreeRestoreOrClearCursorPosition(BtCursor *pCur); void sqlite3BtreeGetTempCursor(BtCursor *pCur, BtCursor *pTempCur); void sqlite3BtreeReleaseTempCursor(BtCursor *pCur); diff --git a/src/os_unix.c b/src/os_unix.c index 45550951f9..ca65836f46 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -12,7 +12,7 @@ ** ** This file contains code that is specific to Unix systems. ** -** $Id: os_unix.c,v 1.192 2008/06/30 10:16:05 danielk1977 Exp $ +** $Id: os_unix.c,v 1.193 2008/07/10 00:32:42 drh Exp $ */ #include "sqliteInt.h" #if SQLITE_OS_UNIX /* This file is used on unix only */ @@ -543,6 +543,7 @@ static void releaseOpenCnt(struct openCnt *pOpen){ } } +#ifdef SQLITE_ENABLE_LOCKING_STYLE /* ** Tests a byte-range locking query to see if byte range locks are ** supported, if not we fall back to dotlockLockingStyle. @@ -566,6 +567,7 @@ static int testLockingStyle(int fd){ */ return LOCKING_STYLE_DOTFILE; } +#endif /* ** If SQLITE_ENABLE_LOCKING_STYLE is defined, this function Examines the diff --git a/src/pager.c b/src/pager.c index 85be7baa57..2e0cd4bce9 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.463 2008/07/07 19:52:10 drh Exp $ +** @(#) $Id: pager.c,v 1.464 2008/07/10 00:32:42 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -1848,7 +1848,7 @@ static int pager_playback(Pager *pPager, int isHot){ sqlite3_vfs *pVfs = pPager->pVfs; i64 szJ; /* Size of the journal file in bytes */ u32 nRec; /* Number of Records in the journal */ - int i; /* Loop counter */ + u32 i; /* Loop counter */ Pgno mxPg = 0; /* Size of the original file in pages */ int rc; /* Result code of a subroutine */ int res = 1; /* Value returned by sqlite3OsAccess() */ @@ -5348,18 +5348,4 @@ i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){ return pPager->journalSizeLimit; } -#ifdef SQLITE_TEST -/* -** Print a listing of all referenced pages and their ref count. -*/ -void sqlite3PagerRefdump(Pager *pPager){ - PgHdr *pPg; - for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){ - if( pPg->nRef<=0 ) continue; - sqlite3DebugPrintf("PAGE %3d addr=%p nRef=%d\n", - pPg->pgno, PGHDR_TO_DATA(pPg), pPg->nRef); - } -} -#endif - #endif /* SQLITE_OMIT_DISKIO */ diff --git a/src/printf.c b/src/printf.c index 4d1f4a18f7..a3ff8b56e7 100644 --- a/src/printf.c +++ b/src/printf.c @@ -5,7 +5,7 @@ ** an historical reference. Most of the "enhancements" have been backed ** out so that the functionality is now the same as standard printf(). ** -** $Id: printf.c,v 1.89 2008/07/09 16:51:51 drh Exp $ +** $Id: printf.c,v 1.90 2008/07/10 00:32:42 drh Exp $ ** ************************************************************************** ** @@ -482,10 +482,8 @@ void sqlite3VXPrintf( while( realvalue>=1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; } while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; } while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; } - if( realvalue>0.0 ){ - while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; } - while( realvalue<1.0 ){ realvalue *= 10.0; exp--; } - } + while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; } + while( realvalue<1.0 ){ realvalue *= 10.0; exp--; } if( exp>350 ){ if( prefix=='-' ){ bufpt = "-Inf"; @@ -680,7 +678,7 @@ void sqlite3VXPrintf( int k = va_arg(ap, int); struct SrcList_item *pItem = &pSrc->a[k]; assert( k>=0 && knSrc ); - if( pItem->zDatabase && pItem->zDatabase[0] ){ + if( pItem->zDatabase ){ sqlite3StrAccumAppend(pAccum, pItem->zDatabase, -1); sqlite3StrAccumAppend(pAccum, ".", 1); } @@ -739,15 +737,12 @@ void sqlite3StrAccumAppend(StrAccum *p, const char *z, int N){ return; } }else{ - i64 szNew = p->nAlloc; + i64 szNew = p->nChar; szNew += N + 1; if( szNew > p->mxAlloc ){ - p->nAlloc = p->mxAlloc; - if( ((i64)p->nChar)+((i64)N) >= p->nAlloc ){ - sqlite3StrAccumReset(p); - p->tooBig = 1; - return; - } + sqlite3StrAccumReset(p); + p->tooBig = 1; + return; }else{ p->nAlloc = szNew; } diff --git a/src/select.c b/src/select.c index f5ee47d926..8ea021f07c 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.452 2008/07/09 01:39:44 drh Exp $ +** $Id: select.c,v 1.453 2008/07/10 00:32:42 drh Exp $ */ #include "sqliteInt.h" @@ -1180,16 +1180,14 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, char *zTabName, Select *pSelect){ if( (zName = pEList->a[i].zName)!=0 ){ /* If the column contains an "AS " phrase, use as the name */ zName = sqlite3DbStrDup(db, zName); - }else if( p->op==TK_DOT - && (pR=p->pRight)!=0 && pR->token.z && pR->token.z[0] ){ - /* For columns of the from A.B use B as the name */ - zName = sqlite3MPrintf(db, "%T", &pR->token); - }else if( p->span.z && p->span.z[0] ){ + }else if( p->op==TK_COLUMN && p->pTab ){ + /* For columns use the column name name */ + int iCol = p->iColumn; + if( iCol<0 ) iCol = p->pTab->iPKey; + zName = sqlite3MPrintf(db, "%s", p->pTab->aCol[iCol].zName); + }else{ /* Use the original text of the column expression as its name */ zName = sqlite3MPrintf(db, "%T", &p->span); - }else{ - /* If all else fails, make up a name */ - zName = sqlite3MPrintf(db, "column%d", i+1); } if( !zName || db->mallocFailed ){ db->mallocFailed = 1; @@ -1397,8 +1395,8 @@ static int prepSelectStmt(Parse *pParse, Select *p){ if( zTabName==0 || zTabName[0]==0 ){ zTabName = pTab->zName; } - if( zTName && (zTabName==0 || zTabName[0]==0 || - sqlite3StrICmp(zTName, zTabName)!=0) ){ + assert( zTabName ); + if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){ continue; } tableSeen = 1; @@ -1432,7 +1430,7 @@ static int prepSelectStmt(Parse *pParse, Select *p){ pRight = sqlite3PExpr(pParse, TK_ID, 0, 0, 0); if( pRight==0 ) break; setQuotedToken(pParse, &pRight->token, zName); - if( zTabName && (longNames || pTabList->nSrc>1) ){ + if( longNames || pTabList->nSrc>1 ){ Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, 0); pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0); if( pExpr==0 ) break; @@ -1644,8 +1642,7 @@ static int processOrderGroupBy( */ static int processCompoundOrderBy( Parse *pParse, /* Parsing context. Leave error messages here */ - Select *pSelect, /* The SELECT statement containing the ORDER BY */ - int iTable /* Output table for compound SELECT statements */ + Select *pSelect /* The SELECT statement containing the ORDER BY */ ){ int i; ExprList *pOrderBy; @@ -1698,17 +1695,9 @@ static int processCompoundOrderBy( } } if( iCol>0 ){ - if( iTable ){ - pE->op = TK_COLUMN; - pE->iTable = iTable; - pE->iAgg = -1; - pE->iColumn = iCol-1; - pE->pTab = 0; - }else{ - pE->op = TK_INTEGER; - pE->flags |= EP_IntValue; - pE->iTable = iCol; - } + pE->op = TK_INTEGER; + pE->flags |= EP_IntValue; + pE->iTable = iCol; pOrderBy->a[i].done = 1; }else{ moreToDo = 1; @@ -1878,9 +1867,6 @@ static int multiSelect( int rc = SQLITE_OK; /* Success code from a subroutine */ Select *pPrior; /* Another SELECT immediately to our left */ Vdbe *v; /* Generate code to this VDBE */ - int nCol; /* Number of columns in the result set */ - int aSetP2[2]; /* Set P2 value of these op to number of columns */ - int nSetP2 = 0; /* Number of slots in aSetP2[] used */ SelectDest dest; /* Alternative data destination */ Select *pDelete = 0; /* Chain of simple selects to delete */ @@ -1982,7 +1968,7 @@ static int multiSelect( int addr; SelectDest uniondest; - priorOp = p->op==TK_ALL ? SRT_Table : SRT_Union; + priorOp = SRT_Union; if( dest.eDest==priorOp && !p->pLimit && !p->pOffset ){ /* We can reuse a temporary table generated by a SELECT to our ** right. @@ -1993,19 +1979,11 @@ static int multiSelect( ** intermediate results. */ unionTab = pParse->nTab++; - if( processCompoundOrderBy(pParse, p, unionTab) ){ - rc = 1; - goto multi_select_end; - } + assert( p->pOrderBy==0 ); addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0); - if( priorOp==SRT_Table ){ - assert( nSetP2addrOpenEphm[0] == -1 ); - p->addrOpenEphm[0] = addr; - p->pRightmost->usesEphm = 1; - } + assert( p->addrOpenEphm[0] == -1 ); + p->addrOpenEphm[0] = addr; + p->pRightmost->usesEphm = 1; assert( p->pEList ); } @@ -2088,10 +2066,7 @@ static int multiSelect( */ tab1 = pParse->nTab++; tab2 = pParse->nTab++; - if( processCompoundOrderBy(pParse, p, tab1) ){ - rc = 1; - goto multi_select_end; - } + assert( p->pOrderBy==0 ); addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0); assert( p->addrOpenEphm[0] == -1 ); @@ -2156,13 +2131,6 @@ static int multiSelect( } } - /* Set the number of columns in temporary tables - */ - nCol = p->pEList->nExpr; - while( nSetP2 ){ - sqlite3VdbeChangeP2(v, aSetP2[--nSetP2], nCol); - } - /* Compute collating sequences used by ** temporary tables needed to implement the compound select. ** Attach the KeyInfo structure to all temporary tables. @@ -2177,8 +2145,10 @@ static int multiSelect( KeyInfo *pKeyInfo; /* Collating sequence for the result set */ Select *pLoop; /* For looping through SELECT statements */ CollSeq **apColl; /* For looping through pKeyInfo->aColl[] */ + int nCol; /* Number of columns in result set */ assert( p->pRightmost==p ); + nCol = p->pEList->nExpr; pKeyInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pKeyInfo)+nCol*(sizeof(CollSeq*) + 1)); if( !pKeyInfo ){ @@ -2519,14 +2489,12 @@ static int multiSelectOrderBy( pPrior = p->pPrior; assert( pPrior->pOrderBy==0 ); pOrderBy = p->pOrderBy; - if( pOrderBy ){ - if( processCompoundOrderBy(pParse, p, 0) ){ - return SQLITE_ERROR; - } - nOrderBy = pOrderBy->nExpr; - }else{ - nOrderBy = 0; + assert( pOrderBy ); + if( processCompoundOrderBy(pParse, p) ){ + return SQLITE_ERROR; } + nOrderBy = pOrderBy->nExpr; + /* For operators other than UNION ALL we have to make sure that ** the ORDER BY clause covers every term of the result set. Add ** terms to the ORDER BY clause as necessary. diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 9f9985f4b1..b019dffab9 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.739 2008/07/09 13:28:54 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.740 2008/07/10 00:32:42 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -834,8 +834,7 @@ struct CollSeq { ** changing the affinity. */ #define SQLITE_JUMPIFNULL 0x08 /* jumps if either operand is NULL */ -#define SQLITE_NULLEQUAL 0x10 /* compare NULLs equal */ -#define SQLITE_STOREP2 0x80 /* Store result in reg[P2] rather than jump */ +#define SQLITE_STOREP2 0x10 /* Store result in reg[P2] rather than jump */ /* ** Each SQL table is represented in memory by an instance of the diff --git a/src/test3.c b/src/test3.c index 0726b58630..644557844a 100644 --- a/src/test3.c +++ b/src/test3.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test3.c,v 1.98 2008/06/18 17:09:10 danielk1977 Exp $ +** $Id: test3.c,v 1.99 2008/07/10 00:32:42 drh Exp $ */ #include "sqliteInt.h" #include "btreeInt.h" @@ -473,70 +473,6 @@ static int btree_update_meta( return TCL_OK; } -/* -** Usage: btree_page_dump ID PAGENUM -** -** Print a disassembly of a page on standard output -*/ -static int btree_page_dump( - void *NotUsed, - Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ - int argc, /* Number of arguments */ - const char **argv /* Text of each argument */ -){ - Btree *pBt; - int iPage; - int rc; - - if( argc!=3 ){ - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " ID\"", 0); - return TCL_ERROR; - } - pBt = sqlite3TextToPtr(argv[1]); - if( Tcl_GetInt(interp, argv[2], &iPage) ) return TCL_ERROR; - sqlite3BtreeEnter(pBt); - rc = sqlite3BtreePageDump(pBt, iPage, 0); - sqlite3BtreeLeave(pBt); - if( rc!=SQLITE_OK ){ - Tcl_AppendResult(interp, errorName(rc), 0); - return TCL_ERROR; - } - return TCL_OK; -} - -/* -** Usage: btree_tree_dump ID PAGENUM -** -** Print a disassembly of a page and all its child pages on standard output -*/ -static int btree_tree_dump( - void *NotUsed, - Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ - int argc, /* Number of arguments */ - const char **argv /* Text of each argument */ -){ - Btree *pBt; - int iPage; - int rc; - - if( argc!=3 ){ - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " ID\"", 0); - return TCL_ERROR; - } - pBt = sqlite3TextToPtr(argv[1]); - if( Tcl_GetInt(interp, argv[2], &iPage) ) return TCL_ERROR; - sqlite3BtreeEnter(pBt); - rc = sqlite3BtreePageDump(pBt, iPage, 1); - sqlite3BtreeLeave(pBt); - if( rc!=SQLITE_OK ){ - Tcl_AppendResult(interp, errorName(rc), 0); - return TCL_ERROR; - } - return TCL_OK; -} - /* ** Usage: btree_pager_stats ID ** @@ -587,33 +523,6 @@ static int btree_pager_stats( return TCL_OK; } -/* -** Usage: btree_pager_ref_dump ID -** -** Print out all outstanding pages. -*/ -static int btree_pager_ref_dump( - void *NotUsed, - Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ - int argc, /* Number of arguments */ - const char **argv /* Text of each argument */ -){ - Btree *pBt; - - if( argc!=2 ){ - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " ID\"", 0); - return TCL_ERROR; - } - pBt = sqlite3TextToPtr(argv[1]); -#ifdef SQLITE_TEST - sqlite3BtreeEnter(pBt); - sqlite3PagerRefdump(sqlite3BtreePager(pBt)); - sqlite3BtreeLeave(pBt); -#endif - return TCL_OK; -} - /* ** Usage: btree_integrity_check ID ROOT ... ** @@ -1653,10 +1562,7 @@ int Sqlitetest3_Init(Tcl_Interp *interp){ { "btree_clear_table", (Tcl_CmdProc*)btree_clear_table }, { "btree_get_meta", (Tcl_CmdProc*)btree_get_meta }, { "btree_update_meta", (Tcl_CmdProc*)btree_update_meta }, - { "btree_page_dump", (Tcl_CmdProc*)btree_page_dump }, - { "btree_tree_dump", (Tcl_CmdProc*)btree_tree_dump }, { "btree_pager_stats", (Tcl_CmdProc*)btree_pager_stats }, - { "btree_pager_ref_dump", (Tcl_CmdProc*)btree_pager_ref_dump }, { "btree_cursor", (Tcl_CmdProc*)btree_cursor }, { "btree_close_cursor", (Tcl_CmdProc*)btree_close_cursor }, { "btree_move_to", (Tcl_CmdProc*)btree_move_to }, diff --git a/src/test_btree.c b/src/test_btree.c index 3647a5b0ba..615c9601dc 100644 --- a/src/test_btree.c +++ b/src/test_btree.c @@ -13,120 +13,11 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test_btree.c,v 1.3 2007/08/17 01:14:39 drh Exp $ +** $Id: test_btree.c,v 1.4 2008/07/10 00:32:42 drh Exp $ */ #include "btreeInt.h" #include -/* -** Print a disassembly of the given page on standard output. This routine -** is used for debugging and testing only. -*/ -static int btreePageDump( - BtShared *pBt, /* The Btree to be dumped */ - int pgno, /* The page to be dumped */ - int recursive, /* True to decend into child pages */ - MemPage *pParent /* Parent page */ -){ - int rc; - MemPage *pPage; - int i, j, c; - int nFree; - u16 idx; - int hdr; - int nCell; - int isInit; - unsigned char *data; - char range[20]; - unsigned char payload[20]; - - rc = sqlite3BtreeGetPage(pBt, (Pgno)pgno, &pPage, 0); - isInit = pPage->isInit; - if( pPage->isInit==0 ){ - sqlite3BtreeInitPage(pPage, pParent); - } - if( rc ){ - return rc; - } - hdr = pPage->hdrOffset; - data = pPage->aData; - c = data[hdr]; - pPage->intKey = (c & (PTF_INTKEY|PTF_LEAFDATA))!=0; - pPage->zeroData = (c & PTF_ZERODATA)!=0; - pPage->leafData = (c & PTF_LEAFDATA)!=0; - pPage->leaf = (c & PTF_LEAF)!=0; - pPage->hasData = !(pPage->zeroData || (!pPage->leaf && pPage->leafData)); - nCell = get2byte(&data[hdr+3]); - sqlite3DebugPrintf("PAGE %d: flags=0x%02x frag=%d parent=%d\n", pgno, - data[hdr], data[hdr+7], - (pPage->isInit && pPage->pParent) ? pPage->pParent->pgno : 0); - assert( hdr == (pgno==1 ? 100 : 0) ); - idx = hdr + 12 - pPage->leaf*4; - for(i=0; ileaf ){ - child = 0; - }else{ - child = get4byte(pCell); - } - sz = info.nData; - if( !pPage->intKey ) sz += info.nKey; - if( sz>sizeof(payload)-1 ) sz = sizeof(payload)-1; - memcpy(payload, &pCell[info.nHeader], sz); - for(j=0; j0x7f ) payload[j] = '.'; - } - payload[sz] = 0; - sqlite3DebugPrintf( - "cell %2d: i=%-10s chld=%-4d nk=%-4lld nd=%-4d payload=%s\n", - i, range, child, info.nKey, info.nData, payload - ); - } - if( !pPage->leaf ){ - sqlite3DebugPrintf("right_child: %d\n", get4byte(&data[hdr+8])); - } - nFree = 0; - i = 0; - idx = get2byte(&data[hdr+1]); - while( idx>0 && idxpBt->usableSize ){ - int sz = get2byte(&data[idx+2]); - sqlite3_snprintf(sizeof(range),range,"%d..%d", idx, idx+sz-1); - nFree += sz; - sqlite3DebugPrintf("freeblock %2d: i=%-10s size=%-4d total=%d\n", - i, range, sz, nFree); - idx = get2byte(&data[idx]); - i++; - } - if( idx!=0 ){ - sqlite3DebugPrintf("ERROR: next freeblock index out of range: %d\n", idx); - } - if( recursive && !pPage->leaf ){ - for(i=0; iisInit = isInit; - sqlite3PagerUnref(pPage->pDbPage); - fflush(stdout); - return SQLITE_OK; -} -int sqlite3BtreePageDump(Btree *p, int pgno, int recursive){ - return btreePageDump(p->pBt, pgno, recursive, 0); -} - /* ** Usage: sqlite3_shared_cache_report ** diff --git a/src/util.c b/src/util.c index 419cf03a99..ad1865c4e4 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.235 2008/07/09 13:28:54 drh Exp $ +** $Id: util.c,v 1.236 2008/07/10 00:32:42 drh Exp $ */ #include "sqliteInt.h" #include @@ -937,6 +937,7 @@ int sqlite3SafetyCheckSickOrOk(sqlite3 *db){ return 1; } +#ifndef SQLITE_COVERAGE_TEST /* ** Report a failsafe() macro failure */ @@ -950,3 +951,4 @@ void sqlite3Failsafe(int iCode){ */ assert( iCode==0 ); /* Always fails if assert() is enabled */ } +#endif diff --git a/src/vdbe.c b/src/vdbe.c index 69bf418657..ac3e208685 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.759 2008/07/08 19:34:07 drh Exp $ +** $Id: vdbe.c,v 1.760 2008/07/10 00:32:42 drh Exp $ */ #include "sqliteInt.h" #include @@ -1610,10 +1610,6 @@ case OP_ToReal: { /* same as TK_TO_REAL, in1 */ ** reg(P3) is NULL then take the jump. If the SQLITE_JUMPIFNULL ** bit is clear then fall thru if either operand is NULL. ** -** If the SQLITE_NULLEQUAL bit of P5 is set then treat NULL operands -** as being equal to one another. Normally NULLs are not equal to -** anything including other NULLs. -** ** The SQLITE_AFF_MASK portion of P5 must be an affinity character - ** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made ** to coerce both inputs according to this affinity before the @@ -1679,36 +1675,17 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ flags = pIn1->flags|pIn3->flags; if( flags&MEM_Null ){ - if( (pOp->p5 & SQLITE_NULLEQUAL)!=0 ){ - /* - ** When SQLITE_NULLEQUAL set and either operand is NULL - ** then both operands are converted to integers prior to being - ** passed down into the normal comparison logic below. - ** NULL operands are converted to zero and non-NULL operands - ** are converted to 1. Thus, for example, with SQLITE_NULLEQUAL - ** set, NULL==NULL is true whereas it would normally NULL. - ** Similarly, NULL!=123 is true. - */ - x1.flags = MEM_Int; - x1.u.i = (pIn1->flags & MEM_Null)==0; - pIn1 = &x1; - x3.flags = MEM_Int; - x3.u.i = (pIn3->flags & MEM_Null)==0; - pIn3 = &x3; - }else{ - /* If the SQLITE_NULLEQUAL bit is clear and either operand is NULL then - ** the result is always NULL. The jump is taken if the - ** SQLITE_JUMPIFNULL bit is set. - */ - if( pOp->p5 & SQLITE_STOREP2 ){ - pOut = &p->aMem[pOp->p2]; - MemSetTypeFlag(pOut, MEM_Null); - REGISTER_TRACE(pOp->p2, pOut); - }else if( pOp->p5 & SQLITE_JUMPIFNULL ){ - pc = pOp->p2-1; - } - break; + /* If either operand is NULL then the result is always NULL. + ** The jump is taken if the SQLITE_JUMPIFNULL bit is set. + */ + if( pOp->p5 & SQLITE_STOREP2 ){ + pOut = &p->aMem[pOp->p2]; + MemSetTypeFlag(pOut, MEM_Null); + REGISTER_TRACE(pOp->p2, pOut); + }else if( pOp->p5 & SQLITE_JUMPIFNULL ){ + pc = pOp->p2-1; } + break; } affinity = pOp->p5 & SQLITE_AFF_MASK; @@ -1776,6 +1753,7 @@ case OP_Compare: { int i, p1, p2; const KeyInfo *pKeyInfo = pOp->p4.pKeyInfo; assert( n>0 ); + assert( pKeyInfo!=0 ); p1 = pOp->p1; assert( p1>0 && p1+n-1nMem ); p2 = pOp->p2; @@ -1784,17 +1762,11 @@ case OP_Compare: { int idx = aPermute ? aPermute[i] : i; CollSeq *pColl; /* Collating sequence to use on this term */ int bRev; /* True for DESCENDING sort order */ - assert( pKeyInfo==0 || inField ); REGISTER_TRACE(p1+idx, &p->aMem[p1+idx]); REGISTER_TRACE(p2+idx, &p->aMem[p2+idx]); - if( pKeyInfo ){ - assert( inField ); - pColl = pKeyInfo->aColl[i]; - bRev = pKeyInfo->aSortOrder[i]; - }else{ - pColl = 0; - bRev = 0; - } + assert( inField ); + pColl = pKeyInfo->aColl[i]; + bRev = pKeyInfo->aSortOrder[i]; iCompare = sqlite3MemCompare(&p->aMem[p1+idx], &p->aMem[p2+idx], pColl); if( iCompare ){ if( bRev ) iCompare = -iCompare; diff --git a/src/vdbeblob.c b/src/vdbeblob.c index c0df14e060..e2cfb503dd 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -12,7 +12,7 @@ ** ** This file contains code used to implement incremental BLOB I/O. ** -** $Id: vdbeblob.c,v 1.23 2008/06/16 14:19:58 danielk1977 Exp $ +** $Id: vdbeblob.c,v 1.24 2008/07/10 00:32:42 drh Exp $ */ #include "sqliteInt.h" @@ -96,10 +96,9 @@ int sqlite3_blob_open( memset(&sParse, 0, sizeof(Parse)); sParse.db = db; - rc = sqlite3SafetyOn(db); - if( rc!=SQLITE_OK ){ + if( sqlite3SafetyOn(db) ){ sqlite3_mutex_leave(db->mutex); - return rc; + return SQLITE_MISUSE; } sqlite3BtreeEnterAll(db); diff --git a/test/collate9.test b/test/collate9.test index d676f80f05..5a07773a1c 100644 --- a/test/collate9.test +++ b/test/collate9.test @@ -13,7 +13,7 @@ # focus of this script is making sure that the names of collation # sequences may be quoted using double quotes in SQL statements. # -# $Id: collate9.test,v 1.1 2007/11/12 09:50:26 danielk1977 Exp $ +# $Id: collate9.test,v 1.2 2008/07/10 00:32:42 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -105,6 +105,11 @@ do_test collate9-2.5 { SELECT y FROM xy ORDER BY y COLLATE "reverse sort" } } {two three one} +do_test collate9-2.6 { + execsql { + SELECT y COLLATE "reverse sort" AS aaa FROM xy ORDER BY aaa + } +} {two three one} do_test collate9-3.1 { execsql { @@ -121,6 +126,16 @@ do_test collate9-3.3 { SELECT y FROM xy ORDER BY y COLLATE "reverse sort" } } {two three one nosort} +do_test collate9-3.4 { + cksort { + SELECT y AS aaa FROM xy ORDER BY aaa + } +} {one three two sort} +do_test collate9-3.5 { + cksort { + SELECT y COLLATE "reverse sort" AS aaa FROM xy ORDER BY aaa + } +} {two three one nosort} ifcapable reindex { do_test collate9-4.1 { @@ -161,4 +176,3 @@ ifcapable reindex { } finish_test - diff --git a/test/select1.test b/test/select1.test index 0b04b39167..2675d6328b 100644 --- a/test/select1.test +++ b/test/select1.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # -# $Id: select1.test,v 1.62 2008/07/09 01:39:44 drh Exp $ +# $Id: select1.test,v 1.63 2008/07/10 00:32:42 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -533,6 +533,26 @@ do_test select1-6.9.5 { SELECT 123.45; } } {123.45 123.45} +do_test select1-6.9.6 { + execsql2 { + SELECT * FROM test1 a, test1 b LIMIT 1 + } +} {a.f1 11 a.f2 22 b.f1 11 b.f2 22} +do_test select1-6.9.7 { + set x [execsql2 { + SELECT * FROM test1 a, (select 5, 6) LIMIT 1 + }] + regsub -all {subquery_[0-9a-fA-F]+_} $x {subquery} x + set x +} {a.f1 11 a.f2 22 sqlite_subquery.5 5 sqlite_subquery.6 6} +do_test select1-6.9.8 { + set x [execsql2 { + SELECT * FROM test1 a, (select 5 AS x, 6 AS y) AS b LIMIT 1 + }] + regsub -all {subquery_[0-9a-fA-F]+_} $x {subquery} x + set x +} {a.f1 11 a.f2 22 b.x 5 b.y 6} + db eval { PRAGMA short_column_names=ON; PRAGMA full_column_names=OFF; @@ -754,6 +774,11 @@ do_test select1-10.6 { SELECT f1-22 AS x, f2-22 as y FROM test1 WHERE x>0 AND y<50 } } {11 22} +do_test select1-10.7 { + execsql { + SELECT f1 COLLATE nocase AS x FROM test1 ORDER BY x + } +} {11 33} # Check the ability to specify "TABLE.*" in the result set of a SELECT # diff --git a/test/sqllimits1.test b/test/sqllimits1.test index 3dcd3ea132..192522bbd5 100644 --- a/test/sqllimits1.test +++ b/test/sqllimits1.test @@ -12,7 +12,7 @@ # This file contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # -# $Id: sqllimits1.test,v 1.29 2008/07/08 15:26:50 drh Exp $ +# $Id: sqllimits1.test,v 1.30 2008/07/10 00:32:42 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -625,6 +625,26 @@ do_test sqllimits1-8.9 { catchsql "CREATE TABLE t2([join $cols ,])" catchsql "CREATE VIEW v1 AS SELECT *, c1 AS o FROM t2;" } {1 {too many columns in result set}} +do_test sqllimits1-8.10 { + # ORDER BY columns + set cols [list] + for {set i 0} {$i <= $SQLITE_LIMIT_COLUMN} {incr i} { + lappend cols c + } + set sql "SELECT c FROM t1 ORDER BY [join $cols ,]" + catchsql $sql +} {1 {too many terms in ORDER BY clause}} +do_test sqllimits1-8.11 { + # ORDER BY columns + set cols [list] + for {set i 0} {$i <= $SQLITE_LIMIT_COLUMN} {incr i} { + lappend cols [expr {$i%3 + 1}] + } + set sql "SELECT c, c+1, c+2 FROM t1 UNION SELECT c-1, c-2, c-3 FROM t1" + append sql " ORDER BY [join $cols ,]" + catchsql $sql +} {1 {too many terms in ORDER BY clause}} + #-------------------------------------------------------------------- # These tests - sqllimits1-9.* - test that the SQLITE_LIMIT_EXPR_DEPTH diff --git a/test/subquery.test b/test/subquery.test index e81269d6e2..c6416fc90f 100644 --- a/test/subquery.test +++ b/test/subquery.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing correlated subqueries # -# $Id: subquery.test,v 1.15 2007/09/18 16:53:53 drh Exp $ +# $Id: subquery.test,v 1.16 2008/07/10 00:32:42 drh Exp $ # set testdir [file dirname $argv0] @@ -127,7 +127,7 @@ do_test subquery-1.10.4 { INSERT INTO t5 VALUES(25, '2003-3'); INSERT INTO t5 VALUES(5, '2003-4'); - SELECT "a.period", vsum + SELECT period, vsum FROM (SELECT a.period, (select sum(val) from t5 where period between a.period and '2002-4') vsum @@ -137,7 +137,7 @@ do_test subquery-1.10.4 { } {2002-2 30 2002-3 25 2002-4 15} do_test subquery-1.10.5 { execsql { - SELECT "a.period", vsum from + SELECT period, vsum from (select a.period, (select sum(val) from t5 where period between a.period and '2002-4') vsum FROM t5 a where a.period between '2002-1' and '2002-4') diff --git a/test/view.test b/test/view.test index f2f2ab68f8..8dabf1f254 100644 --- a/test/view.test +++ b/test/view.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing VIEW statements. # -# $Id: view.test,v 1.36 2008/06/30 18:12:28 danielk1977 Exp $ +# $Id: view.test,v 1.37 2008/07/10 00:32:42 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -139,13 +139,19 @@ do_test view-3.2 { SELECT * FROM v2 LIMIT 1 } } {x 7 a 8 b 9 c 10} -do_test view-3.3 { +do_test view-3.3.1 { execsql2 { DROP VIEW v1; CREATE VIEW v1 AS SELECT a AS 'xyz', b+c AS 'pqr', c-b FROM t1; SELECT * FROM v1 LIMIT 1 } } {xyz 2 pqr 7 c-b 1} +do_test view-3.3.2 { + execsql2 { + CREATE VIEW v1b AS SELECT t1.a, b+c, t1.c FROM t1; + SELECT * FROM v1b LIMIT 1 + } +} {a 2 b+c 7 c 4} ifcapable compound { do_test view-3.4 {