/ Check-in [fab4940d]
Login

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

Overview
Comment:Add the SQLITE_OMIT_TRUNCATE_OPTIMIZATION option. Other unrelated documentation enhancements. (CVS 5798)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:fab4940d54fd1e5459a3d0d9b64b491e6972fd8d
User & Date: drh 2008-10-10 23:48:26
Context
2008-10-11
15:20
Fix an assertion fault that occurs with SQLITE_THREADSAFE=0. (CVS 5799) check-in: 28bba42b user: drh tags: trunk
2008-10-10
23:48
Add the SQLITE_OMIT_TRUNCATE_OPTIMIZATION option. Other unrelated documentation enhancements. (CVS 5798) check-in: fab4940d user: drh tags: trunk
18:25
Further simplifications of the code for the LIMIT clause on an UPDATE or DELETE. Added a few test cases to wherelimit.test. (CVS 5797) check-in: 282c6a46 user: shane tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/delete.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   ** in order to generate code for DELETE FROM statements.
    14     14   **
    15         -** $Id: delete.c,v 1.181 2008/10/10 18:25:46 shane Exp $
           15  +** $Id: delete.c,v 1.182 2008/10/10 23:48:26 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** Look up every table that is named in pSrc.  If any table is not found,
    21     21   ** add an error message to pParse->zErrMsg and return NULL.  If all tables
    22     22   ** are found, return a pointer to the last table.
