/ Check-in [c6fc49e6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Exclude a few more lines of code using OMIT macros. (CVS 2253)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c6fc49e61033419e78b6b10638d57f4942087961
User & Date: danielk1977 2005-01-21 08:13:14
Context
2005-01-21
11:55
Improve test coverage for minimum feature builds. (CVS 2254) check-in: 9c4d0e13 user: danielk1977 tags: trunk
08:13
Exclude a few more lines of code using OMIT macros. (CVS 2253) check-in: c6fc49e6 user: danielk1977 tags: trunk
04:25
Modify test scripts to work when SQLITE_OMIT_SUBQUERY (but no other OMIT macros) is defined. (CVS 2252) check-in: d4e19efc user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** $Id: btree.c,v 1.242 2005/01/21 00:22:38 drh Exp $
           12  +** $Id: btree.c,v 1.243 2005/01/21 08:13:14 danielk1977 Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** For a detailed discussion of BTrees, refer to
    16     16   **
    17     17   **     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
    18     18   **     "Sorting And Searching", pages 473-480. Addison-Wesley
    19     19   **     Publishing Company, Reading, Massachusetts.
................................................................................
  1320   1320   ** Change the way data is synced to disk in order to increase or decrease
  1321   1321   ** how well the database resists damage due to OS crashes and power
  1322   1322   ** failures.  Level 1 is the same as asynchronous (no syncs() occur and
  1323   1323   ** there is a high probability of damage)  Level 2 is the default.  There
  1324   1324   ** is a very low but non-zero probability of damage.  Level 3 reduces the
  1325   1325   ** probability of damage to near zero but with a write performance reduction.
  1326   1326   */
         1327  +#ifndef SQLITE_OMIT_PAGER_PRAGMAS
  1327   1328   int sqlite3BtreeSetSafetyLevel(Btree *pBt, int level){
  1328   1329     sqlite3pager_set_safety_level(pBt->pPager, level);
  1329   1330     return SQLITE_OK;
  1330   1331   }
         1332  +#endif
  1331   1333   
  1332   1334   /*
  1333   1335   ** Change the default pages size and the number of reserved bytes per page.
  1334   1336   **
  1335   1337   ** The page size must be a power of 2 between 512 and 65536.  If the page
  1336   1338   ** size supplied does not meet this constraint then the page size is not
  1337   1339   ** changed.

Changes to src/expr.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains routines used for analyzing expressions and
    13     13   ** for generating VDBE code that evaluates expressions in SQLite.
    14     14   **
    15         -** $Id: expr.c,v 1.186 2005/01/20 22:48:48 drh Exp $
           15  +** $Id: expr.c,v 1.187 2005/01/21 08:13:15 danielk1977 Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /*
    21     21   ** Return the 'affinity' of the expression pExpr if any.
    22     22   **
................................................................................
   442    442       pItem->zName = sqliteStrDup(pOldItem->zName);
   443    443       pItem->sortOrder = pOldItem->sortOrder;
   444    444       pItem->isAgg = pOldItem->isAgg;
   445    445       pItem->done = 0;
   446    446     }
   447    447     return pNew;
   448    448   }
          449  +
          450  +/*
          451  +** If cursors, triggers, views and subqueries are all omitted from
          452  +** the build, then none of the following routines, except for 
          453  +** sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes
          454  +** called with a NULL argument.
          455  +*/
          456  +#if !defined(SQLITE_OMIT_CURSOR) || !defined(SQLITE_OMIT_VIEW) \
          457  + || !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_SUBQUERY)
   449    458   SrcList *sqlite3SrcListDup(SrcList *p){
   450    459     SrcList *pNew;
   451    460     int i;
   452    461     int nByte;
   453    462     if( p==0 ) return 0;
   454    463     nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);
   455    464     pNew = sqliteMallocRaw( nByte );
................................................................................
   505    514     pNew->nOffset = p->nOffset;
   506    515     pNew->iLimit = -1;
   507    516     pNew->iOffset = -1;
   508    517     pNew->ppOpenTemp = 0;
   509    518     pNew->pFetch = 0;
   510    519     return pNew;
   511    520   }
          521  +#else
          522  +Select *sqlite3SelectDup(Select *p){
          523  +  assert( p==0 );
          524  +  return 0;
          525  +}
          526  +#endif
   512    527   
   513    528   
   514    529   /*
   515    530   ** Add a new element to the end of an expression list.  If pList is
   516    531   ** initially NULL, then create a new expression list.
   517    532   */
   518    533   ExprList *sqlite3ExprListAppend(ExprList *pList, Expr *pExpr, Token *pName){
................................................................................
  1545   1560           sqlite3VdbeAddOp(v, OP_Gosub, 0, pExpr->iTable);
  1546   1561           VdbeComment((v, "# run subquery"));
  1547   1562         }
  1548   1563         sqlite3VdbeAddOp(v, OP_MemLoad, pExpr->iColumn, 0);
  1549   1564         VdbeComment((v, "# load subquery result"));
  1550   1565         break;
  1551   1566       }
  1552         -#endif
  1553   1567       case TK_IN: {
  1554   1568         int addr;
  1555   1569         char affinity;
  1556   1570   
  1557   1571         /* Figure out the affinity to use to create a key from the results
  1558   1572         ** of the expression. affinityStr stores a static string suitable for
  1559   1573         ** P3 of OP_MakeRecord.
................................................................................
  1573   1587         sqlite3VdbeAddOp(v, OP_Goto, 0, addr+7);
  1574   1588         sqlite3VdbeOp3(v, OP_MakeRecord, 1, 0, &affinity, 1);   /* addr + 4 */
  1575   1589         sqlite3VdbeAddOp(v, OP_Found, pExpr->iTable, addr+7);
  1576   1590         sqlite3VdbeAddOp(v, OP_AddImm, -1, 0);                  /* addr + 6 */
  1577   1591   
  1578   1592         break;
  1579   1593       }
         1594  +#endif
  1580   1595       case TK_BETWEEN: {
  1581   1596         Expr *pLeft = pExpr->pLeft;
  1582   1597         struct ExprList_item *pLItem = pExpr->pList->a;
  1583   1598         Expr *pRight = pLItem->pExpr;
  1584   1599         sqlite3ExprCode(pParse, pLeft);
  1585   1600         sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
  1586   1601         sqlite3ExprCode(pParse, pRight);
................................................................................
  1665   1680         }
  1666   1681       }
  1667   1682   #endif
  1668   1683       break;
  1669   1684     }
  1670   1685   }
  1671   1686   
         1687  +#ifndef SQLITE_OMIT_TRIGGER
  1672   1688   /*
  1673   1689   ** Generate code that evalutes the given expression and leaves the result
  1674   1690   ** on the stack.  See also sqlite3ExprCode().
  1675   1691   **
  1676   1692   ** This routine might also cache the result and modify the pExpr tree
  1677   1693   ** so that it will make use of the cached result on subsequent evaluations
  1678   1694   ** rather than evaluate the whole expression again.  Trivial expressions are
................................................................................
  1689   1705     addr2 = sqlite3VdbeCurrentAddr(v);
  1690   1706     if( addr2>addr1+1 || sqlite3VdbeGetOp(v, addr1)->opcode==OP_Function ){
  1691   1707       iMem = pExpr->iTable = pParse->nMem++;
  1692   1708       sqlite3VdbeAddOp(v, OP_MemStore, iMem, 0);
  1693   1709       pExpr->op = TK_REGISTER;
  1694   1710     }
  1695   1711   }
         1712  +#endif
  1696   1713   
  1697   1714   /*
  1698   1715   ** Generate code that pushes the value of every element of the given
  1699   1716   ** expression list onto the stack.
  1700   1717   **
  1701   1718   ** Return the number of elements pushed onto the stack.
  1702   1719   */

Changes to src/main.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Main file for the SQLite library.  The routines in this file
    13     13   ** implement the programmer interface to the library.  Routines in
    14     14   ** other files are for internal use by SQLite and should not be
    15     15   ** accessed by users of the library.
    16     16   **
    17         -** $Id: main.c,v 1.272 2005/01/18 16:02:40 drh Exp $
           17  +** $Id: main.c,v 1.273 2005/01/21 08:13:15 danielk1977 Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** The following constant value is used by the SQLITE_BIGENDIAN and
................................................................................
   709    709         (!xFunc && (xFinal && !xStep)) ||
   710    710         (!xFunc && (!xFinal && xStep)) ||
   711    711         (nArg<-1 || nArg>127) ||
   712    712         (255<(nName = strlen(zFunctionName))) ){
   713    713       return SQLITE_ERROR;
   714    714     }
   715    715     
          716  +#ifndef SQLITE_OMIT_UTF16
   716    717     /* If SQLITE_UTF16 is specified as the encoding type, transform this
   717    718     ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the
   718    719     ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally.
   719    720     **
   720    721     ** If SQLITE_ANY is specified, add three versions of the function
   721    722     ** to the hash table.
   722    723     */