................................................................................
   360    360     ** we are counting rows.
   361    361     */
   362    362     if( db->flags & SQLITE_CountRows ){
   363    363       memCnt = ++pParse->nMem;
   364    364       sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt);
   365    365     }
   366    366   
          367  +#ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
   367    368     /* Special case: A DELETE without a WHERE clause deletes everything.
   368    369     ** It is easier just to erase the whole table.  Note, however, that
   369    370     ** this means that the row change count will be incorrect.
   370    371     */
   371    372     if( pWhere==0 && !triggers_exist && !IsVirtual(pTab) ){
   372    373       if( db->flags & SQLITE_CountRows ){
   373    374         /* If counting rows deleted, just count the total number of
................................................................................
   387    388           sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_STATIC);
   388    389         }
   389    390         for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
   390    391           assert( pIdx->pSchema==pTab->pSchema );
   391    392           sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);
   392    393         }
   393    394       }
   394         -  } 
          395  +  }else
          396  +#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
   395    397     /* The usual case: There is a WHERE clause so we have to scan through
   396    398     ** the table and pick which records to delete.
   397    399     */
   398         -  else{
          400  +  {
   399    401       int iRowid = ++pParse->nMem;    /* Used for storing rowid values. */
   400    402   
   401    403       /* Begin the database scan
   402    404       */
   403    405       pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0);
   404    406       if( pWInfo==0 ) goto delete_from_cleanup;
   405    407   

Changes to src/sqlite.h.in.

    26     26   ** on how SQLite interfaces are suppose to operate.
    27     27   **
    28     28   ** The name of this file under configuration management is "sqlite.h.in".
    29     29   ** The makefile makes some minor changes to this file (such as inserting
    30     30   ** the version number) and changes its name to "sqlite3.h" as
    31     31   ** part of the build process.
    32     32   **
    33         -** @(#) $Id: sqlite.h.in,v 1.402 2008/10/10 17:26:35 drh Exp $
           33  +** @(#) $Id: sqlite.h.in,v 1.403 2008/10/10 23:48:26 drh Exp $
    34     34   */
    35     35   #ifndef _SQLITE3_H_
    36     36   #define _SQLITE3_H_
    37     37   #include <stdarg.h>     /* Needed for the definition of va_list */
    38     38   
    39     39   /*
    40     40   ** Make sure we can call this stuff from C++.
................................................................................
   979    979   **
   980    980   ** When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
   981    981   ** If the option is unknown or SQLite is unable to set the option
   982    982   ** then this routine returns a non-zero [error code].
   983    983   **
   984    984   ** INVARIANTS:
   985    985   **
   986         -** {H14103} A successful invocation of sqlite3_config() shall return
   987         -**          SQLITE_OK.
          986  +** {H14103} A successful invocation of [sqlite3_config()] shall return
          987  +**          [SQLITE_OK].
   988    988   **
   989         -** {H14106} The sqlite3_config() interface shall return SQLITE_MISUSE
   990         -**          if it is invoked in between calls to sqlite3_initialize() and
   991         -**          sqlite3_shutdown().
          989  +** {H14106} The [sqlite3_config()] interface shall return [SQLITE_MISUSE]
          990  +**          if it is invoked in between calls to [sqlite3_initialize()] and
          991  +**          [sqlite3_shutdown()].
   992    992   **
   993         -** {H14120} A successful call to sqlite3_config(SQLITE_CONFIG_SINGLETHREAD)
          993  +** {H14120} A successful call to [sqlite3_config]([SQLITE_CONFIG_SINGLETHREAD])
   994    994   **          shall set the default [threading mode] to Single-thread.
   995    995   **
   996         -** {H14123} A successful call to sqlite3_config(SQLITE_CONFIG_MULTITHREAD)
          996  +** {H14123} A successful call to [sqlite3_config]([SQLITE_CONFIG_MULTITHREAD])
   997    997   **          shall set the default [threading mode] to Multi-thread.
   998    998   **
   999         -** {H14126} A successful call to sqlite3_config(SQLITE_CONFIG_SERIALIZED)
          999  +** {H14126} A successful call to [sqlite3_config]([SQLITE_CONFIG_SERIALIZED])
  1000   1000   **          shall set the default [threading mode] to Serialized.
  1001   1001   **
  1002         -** {H14129} A successful call to sqlite3_config(SQLITE_CONFIG_MUTEX,X)
         1002  +** {H14129} A successful call to [sqlite3_config]([SQLITE_CONFIG_MUTEX],X)
  1003   1003   **          where X is a pointer to an initialized [sqlite3_mutex_methods]
  1004   1004   **          object shall cause all subsequent mutex operations performed
  1005   1005   **          by SQLite to use the mutex methods that were present in X
  1006         -**          during the call to sqlite3_config().
         1006  +**          during the call to [sqlite3_config()].
  1007   1007   **
  1008         -** {H14132} A successful call to sqlite3_config(SQLITE_CONFIG_GETMUTEX,X)
         1008  +** {H14132} A successful call to [sqlite3_config]([SQLITE_CONFIG_GETMUTEX],X)
  1009   1009   **          where X is a pointer to an [sqlite3_mutex_methods] object 
  1010   1010   **          shall overwrite the content of [sqlite3_mutex_methods] object
  1011   1011   **          with the mutex methods currently in use by SQLite.
  1012   1012   **
  1013         -** {H14135} A successful call to sqlite3_config(SQLITE_CONFIG_MALLOC,M)
         1013  +** {H14135} A successful call to [sqlite3_config]([SQLITE_CONFIG_MALLOC],M)
  1014   1014   **          where M is a pointer to an initialized [sqlite3_mem_methods]
  1015   1015   **          object shall cause all subsequent memory allocation operations
  1016   1016   **          performed by SQLite to use the methods that were present in 
  1017         -**          M during the call to sqlite3_config().
         1017  +**          M during the call to [sqlite3_config()].
  1018   1018   **
  1019         -** {H14138} A successful call to sqlite3_config(SQLITE_CONFIG_GETMALLOC,M)
         1019  +** {H14138} A successful call to [sqlite3_config]([SQLITE_CONFIG_GETMALLOC],M)
  1020   1020   **          where M is a pointer to an [sqlite3_mem_methods] object shall
  1021   1021   **          overwrite the content of [sqlite3_mem_methods] object with 
  1022   1022   **          the memory allocation methods currently in use by
  1023   1023   **          SQLite.
  1024   1024   **
  1025         -** {H14141} A successful call to sqlite3_config(SQLITE_CONFIG_MEMSTATUS,1)
         1025  +** {H14141} A successful call to [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],1)
  1026   1026   **          shall enable the memory allocation status collection logic.
  1027   1027   **
  1028         -** {H14144} A successful call to sqlite3_config(SQLITE_CONFIG_MEMSTATUS,0)
         1028  +** {H14144} A successful call to [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],0)
  1029   1029   **          shall disable the memory allocation status collection logic.
  1030   1030   **
  1031   1031   ** {H14147} The memory allocation status collection logic shall be
  1032   1032   **          enabled by default.
  1033   1033   **
  1034         -** {H14150} A successful call to sqlite3_config(SQLITE_CONFIG_SCRATCH,S,Z,N)
         1034  +** {H14150} A successful call to [sqlite3_config]([SQLITE_CONFIG_SCRATCH],S,Z,N)
  1035   1035   **          where Z and N are non-negative integers and 
  1036   1036   **          S is a pointer to an aligned memory buffer not less than
  1037   1037   **          Z*N bytes in size shall cause S to be used by the
  1038   1038   **          [scratch memory allocator] for as many as N simulataneous
  1039   1039   **          allocations each of size Z.
  1040   1040   **
  1041         -** {H14153} A successful call to sqlite3_config(SQLITE_CONFIG_SCRATCH,S,Z,N)
         1041  +** {H14153} A successful call to [sqlite3_config]([SQLITE_CONFIG_SCRATCH],S,Z,N)
  1042   1042   **          where S is a NULL pointer shall disable the
  1043   1043   **          [scratch memory allocator].
  1044   1044   **
  1045         -** {H14156} A successful call to sqlite3_config(SQLITE_CONFIG_PAGECACHE,S,Z,N)
         1045  +** {H14156} A successful call to
         1046  +**          [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],S,Z,N)
  1046   1047   **          where Z and N are non-negative integers and 
  1047   1048   **          S is a pointer to an aligned memory buffer not less than
  1048   1049   **          Z*N bytes in size shall cause S to be used by the
  1049   1050   **          [pagecache memory allocator] for as many as N simulataneous
  1050   1051   **          allocations each of size Z.
  1051   1052   **
  1052         -** {H14159} A successful call to sqlite3_config(SQLITE_CONFIG_PAGECACHE,S,Z,N)
         1053  +** {H14159} A successful call to
         1054  +**          [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],S,Z,N)
  1053   1055   **          where S is a NULL pointer shall disable the
  1054   1056   **          [pagecache memory allocator].
  1055   1057   **
  1056         -** {H14162} A successful call to sqlite3_config(SQLITE_CONFIG_HEAP,H,Z,N)
         1058  +** {H14162} A successful call to [sqlite3_config]([SQLITE_CONFIG_HEAP],H,Z,N)
  1057   1059   **          where Z and N are non-negative integers and 
  1058   1060   **          H is a pointer to an aligned memory buffer not less than
  1059   1061   **          Z bytes in size shall enable the [memsys5] memory allocator
  1060   1062   **          and cause it to use buffer S as its memory source and to use
  1061   1063   **          a minimum allocation size of N.
  1062   1064   **
  1063         -** {H14165} A successful call to sqlite3_config(SQLITE_CONFIG_HEAP,H,Z,N)
         1065  +** {H14165} A successful call to [sqlite3_config]([SQLITE_CONFIG_HEAP],H,Z,N)
  1064   1066   **          where H is a NULL pointer shall disable the
  1065   1067   **          [memsys5] memory allocator.
  1066   1068   **
  1067         -** {H14168} A successful call to sqlite3_config(SQLITE_CONFIG_LOOKASIZE,Z,N)
         1069  +** {H14168} A successful call to [sqlite3_config]([SQLITE_CONFIG_LOOKASIDE],Z,N)
  1068   1070   **          shall cause the default [lookaside memory allocator] configuration
  1069   1071   **          for new [database connections] to be N slots of Z bytes each.
  1070   1072   */
  1071   1073   SQLITE_EXPERIMENTAL int sqlite3_config(int, ...);
  1072   1074   
  1073   1075   /*
  1074         -** CAPI3REF: Configure database connections  {H10180} <S20000>
         1076  +** CAPI3REF: Configure database connections  {H14200} <S20000>
  1075   1077   ** EXPERIMENTAL
  1076   1078   **
  1077   1079   ** The sqlite3_db_config() interface is used to make configuration
  1078   1080   ** changes to a [database connection].  The interface is similar to
  1079   1081   ** [sqlite3_config()] except that the changes apply to a single
  1080   1082   ** [database connection] (specified in the first argument).  The
  1081   1083   ** sqlite3_db_config() interface can only be used immediately after
................................................................................
  1084   1086   **
  1085   1087   ** The second argument to sqlite3_db_config(D,V,...)  is the
  1086   1088   ** configuration verb - an integer code that indicates what
  1087   1089   ** aspect of the [database connection] is being configured.
  1088   1090   ** The only choice for this value is [SQLITE_DBCONFIG_LOOKASIDE].
  1089   1091   ** New verbs are likely to be added in future releases of SQLite.
  1090   1092   ** Additional arguments depend on the verb.
         1093  +**
         1094  +** INVARIANTS:
         1095  +**
         1096  +** {H14203} A call to [sqlite3_db_config(D,V,...)] shall return [SQLITE_OK]
         1097  +**          if and only if the call is successful.
         1098  +**
         1099  +** {H14206} If one or more slots of the [lookaside memory allocator] for
         1100  +**          [database connection] D are in use, then a call to
         1101  +**          [sqlite3_db_config](D,[SQLITE_DBCONFIG_LOOKASIDE],...) shall
         1102  +**          fail with an [SQLITE_BUSY] return code.
         1103  +**
         1104  +** {H14209} A successful call to 
         1105  +**          [sqlite3_db_config](D,[SQLITE_DBCONFIG_LOOKASIDE],B,Z,N) where
         1106  +**          D is an open [database connection] and Z and N are positive
         1107  +**          integers and B is an aligned buffer at least Z*N bytes in size
         1108  +**          shall cause the [lookaside memory allocator] for D to use buffer B 
         1109  +**          with N slots of Z bytes each.
         1110  +**
         1111  +** {H14212} A successful call to 
         1112  +**          [sqlite3_db_config](D,[SQLITE_DBCONFIG_LOOKASIDE],B,Z,N) where
         1113  +**          D is an open [database connection] and Z and N are positive
         1114  +**          integers and B is NULL pointer shall cause the
         1115  +**          [lookaside memory allocator] for D to a obtain Z*N byte buffer
         1116  +**          from the primary memory allocator and use that buffer
         1117  +**          with N lookaside slots of Z bytes each.
         1118  +**
         1119  +** {H14215} A successful call to 
         1120  +**          [sqlite3_db_config](D,[SQLITE_DBCONFIG_LOOKASIDE],B,Z,N) where
         1121  +**          D is an open [database connection] and Z and N are zero shall
         1122  +**          disable the [lookaside memory allocator] for D.
         1123  +**
         1124  +**
  1091   1125   */
  1092   1126   SQLITE_EXPERIMENTAL int sqlite3_db_config(sqlite3*, int op, ...);
  1093   1127   
  1094   1128   /*
  1095   1129   ** CAPI3REF: Memory Allocation Routines {H10155} <S20120>
  1096   1130   ** EXPERIMENTAL
  1097   1131   **
................................................................................
  1349   1383   ** integer key called the "rowid". The rowid is always available
  1350   1384   ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
  1351   1385   ** names are not also used by explicitly declared columns. If
  1352   1386   ** the table has a column of type INTEGER PRIMARY KEY then that column
  1353   1387   ** is another alias for the rowid.
  1354   1388   **
  1355   1389   ** This routine returns the rowid of the most recent
  1356         -** successful INSERT into the database from the [database connection]
  1357         -** in the first argument.  If no successful INSERTs
         1390  +** successful [INSERT] into the database from the [database connection]
         1391  +** in the first argument.  If no successful [INSERT]s
  1358   1392   ** have ever occurred on that database connection, zero is returned.
  1359   1393   **
  1360         -** If an INSERT occurs within a trigger, then the rowid of the inserted
         1394  +** If an [INSERT] occurs within a trigger, then the rowid of the inserted
  1361   1395   ** row is returned by this routine as long as the trigger is running.
  1362   1396   ** But once the trigger terminates, the value returned by this routine
  1363   1397   ** reverts to the last value inserted before the trigger fired.
  1364   1398   **
  1365         -** An INSERT that fails due to a constraint violation is not a
  1366         -** successful INSERT and does not change the value returned by this
         1399  +** An [INSERT] that fails due to a constraint violation is not a
         1400  +** successful [INSERT] and does not change the value returned by this
  1367   1401   ** routine.  Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
  1368   1402   ** and INSERT OR ABORT make no changes to the return value of this
  1369   1403   ** routine when their insertion fails.  When INSERT OR REPLACE
  1370   1404   ** encounters a constraint violation, it does not fail.  The
  1371   1405   ** INSERT continues to completion after deleting rows that caused
  1372   1406   ** the constraint problem so INSERT OR REPLACE will always change
  1373   1407   ** the return value of this interface.
  1374   1408   **
  1375         -** For the purposes of this routine, an INSERT is considered to
         1409  +** For the purposes of this routine, an [INSERT] is considered to
  1376   1410   ** be successful even if it is subsequently rolled back.
  1377   1411   **
  1378   1412   ** INVARIANTS:
  1379   1413   **
  1380         -** {H12221} The [sqlite3_last_insert_rowid()] function returns the rowid
  1381         -**          of the most recent successful INSERT performed on the same
         1414  +** {H12221} The [sqlite3_last_insert_rowid()] function shall return the rowid
         1415  +**          of the most recent successful [INSERT] performed on the same
  1382   1416   **          [database connection] and within the same or higher level
  1383         -**          trigger context, or zero if there have been no qualifying inserts.
         1417  +**          trigger context, or zero if there have been no qualifying
         1418  +**          [INSERT] statements.
  1384   1419   **
  1385         -** {H12223} The [sqlite3_last_insert_rowid()] function returns the
         1420  +** {H12223} The [sqlite3_last_insert_rowid()] function shall return the
  1386   1421   **          same value when called from the same trigger context
  1387         -**          immediately before and after a ROLLBACK.
         1422  +**          immediately before and after a [ROLLBACK].
  1388   1423   **
  1389   1424   ** ASSUMPTIONS:
  1390   1425   **
  1391         -** {A12232} If a separate thread performs a new INSERT on the same
         1426  +** {A12232} If a separate thread performs a new [INSERT] on the same
  1392   1427   **          database connection while the [sqlite3_last_insert_rowid()]
  1393   1428   **          function is running and thus changes the last insert rowid,
  1394   1429   **          then the value returned by [sqlite3_last_insert_rowid()] is
  1395   1430   **          unpredictable and might not equal either the old or the new
  1396   1431   **          last insert rowid.
  1397   1432   */
  1398   1433   sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
................................................................................
  1399   1434   
  1400   1435   /*
  1401   1436   ** CAPI3REF: Count The Number Of Rows Modified {H12240} <S10600>
  1402   1437   **
  1403   1438   ** This function returns the number of database rows that were changed
  1404   1439   ** or inserted or deleted by the most recently completed SQL statement
  1405   1440   ** on the [database connection] specified by the first parameter.
  1406         -** Only changes that are directly specified by the INSERT, UPDATE,
  1407         -** or DELETE statement are counted.  Auxiliary changes caused by
         1441  +** Only changes that are directly specified by the [INSERT], [UPDATE],
         1442  +** or [DELETE] statement are counted.  Auxiliary changes caused by
  1408   1443   ** triggers are not counted. Use the [sqlite3_total_changes()] function
  1409   1444   ** to find the total number of changes including changes caused by triggers.
  1410   1445   **
  1411   1446   ** A "row change" is a change to a single row of a single table
  1412   1447   ** caused by an INSERT, DELETE, or UPDATE statement.  Rows that
  1413   1448   ** are changed as side effects of REPLACE constraint resolution,
  1414   1449   ** rollback, ABORT processing, DROP TABLE, or by any other
................................................................................
  1434   1469   ** the sqlite3_changes() interface can be called to find the number of
  1435   1470   ** changes in the most recently completed INSERT, UPDATE, or DELETE
  1436   1471   ** statement within the body of the same trigger.
  1437   1472   ** However, the number returned does not include changes
  1438   1473   ** caused by subtriggers since those have their own context.
  1439   1474   **
  1440   1475   ** SQLite implements the command "DELETE FROM table" without a WHERE clause
  1441         -** by dropping and recreating the table.  (This is much faster than going
  1442         -** through and deleting individual elements from the table.)  Because of this
         1476  +** by dropping and recreating the table.  Doing so is much faster than going
         1477  +** through and deleting individual elements from the table.  Because of this
  1443   1478   ** optimization, the deletions in "DELETE FROM table" are not row changes and
  1444   1479   ** will not be counted by the sqlite3_changes() or [sqlite3_total_changes()]
  1445   1480   ** functions, regardless of the number of elements that were originally
  1446   1481   ** in the table.  To get an accurate count of the number of rows deleted, use
  1447         -** "DELETE FROM table WHERE 1" instead.
         1482  +** "DELETE FROM table WHERE 1" instead.  Or recompile using the
         1483  +** [SQLITE_OMIT_TRUNCATE_OPTIMIZATION] compile-time option to disable the
         1484  +** optimization on all queries.
  1448   1485   **
  1449   1486   ** INVARIANTS:
  1450   1487   **
  1451   1488   ** {H12241} The [sqlite3_changes()] function shall return the number of
  1452   1489   **          row changes caused by the most recent INSERT, UPDATE,
  1453   1490   **          or DELETE statement on the same database connection and
  1454   1491   **          within the same or higher trigger context, or zero if there have
................................................................................
  1482   1519   ** SQLite implements the command "DELETE FROM table" without a WHERE clause
  1483   1520   ** by dropping and recreating the table.  (This is much faster than going
  1484   1521   ** through and deleting individual elements from the table.)  Because of this
  1485   1522   ** optimization, the deletions in "DELETE FROM table" are not row changes and
  1486   1523   ** will not be counted by the sqlite3_changes() or [sqlite3_total_changes()]
  1487   1524   ** functions, regardless of the number of elements that were originally
  1488   1525   ** in the table.  To get an accurate count of the number of rows deleted, use
  1489         -** "DELETE FROM table WHERE 1" instead.
         1526  +** "DELETE FROM table WHERE 1" instead.   Or recompile using the
         1527  +** [SQLITE_OMIT_TRUNCATE_OPTIMIZATION] compile-time option to disable the
         1528  +** optimization on all queries.
  1490   1529   **
  1491   1530   ** See also the [sqlite3_changes()] interface.
  1492   1531   **
  1493   1532   ** INVARIANTS:
  1494   1533   **
  1495   1534   ** {H12261} The [sqlite3_total_changes()] returns the total number
  1496   1535   **          of row changes caused by INSERT, UPDATE, and/or DELETE

Changes to src/test_config.c.

    12     12   ** 
    13     13   ** This file contains code used for testing the SQLite system.
    14     14   ** None of the code in this file goes into a deliverable build.
    15     15   ** 
    16     16   ** The focus of this file is providing the TCL testing layer
    17     17   ** access to compile-time constants.
    18     18   **
    19         -** $Id: test_config.c,v 1.39 2008/10/10 04:34:16 shane Exp $
           19  +** $Id: test_config.c,v 1.40 2008/10/10 23:48:26 drh Exp $
    20     20   */
    21     21   
    22     22   #include "sqliteLimit.h"
    23     23   
    24     24   #include "sqliteInt.h"
    25     25   #include "tcl.h"
    26     26   #include <stdlib.h>
................................................................................
   397    397   #else
   398    398     Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
   399    399   #endif
   400    400   
   401    401     Tcl_SetVar2(interp, "sqlite_options", "threadsafe", 
   402    402         STRINGVALUE(SQLITE_THREADSAFE), TCL_GLOBAL_ONLY);
   403    403     assert( sqlite3_threadsafe()==SQLITE_THREADSAFE );
          404  +
          405  +#ifdef SQLITE_OMIT_TEMPDB
          406  +  Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY);
          407  +#else
          408  +  Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY);
          409  +#endif
   404    410   
   405    411   #ifdef SQLITE_OMIT_TRACE
   406    412     Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY);
   407    413   #else
   408    414     Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY);
   409    415   #endif
   410    416   
   411    417   #ifdef SQLITE_OMIT_TRIGGER
   412    418     Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY);
   413    419   #else
   414    420     Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY);
   415    421   #endif
   416    422   
   417         -#ifdef SQLITE_OMIT_TEMPDB
   418         -  Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY);
          423  +#ifdef SQLITE_OMIT_TRUCATE_OPTIMIZATION
          424  +  Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY);
   419    425   #else
   420         -  Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY);
          426  +  Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
   421    427   #endif
   422    428   
   423    429   #ifdef SQLITE_OMIT_UTF16
   424    430     Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
   425    431   #else
   426    432     Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY);
   427    433   #endif