................................................................................
   728    729            pUserData, xFunc, xStep, xFinal);
   729    730       if( rc!=SQLITE_OK ) return rc;
   730    731       rc = sqlite3_create_function(db, zFunctionName, nArg, SQLITE_UTF16LE,
   731    732           pUserData, xFunc, xStep, xFinal);
   732    733       if( rc!=SQLITE_OK ) return rc;
   733    734       enc = SQLITE_UTF16BE;
   734    735     }
          736  +#else
          737  +  enc = SQLITE_UTF8;
          738  +#endif
   735    739   
   736    740     p = sqlite3FindFunction(db, zFunctionName, nName, nArg, enc, 1);
   737    741     if( p==0 ) return SQLITE_NOMEM;
   738    742     p->xFunc = xFunc;
   739    743     p->xStep = xStep;
   740    744     p->xFinalize = xFinal;
   741    745     p->pUserData = pUserData;
   742    746     return SQLITE_OK;
   743    747   }
          748  +#ifndef SQLITE_OMIT_UTF16
   744    749   int sqlite3_create_function16(
   745    750     sqlite3 *db,
   746    751     const void *zFunctionName,
   747    752     int nArg,
   748    753     int eTextRep,
   749    754     void *pUserData,
   750    755     void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
................................................................................
   765    770     if( !zFunc8 ){
   766    771       return SQLITE_NOMEM;
   767    772     }
   768    773     rc = sqlite3_create_function(db, zFunc8, nArg, eTextRep, 
   769    774         pUserData, xFunc, xStep, xFinal);
   770    775     return rc;
   771    776   }
          777  +#endif
   772    778   
   773    779   /*
   774    780   ** Register a trace function.  The pArg from the previously registered trace
   775    781   ** is returned.  
   776    782   **
   777    783   ** A NULL trace function means that no tracing is executes.  A non-NULL
   778    784   ** trace is a pointer to a function that is invoked at the start of each
................................................................................
  1009   1015     }
  1010   1016     if( sParse.rc==SQLITE_SCHEMA ){
  1011   1017       sqlite3ResetInternalSchema(db, 0);
  1012   1018     }
  1013   1019     if( pzTail ) *pzTail = sParse.zTail;
  1014   1020     rc = sParse.rc;
  1015   1021   
         1022  +#ifndef SQLITE_OMIT_EXPLAIN
  1016   1023     if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){
  1017   1024       sqlite3VdbeSetNumCols(sParse.pVdbe, 5);
  1018   1025       sqlite3VdbeSetColName(sParse.pVdbe, 0, "addr", P3_STATIC);
  1019   1026       sqlite3VdbeSetColName(sParse.pVdbe, 1, "opcode", P3_STATIC);
  1020   1027       sqlite3VdbeSetColName(sParse.pVdbe, 2, "p1", P3_STATIC);
  1021   1028       sqlite3VdbeSetColName(sParse.pVdbe, 3, "p2", P3_STATIC);
  1022   1029       sqlite3VdbeSetColName(sParse.pVdbe, 4, "p3", P3_STATIC);
  1023   1030     } 
         1031  +#endif
  1024   1032   
  1025   1033   prepare_out:
  1026   1034     if( sqlite3SafetyOff(db) ){
  1027   1035       rc = SQLITE_MISUSE;
  1028   1036     }
  1029   1037     if( rc==SQLITE_OK ){
  1030   1038       *ppStmt = (sqlite3_stmt*)sParse.pVdbe;

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.184 2005/01/20 11:32:24 danielk1977 Exp $
           21  +** @(#) $Id: pager.c,v 1.185 2005/01/21 08:13:15 danielk1977 Exp $
    22     22   */
    23     23   #include "sqliteInt.h"
    24     24   #include "os.h"
    25     25   #include "pager.h"
    26     26   #include <assert.h>
    27     27   #include <string.h>
    28     28   
................................................................................
  1434   1434   **              single disk sector is atomic, then this mode provides
  1435   1435   **              assurance that the journal will not be corrupted to the
  1436   1436   **              point of causing damage to the database during rollback.
  1437   1437   **
  1438   1438   ** Numeric values associated with these states are OFF==1, NORMAL=2,
  1439   1439   ** and FULL=3.
  1440   1440   */
         1441  +#ifndef SQLITE_OMIT_PAGER_PRAGMAS
  1441   1442   void sqlite3pager_set_safety_level(Pager *pPager, int level){
  1442   1443     pPager->noSync =  level==1 || pPager->tempFile;
  1443   1444     pPager->fullSync = level==3 && !pPager->tempFile;
  1444   1445     if( pPager->noSync ) pPager->needSync = 0;
  1445   1446   }
         1447  +#endif
  1446   1448   
  1447   1449   /*
  1448   1450   ** Open a temporary file.  Write the name of the file into zName
  1449   1451   ** (zName must be at least SQLITE_TEMPNAME_SIZE bytes long.)  Write
  1450   1452   ** the file descriptor into *fd.  Return SQLITE_OK on success or some
  1451   1453   ** other error code if we fail.
  1452   1454   **
................................................................................
  2843   2845       assert( pPager->aInStmt!=0 );
  2844   2846       pPager->aInStmt[pPg->pgno/8] |= 1<<(pPg->pgno&7);
  2845   2847       page_add_to_stmt_list(pPg);
  2846   2848     }
  2847   2849   }
  2848   2850   
  2849   2851   
         2852  +#ifndef SQLITE_OMIT_MEMORYDB
  2850   2853   /*
  2851   2854   ** Clear a PgHistory block
  2852   2855   */
  2853   2856   static void clearHistory(PgHistory *pHist){
  2854   2857     sqliteFree(pHist->pOrig);
  2855   2858     sqliteFree(pHist->pStmt);
  2856   2859     pHist->pOrig = 0;
  2857   2860     pHist->pStmt = 0;
  2858   2861   }
         2862  +#else
         2863  +#define clearHistory(x)
         2864  +#endif
  2859   2865   
  2860   2866   /*
  2861   2867   ** Commit all changes to the database and release the write lock.
  2862   2868   **
  2863   2869   ** If the commit fails for any reason, a rollback attempt is made
  2864   2870   ** and an error code is returned.  If the commit worked, SQLITE_OK
  2865   2871   ** is returned.
................................................................................
  3414   3420     return pPager->fd->fd.locktype;
  3415   3421   #else
  3416   3422     return pPager->fd.locktype;
  3417   3423   #endif
  3418   3424   }
  3419   3425   #endif
  3420   3426   
  3421         -#ifdef SQLITE_TEST
         3427  +#ifdef SQLITE_DEBUG
  3422   3428   /*
  3423   3429   ** Print a listing of all referenced pages and their ref count.
  3424   3430   */
  3425   3431   void sqlite3pager_refdump(Pager *pPager){
  3426   3432     PgHdr *pPg;
  3427   3433     for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
  3428   3434       if( pPg->nRef<=0 ) continue;
  3429   3435       sqlite3DebugPrintf("PAGE %3d addr=%p nRef=%d\n", 
  3430   3436          pPg->pgno, PGHDR_TO_DATA(pPg), pPg->nRef);
  3431   3437     }
  3432   3438   }
  3433   3439   #endif

Changes to src/select.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains C code routines that are called by the parser
    13     13   ** to handle SELECT statements in SQLite.
    14     14   **
    15         -** $Id: select.c,v 1.232 2005/01/20 22:48:48 drh Exp $
           15  +** $Id: select.c,v 1.233 2005/01/21 08:13:15 danielk1977 Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   
    20     20   /*
    21     21   ** Allocate a new Select structure and return a pointer to that
    22     22   ** structure.
................................................................................
   471    471           sqlite3VdbeAddOp(v, OP_NewRecno, iParm, 0);
   472    472           sqlite3VdbeAddOp(v, OP_Pull, 1, 0);
   473    473           sqlite3VdbeAddOp(v, OP_PutIntKey, iParm, 0);
   474    474         }
   475    475         break;
   476    476       }
   477    477   
          478  +#ifndef SQLITE_OMIT_SUBQUERY
   478    479       /* If we are creating a set for an "expr IN (SELECT ...)" construct,
   479    480       ** then there should be a single item on the stack.  Write this
   480    481       ** item into the set table with bogus data.
   481    482       */
   482    483       case SRT_Set: {
   483    484         int addr1 = sqlite3VdbeCurrentAddr(v);
   484    485         int addr2;
................................................................................
   511    512           pushOntoSorter(pParse, v, pOrderBy);
   512    513         }else{
   513    514           sqlite3VdbeAddOp(v, OP_MemStore, iParm, 1);
   514    515           sqlite3VdbeAddOp(v, OP_Goto, 0, iBreak);
   515    516         }
   516    517         break;
   517    518       }
          519  +#endif /* #ifndef SQLITE_OMIT_SUBQUERY */
   518    520   
   519    521       /* Send the data to the callback function.
   520    522       */
   521    523       case SRT_Callback:
   522    524       case SRT_Sorter: {
   523    525         if( pOrderBy ){
   524    526           sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, 0);
................................................................................
   539    541           pushOntoSorter(pParse, v, pOrderBy);
   540    542         }else{
   541    543           sqlite3VdbeAddOp(v, OP_Gosub, 0, iParm);
   542    544         }
   543    545         break;
   544    546       }
   545    547   
          548  +#if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_CURSOR)
   546    549       /* Discard the results.  This is used for SELECT statements inside
   547    550       ** the body of a TRIGGER.  The purpose of such selects is to call
   548    551       ** user-defined functions that have side effects.  We do not care
   549    552       ** about the actual results of the select.
   550    553       */
   551    554       default: {
   552    555         assert( eDest==SRT_Discard );
   553    556         sqlite3VdbeAddOp(v, OP_Pop, nColumn, 0);
   554    557         break;
   555    558       }
          559  +#endif
   556    560     }
   557    561     return 0;
   558    562   }
   559    563   
   560    564   /*
   561    565   ** If the inner loop was generated using a non-null pOrderBy argument,
   562    566   ** then the results were placed in a sorter.  After the loop is terminated
................................................................................
   604    608       case SRT_Table:
   605    609       case SRT_TempTable: {
   606    610         sqlite3VdbeAddOp(v, OP_NewRecno, iParm, 0);
   607    611         sqlite3VdbeAddOp(v, OP_Pull, 1, 0);
   608    612         sqlite3VdbeAddOp(v, OP_PutIntKey, iParm, 0);
   609    613         break;
   610    614       }
          615  +#ifndef SQLITE_OMIT_SUBQUERY
   611    616       case SRT_Set: {
   612    617         assert( nColumn==1 );
   613    618         sqlite3VdbeAddOp(v, OP_NotNull, -1, sqlite3VdbeCurrentAddr(v)+3);
   614    619         sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
   615    620         sqlite3VdbeAddOp(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+3);
   616    621         sqlite3VdbeOp3(v, OP_MakeRecord, 1, 0, "n", P3_STATIC);
   617    622         sqlite3VdbeAddOp(v, OP_String8, 0, 0);
................................................................................
   621    626       case SRT_Exists:
   622    627       case SRT_Mem: {
   623    628         assert( nColumn==1 );
   624    629         sqlite3VdbeAddOp(v, OP_MemStore, iParm, 1);
   625    630         sqlite3VdbeAddOp(v, OP_Goto, 0, end1);
   626    631         break;
   627    632       }
          633  +#endif
   628    634       case SRT_Callback:
   629    635       case SRT_Subroutine: {
   630    636         int i;
   631    637         sqlite3VdbeAddOp(v, OP_Integer, p->pEList->nExpr, 0);
   632    638         sqlite3VdbeAddOp(v, OP_Pull, 1, 0);
   633    639         for(i=0; i<nColumn; i++){
   634    640           sqlite3VdbeAddOp(v, OP_Column, -1-i, i);
................................................................................
   688    694         if( iCol<0 ){
   689    695           zType = "INTEGER";
   690    696         }else{
   691    697           zType = pTab->aCol[iCol].zType;
   692    698         }
   693    699         break;
   694    700       }
          701  +#ifndef SQLITE_OMIT_SUBQUERY
   695    702       case TK_SELECT: {
   696    703         Select *pS = pExpr->pSelect;
   697    704         zType = columnType(pParse, pS->pSrc, pS->pEList->a[0].pExpr); 
   698    705         break;
   699    706       }
          707  +#endif
   700    708       default:
   701    709         zType = 0;
   702    710     }
   703    711     
   704    712     return zType;
   705    713   }
   706    714   
................................................................................
   799    807         sprintf(zName, "column%d", i+1);
   800    808         sqlite3VdbeSetColName(v, i, zName, 0);
   801    809       }
   802    810     }
   803    811     generateColumnTypes(pParse, pTabList, pEList);
   804    812   }
   805    813   
          814  +#ifndef SQLITE_OMIT_COMPOUND_SELECT
   806    815   /*
   807    816   ** Name of the connection operator, used for error messages.
   808    817   */
   809    818   static const char *selectOpName(int id){
   810    819     char *z;
   811    820     switch( id ){
   812    821       case TK_ALL:       z = "UNION ALL";   break;
   813    822       case TK_INTERSECT: z = "INTERSECT";   break;
   814    823       case TK_EXCEPT:    z = "EXCEPT";      break;
   815    824       default:           z = "UNION";       break;
   816    825     }
   817    826     return z;
   818    827   }
          828  +#endif /* SQLITE_OMIT_COMPOUND_SELECT */
   819    829   
   820    830   /*
   821    831   ** Forward declaration
   822    832   */
   823    833   static int prepSelectStmt(Parse*, Select*);
   824    834   
   825    835   /*
................................................................................
   954    964       if( pFrom->pTab!=0 ){
   955    965         /* This statement has already been prepared.  There is no need
   956    966         ** to go further. */
   957    967         assert( i==0 );
   958    968         return 0;
   959    969       }
   960    970       if( pFrom->zName==0 ){
          971  +#ifndef SQLITE_OMIT_SUBQUERY
   961    972         /* A sub-query in the FROM clause of a SELECT */
   962    973         assert( pFrom->pSelect!=0 );
   963    974         if( pFrom->zAlias==0 ){
   964    975           pFrom->zAlias =
   965    976             sqlite3MPrintf("sqlite_subquery_%p_", (void*)pFrom->pSelect);
   966    977         }
   967    978         pFrom->pTab = pTab = 
................................................................................
   970    981           return 1;
   971    982         }
   972    983         /* The isTransient flag indicates that the Table structure has been
   973    984         ** dynamically allocated and may be freed at any time.  In other words,
   974    985         ** pTab is not pointing to a persistent table structure that defines
   975    986         ** part of the schema. */
   976    987         pTab->isTransient = 1;
          988  +#endif
   977    989       }else{
   978    990         /* An ordinary table or view name in the FROM clause */
   979    991         pFrom->pTab = pTab = 
   980    992           sqlite3LocateTable(pParse,pFrom->zName,pFrom->zDatabase);
   981    993         if( pTab==0 ){
   982    994           return 1;
   983    995         }
          996  +#ifndef SQLITE_OMIT_VIEW
   984    997         if( pTab->pSelect ){
   985    998           /* We reach here if the named table is a really a view */
   986    999           if( sqlite3ViewGetColumnNames(pParse, pTab) ){
   987   1000             return 1;
   988   1001           }
   989   1002           /* If pFrom->pSelect!=0 it means we are dealing with a
   990   1003           ** view within a view.  The SELECT structure has already been
................................................................................
   991   1004           ** copied by the outer view so we can skip the copy step here
   992   1005           ** in the inner view.
   993   1006           */
   994   1007           if( pFrom->pSelect==0 ){
   995   1008             pFrom->pSelect = sqlite3SelectDup(pTab->pSelect);
   996   1009           }
   997   1010         }
         1011  +#endif
   998   1012       }
   999   1013     }
  1000   1014   
  1001   1015     /* Process NATURAL keywords, and ON and USING clauses of joins.
  1002   1016     */
  1003   1017     if( sqliteProcessJoin(pParse, p) ) return 1;
  1004   1018   
................................................................................
  1143   1157           sqlite3SelectUnbind(pItem->pSelect);
  1144   1158         }
  1145   1159       }
  1146   1160     }
  1147   1161   }
  1148   1162   #endif
  1149   1163   
         1164  +#ifndef SQLITE_OMIT_COMPOUND_SELECT
  1150   1165   /*
  1151   1166   ** This routine associates entries in an ORDER BY expression list with
  1152   1167   ** columns in a result.  For each ORDER BY expression, the opcode of
  1153   1168   ** the top-level node is changed to TK_COLUMN and the iColumn value of
  1154   1169   ** the top-level node is filled in with column number and the iTable
  1155   1170   ** value of the top-level node is filled with iTable parameter.
  1156   1171   **
................................................................................
  1225   1240           "ORDER BY term number %d does not match any result column", i+1);
  1226   1241         nErr++;
  1227   1242         break;
  1228   1243       }
  1229   1244     }
  1230   1245     return nErr;  
  1231   1246   }
         1247  +#endif /* #ifndef SQLITE_OMIT_COMPOUND_SELECT */
  1232   1248   
  1233   1249   /*
  1234   1250   ** Get a VDBE for the given parser context.  Create a new one if necessary.
  1235   1251   ** If an error occurs, return NULL and leave a message in pParse.
  1236   1252   */
  1237   1253   Vdbe *sqlite3GetVdbe(Parse *pParse){
  1238   1254     Vdbe *v = pParse->pVdbe;
................................................................................
  2372   2388     pEList = p->pEList;
  2373   2389     if( pEList==0 ) goto select_end;
  2374   2390   
  2375   2391     /* If writing to memory or generating a set
  2376   2392     ** only a single column may be output.
  2377   2393     */
  2378   2394     assert( eDest!=SRT_Exists || pEList->nExpr==1 );
         2395  +#ifndef SQLITE_OMIT_SUBQUERY
  2379   2396     if( (eDest==SRT_Mem || eDest==SRT_Set) && pEList->nExpr>1 ){
  2380   2397       sqlite3ErrorMsg(pParse, "only a single result allowed for "
  2381   2398          "a SELECT that is part of an expression");
  2382   2399       goto select_end;
  2383   2400     }
         2401  +#endif
  2384   2402   
  2385   2403     /* ORDER BY is ignored for some destinations.
  2386   2404     */
  2387   2405     switch( eDest ){
  2388   2406       case SRT_Union:
  2389   2407       case SRT_Except:
  2390   2408       case SRT_Discard:
................................................................................
  2703   2721     /* If there is an ORDER BY clause, then we need to sort the results
  2704   2722     ** and send them to the callback one by one.
  2705   2723     */
  2706   2724     if( pOrderBy ){
  2707   2725       generateSortTail(pParse, p, v, pEList->nExpr, eDest, iParm);
  2708   2726     }
  2709   2727   
         2728  +#ifndef SQLITE_OMIT_SUBQUERY
  2710   2729     /* If this was a subquery, we have now converted the subquery into a
  2711   2730     ** temporary table.  So delete the subquery structure from the parent
  2712   2731     ** to prevent this subquery from being evaluated again and to force the
  2713   2732     ** the use of the temporary table.
  2714   2733     */
  2715   2734     if( pParent ){
  2716   2735       assert( pParent->pSrc->nSrc>parentTab );
  2717   2736       assert( pParent->pSrc->a[parentTab].pSelect==p );
  2718   2737       sqlite3SelectDelete(p);
  2719   2738       pParent->pSrc->a[parentTab].pSelect = 0;
  2720   2739     }
         2740  +#endif
  2721   2741   
  2722   2742     /* The SELECT was successfully coded.   Set the return code to 0
  2723   2743     ** to indicate no errors.
  2724   2744     */
  2725   2745     rc = 0;
  2726   2746   
  2727   2747     /* Control jumps to here if an error is encountered above, or upon
  2728   2748     ** successful coding of the SELECT.
  2729   2749     */
  2730   2750   select_end:
  2731   2751     sqliteAggregateInfoReset(pParse);
  2732   2752     return rc;
  2733   2753   }

Changes to src/test3.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Code for testing the btree.c module in SQLite.  This code
    13     13   ** is not included in the SQLite library.  It is used for automated
    14     14   ** testing of the SQLite library.
    15     15   **
    16         -** $Id: test3.c,v 1.60 2005/01/20 05:24:33 danielk1977 Exp $
           16  +** $Id: test3.c,v 1.61 2005/01/21 08:13:15 danielk1977 Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "pager.h"
    20     20   #include "btree.h"
    21     21   #include "tcl.h"
    22     22   #include <stdlib.h>
    23     23   #include <string.h>
................................................................................
   542    542   
   543    543     if( argc!=2 ){
   544    544       Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
   545    545          " ID\"", 0);
   546    546       return TCL_ERROR;
   547    547     }
   548    548     pBt = sqlite3TextToPtr(argv[1]);
          549  +#ifdef SQLITE_DEBUG
   549    550     sqlite3pager_refdump(sqlite3BtreePager(pBt));
          551  +#endif
   550    552     return TCL_OK;
   551    553   }
   552    554   
   553    555   /*
   554    556   ** Usage:   btree_integrity_check ID ROOT ...
   555    557   **
   556    558   ** Look through every page of the given BTree file to verify correct

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.444 2005/01/20 22:48:48 drh Exp $
           46  +** $Id: vdbe.c,v 1.445 2005/01/21 08:13:15 danielk1977 Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
   676    676   
   677    677   /* Opcode: String8 * * P3
   678    678   **
   679    679   ** P3 points to a nul terminated UTF-8 string. This opcode is transformed
   680    680   ** into an OP_String before it is executed for the first time.
   681    681   */
   682    682   case OP_String8: {         /* same as TK_STRING */
          683  +#ifndef SQLITE_OMIT_UTF16
   683    684     pOp->opcode = OP_String;
   684    685   
   685    686     if( db->enc!=SQLITE_UTF8 && pOp->p3 ){
   686    687       pTos++;
   687    688       sqlite3VdbeMemSetStr(pTos, pOp->p3, -1, SQLITE_UTF8, SQLITE_STATIC);
   688    689       if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pTos, db->enc) ) goto no_mem;
   689    690       if( SQLITE_OK!=sqlite3VdbeMemDynamicify(pTos) ) goto no_mem;
................................................................................
   692    693       if( pOp->p3type==P3_DYNAMIC ){
   693    694         sqliteFree(pOp->p3);
   694    695       }
   695    696       pOp->p3type = P3_DYNAMIC;
   696    697       pOp->p3 = pTos->z;
   697    698       break;
   698    699     }
          700  +#endif
   699    701     /* Otherwise fall through to the next case, OP_String */
   700    702   }
   701    703     
   702    704   /* Opcode: String * * P3
   703    705   **
   704    706   ** The string value P3 is pushed onto the stack.  If P3==0 then a
   705    707   ** NULL is pushed onto the stack. P3 is assumed to be a nul terminated
................................................................................
   753    755       }
   754    756       pOp->p3type = P3_STATIC;
   755    757       pOp->p3 = "";
   756    758     }
   757    759   
   758    760     /* Fall through to the next case, OP_Blob. */
   759    761   }
   760         -#endif /* SQLITE_OMIT_BLOB_LITERAL */
   761    762   
   762    763   /* Opcode: Blob P1 * P3
   763    764   **
   764    765   ** P3 points to a blob of data P1 bytes long. Push this
   765    766   ** value onto the stack. This instruction is not coded directly
   766    767   ** by the compiler. Instead, the compiler layer specifies
   767    768   ** an OP_HexBlob opcode, with the hex string representation of
   768    769   ** the blob as P3. This opcode is transformed to an OP_Blob
   769         -** before execution (within the sqlite3_prepare() function).
          770  +** the first time it is executed.
   770    771   */
   771    772   case OP_Blob: {
   772    773     pTos++;
   773    774     sqlite3VdbeMemSetStr(pTos, pOp->p3, pOp->p1, 0, 0);
   774    775     break;
   775    776   }
          777  +#endif /* SQLITE_OMIT_BLOB_LITERAL */
   776    778   
   777    779   /* Opcode: Variable P1 * *
   778    780   **
   779    781   ** Push the value of variable P1 onto the stack.  A variable is
   780    782   ** an unknown in the original SQL string as handed to sqlite3_compile().
   781    783   ** Any occurance of the '?' character in the original SQL is considered
   782    784   ** a variable.  Variables in the SQL string are number from left to
................................................................................
  1748   1750         i64 payloadSize64;
  1749   1751         sqlite3BtreeKeySize(pCrsr, &payloadSize64);
  1750   1752         payloadSize = payloadSize64;
  1751   1753       }else{
  1752   1754         sqlite3BtreeDataSize(pCrsr, &payloadSize);
  1753   1755       }
  1754   1756       nField = pC->nField;
         1757  +#ifndef SQLITE_OMIT_TRIGGER
  1755   1758     }else if( pC->pseudoTable ){
  1756   1759       /* The record is the sole entry of a pseudo-table */
  1757   1760       payloadSize = pC->nData;
  1758   1761       zRec = pC->pData;
  1759   1762       pC->cacheValid = 0;
  1760   1763       assert( payloadSize==0 || zRec!=0 );
  1761   1764       nField = pC->nField;
  1762   1765       pCrsr = 0;
         1766  +#endif
  1763   1767     }else{
  1764   1768       zRec = 0;
  1765   1769       payloadSize = 0;
  1766   1770       pCrsr = 0;
  1767   1771       nField = 0;
  1768   1772     }
  1769   1773   
................................................................................
  2444   2448         pCx->intKey = 1;
  2445   2449         pCx->pIncrKey = &pCx->bogusIncrKey;
  2446   2450       }
  2447   2451     }
  2448   2452     break;
  2449   2453   }
  2450   2454   
         2455  +#ifndef SQLITE_OMIT_TRIGGER
  2451   2456   /* Opcode: OpenPseudo P1 * *
  2452   2457   **
  2453   2458   ** Open a new cursor that points to a fake table that contains a single
  2454   2459   ** row of data.  Any attempt to write a second row of data causes the
  2455   2460   ** first row to be deleted.  All data is deleted when the cursor is
  2456   2461   ** closed.
  2457   2462   **
................................................................................
  2465   2470     pCx = allocateCursor(p, i);
  2466   2471     if( pCx==0 ) goto no_mem;
  2467   2472     pCx->nullRow = 1;
  2468   2473     pCx->pseudoTable = 1;
  2469   2474     pCx->pIncrKey = &pCx->bogusIncrKey;
  2470   2475     break;
  2471   2476   }
         2477  +#endif
  2472   2478   
  2473   2479   /* Opcode: Close P1 * *
  2474   2480   **
  2475   2481   ** Close a cursor previously opened as P1.  If P1 is not
  2476   2482   ** currently open, this instruction is a no-op.
  2477   2483   */
  2478   2484   case OP_Close: {
................................................................................
  3016   3022       }
  3017   3023       if( pTos->flags & MEM_Null ){
  3018   3024         pTos->z = 0;
  3019   3025         pTos->n = 0;
  3020   3026       }else{
  3021   3027         assert( pTos->flags & (MEM_Blob|MEM_Str) );
  3022   3028       }
         3029  +#ifndef SQLITE_OMIT_TRIGGER
  3023   3030       if( pC->pseudoTable ){
  3024   3031         /* PutStrKey does not work for pseudo-tables.
  3025   3032         ** The following assert makes sure we are not trying to use
  3026   3033         ** PutStrKey on a pseudo-table
  3027   3034         */
  3028   3035         assert( pOp->opcode==OP_PutIntKey );
  3029   3036         sqliteFree(pC->pData);
................................................................................
  3037   3044           if( !pC->pData ) goto no_mem;
  3038   3045           memcpy(pC->pData, pTos->z, pC->nData);
  3039   3046           pC->pData[pC->nData] = 0;
  3040   3047           pC->pData[pC->nData+1] = 0;
  3041   3048         }
  3042   3049         pC->nullRow = 0;
  3043   3050       }else{
         3051  +#endif
  3044   3052         rc = sqlite3BtreeInsert(pC->pCursor, zKey, nKey, pTos->z, pTos->n);
         3053  +#ifndef SQLITE_OMIT_TRIGGER
  3045   3054       }
         3055  +#endif
         3056  +    
  3046   3057       pC->recnoIsValid = 0;
  3047   3058       pC->deferredMoveto = 0;
  3048   3059       pC->cacheValid = 0;
  3049   3060     }
  3050   3061     popStack(&pTos, 2);
  3051   3062     break;
  3052   3063   }
................................................................................
  3169   3180         pTos->z = z;
  3170   3181       }
  3171   3182       if( pC->keyAsData || pOp->opcode==OP_RowKey ){
  3172   3183         sqlite3BtreeKey(pCrsr, 0, n, pTos->z);
  3173   3184       }else{
  3174   3185         sqlite3BtreeData(pCrsr, 0, n, pTos->z);
  3175   3186       }
         3187  +#ifndef SQLITE_OMIT_TRIGGER
  3176   3188     }else if( pC->pseudoTable ){
  3177   3189       pTos->n = pC->nData;
  3178   3190       pTos->z = pC->pData;
  3179   3191       pTos->flags = MEM_Blob|MEM_Ephem;
         3192  +#endif
  3180   3193     }else{
  3181   3194       pTos->flags = MEM_Null;
  3182   3195     }
  3183   3196     break;
  3184   3197   }
  3185   3198   
  3186   3199   /* Opcode: Recno P1 * *
................................................................................
  3213   3226       v = keyToInt(v);
  3214   3227     }
  3215   3228     pTos->i = v;
  3216   3229     pTos->flags = MEM_Int;
  3217   3230     break;
  3218   3231   }
  3219   3232   
         3233  +#ifndef SQLITE_OMIT_COMPOUND_SELECT
  3220   3234   /* Opcode: FullKey P1 * *
  3221   3235   **
  3222   3236   ** Extract the complete key from the record that cursor P1 is currently
  3223   3237   ** pointing to and push the key onto the stack as a string.
  3224   3238   **
  3225   3239   ** Compare this opcode to Recno.  The Recno opcode extracts the first
  3226   3240   ** 4 bytes of the key and pushes those bytes onto the stack as an
................................................................................
  3261   3275       }
  3262   3276       sqlite3BtreeKey(pCrsr, 0, amt, z);
  3263   3277       pTos->z = z;
  3264   3278       pTos->n = amt;
  3265   3279     }
  3266   3280     break;
  3267   3281   }
         3282  +#endif
  3268   3283   
  3269   3284   /* Opcode: NullRow P1 * *
  3270   3285   **
  3271   3286   ** Move the cursor P1 to a null row.  Any OP_Column operations
  3272   3287   ** that occur while the cursor is on the null row will always push 
  3273   3288   ** a NULL onto the stack.
  3274   3289   */
................................................................................
  3933   3948     if( p->pList ){
  3934   3949       sqlite3VdbeKeylistFree(p->pList);
  3935   3950       p->pList = 0;
  3936   3951     }
  3937   3952     break;
  3938   3953   }
  3939   3954   
         3955  +#ifndef SQLITE_OMIT_TRIGGER
  3940   3956   /* Opcode: ContextPush * * * 
  3941   3957   **
  3942   3958   ** Save the current Vdbe context such that it can be restored by a ContextPop
  3943   3959   ** opcode. The context stores the last insert row id, the last statement change
  3944   3960   ** count, and the current statement change count.
  3945   3961   */
  3946   3962   case OP_ContextPush: {
................................................................................
  3973   3989     assert( p->contextStackTop>=0 );
  3974   3990     db->lastRowid = pContext->lastRowid;
  3975   3991     p->nChange = pContext->nChange;
  3976   3992     sqlite3VdbeKeylistFree(p->pList);
  3977   3993     p->pList = pContext->pList;
  3978   3994     break;
  3979   3995   }
         3996  +#endif /* #ifndef SQLITE_OMIT_TRIGGER */
  3980   3997   
  3981   3998   /* Opcode: SortPut * * *
  3982   3999   **
  3983   4000   ** The TOS is the key and the NOS is the data.  Pop both from the stack
  3984   4001   ** and put them on the sorter.  The key and data should have been
  3985   4002   ** made using the MakeRecord opcode.
  3986   4003   */

Changes to www/compile.tcl.

     1      1   #
     2      2   # Run this Tcl script to generate the compile.html file.
     3      3   #
     4         -set rcsid {$Id: compile.tcl,v 1.2 2004/11/20 08:17:18 danielk1977 Exp $ }
            4  +set rcsid {$Id: compile.tcl,v 1.3 2005/01/21 08:13:15 danielk1977 Exp $ }
     5      5   source common.tcl
     6      6   header {Compilation Options For SQLite}
     7      7   
     8      8   puts {
     9      9   <h1>Compilation Options For SQLite</h1>
    10     10   
    11     11   <p>
................................................................................
   201    201   
   202    202   <p><b>SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS</b><br>
   203    203   Defining this option omits pragmas for querying and modifying the 
   204    204   database schema version and user version from the build. Specifically, the 
   205    205   <a href="pragma.html#pragma_schema_version">schema_version</a> and
   206    206   <a href="pragma.html#pragma_user_version">user_version</a>
   207    207   pragmas are omitted.
          208  +
          209  +<p><b>SQLITE_OMIT_SUBQUERY</b><br>
          210  +<p>If defined, support for sub-selects and the IN() operator are omitted.
          211  +</p>
   208    212   
   209    213   <p><b>SQLITE_OMIT_TCL_VARIABLE</b><br>
   210    214   <p>If this macro is defined, then the special "$<variable-name>" syntax
   211    215   used to automatically bind SQL variables to TCL variables is omitted.
   212    216   </p>
   213    217   
   214    218   <p><b>SQLITE_OMIT_TRIGGER</b><br>