/ Check-in [5789aab8]
Login

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

Overview
Comment:Merge recent changes from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | rowvalue
Files: files | file ages | folders
SHA1: 5789aab8ef59ae1cdfdae123b078ee03da6e08ed
User & Date: drh 2016-08-25 22:31:44
Context
2016-08-26
01:02
Remove an unreachable branch from sqlite3ExprAffinity() check-in: 9d96f614 user: drh tags: rowvalue
2016-08-25
22:31
Merge recent changes from trunk. check-in: 5789aab8 user: drh tags: rowvalue
22:06
Fix the sqlite3_trace_v2() interface so that it goes disabled if either the callback or mask arguments are zero, in accordance with the documentation. check-in: 37e6c54b user: drh tags: trunk
21:14
Refactor the sqlite3ExprCodeIN() routine for improved maintainability. check-in: b56705ae user: drh tags: rowvalue
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

    19     19   # <</mark>>
    20     20   
    21     21   # Set this non-0 to enable full warnings (-W4, etc) when compiling.
    22     22   #
    23     23   !IFNDEF USE_FULLWARN
    24     24   USE_FULLWARN = 0
    25     25   !ENDIF
           26  +
           27  +# Set this non-0 to enable full runtime error checks (-RTC1, etc).  This
           28  +# has no effect if (any) optimizations are enabled.
           29  +#
           30  +!IFNDEF USE_RUNTIME_CHECKS
           31  +USE_RUNTIME_CHECKS = 0
           32  +!ENDIF
    26     33   
    27     34   # Set this non-0 to use "stdcall" calling convention for the core library
    28     35   # and shell executable.
    29     36   #
    30     37   !IFNDEF USE_STDCALL
    31     38   USE_STDCALL = 0
    32     39   !ENDIF
................................................................................
   831    838   
   832    839   # If optimizations are enabled or disabled (either implicitly or
   833    840   # explicitly), add the necessary flags.
   834    841   #
   835    842   !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
   836    843   TCC = $(TCC) -Od
   837    844   BCC = $(BCC) -Od
          845  +!IF $(USE_RUNTIME_CHECKS)!=0
          846  +TCC = $(TCC) -RTC1
          847  +BCC = $(BCC) -RTC1
          848  +!ENDIF
   838    849   !ELSEIF $(OPTIMIZATIONS)>=3
   839    850   TCC = $(TCC) -Ox
   840    851   BCC = $(BCC) -Ox
   841    852   !ELSEIF $(OPTIMIZATIONS)==2
   842    853   TCC = $(TCC) -O2
   843    854   BCC = $(BCC) -O2
   844    855   !ELSEIF $(OPTIMIZATIONS)==1

Changes to autoconf/Makefile.msc.

   452    452   # also be noted here that building any target with these "stdcall" options
   453    453   # will most likely fail if the Tcl library is also required.  This is due
   454    454   # to how the Tcl library functions are declared and exported (i.e. without
   455    455   # an explicit calling convention, which results in "cdecl").
   456    456   #
   457    457   !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
   458    458   !IF "$(PLATFORM)"=="x86"
   459         -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
   460         -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
          459  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          460  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
   461    461   !ELSE
   462    462   !IFNDEF PLATFORM
   463         -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
   464         -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
          463  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          464  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
   465    465   !ELSE
   466    466   CORE_CCONV_OPTS =
   467    467   SHELL_CCONV_OPTS =
   468    468   !ENDIF
   469    469   !ENDIF
   470    470   !ELSE
   471    471   CORE_CCONV_OPTS =

Changes to src/build.c.

   149    149       while( sqlite3VdbeDeletePriorOpcode(v, OP_Close) ){}
   150    150       sqlite3VdbeAddOp0(v, OP_Halt);
   151    151   
   152    152   #if SQLITE_USER_AUTHENTICATION
   153    153       if( pParse->nTableLock>0 && db->init.busy==0 ){
   154    154         sqlite3UserAuthInit(db);
   155    155         if( db->auth.authLevel<UAUTH_User ){
   156         -        pParse->rc = SQLITE_AUTH_USER;
   157    156           sqlite3ErrorMsg(pParse, "user not authenticated");
          157  +        pParse->rc = SQLITE_AUTH_USER;
   158    158           return;
   159    159         }
   160    160       }
   161    161   #endif
   162    162   
   163    163       /* The cookie mask contains one bit for each database file open.
   164    164       ** (Bit 0 is for main, bit 1 is for temp, and so forth.)  Bits are

Changes to src/main.c.

   785    785   ** Configuration settings for an individual database connection
   786    786   */
   787    787   int sqlite3_db_config(sqlite3 *db, int op, ...){
   788    788     va_list ap;
   789    789     int rc;
   790    790     va_start(ap, op);
   791    791     switch( op ){
          792  +    case SQLITE_DBCONFIG_MAINDBNAME: {
          793  +      db->aDb[0].zDbSName = va_arg(ap,char*);
          794  +      rc = SQLITE_OK;
          795  +      break;
          796  +    }
   792    797       case SQLITE_DBCONFIG_LOOKASIDE: {
   793    798         void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */
   794    799         int sz = va_arg(ap, int);       /* IMP: R-47871-25994 */
   795    800         int cnt = va_arg(ap, int);      /* IMP: R-04460-53386 */
   796    801         rc = setupLookaside(db, pBuf, sz, cnt);
   797    802         break;
   798    803       }
................................................................................
  1834   1839   ){
  1835   1840   #ifdef SQLITE_ENABLE_API_ARMOR
  1836   1841     if( !sqlite3SafetyCheckOk(db) ){
  1837   1842       return SQLITE_MISUSE_BKPT;
  1838   1843     }
  1839   1844   #endif
  1840   1845     sqlite3_mutex_enter(db->mutex);
         1846  +  if( mTrace==0 ) xTrace = 0;
         1847  +  if( xTrace==0 ) mTrace = 0;
  1841   1848     db->mTrace = mTrace;
  1842   1849     db->xTrace = xTrace;
  1843   1850     db->pTraceArg = pArg;
  1844   1851     sqlite3_mutex_leave(db->mutex);
  1845   1852     return SQLITE_OK;
  1846   1853   }
  1847   1854   

Changes to src/sqlite.h.in.

  1965   1965   ** C-API or the SQL function.
  1966   1966   ** The second parameter is a pointer to an integer into which
  1967   1967   ** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface
  1968   1968   ** is disabled or enabled following this call.  The second parameter may
  1969   1969   ** be a NULL pointer, in which case the new setting is not reported back.
  1970   1970   ** </dd>
  1971   1971   **
         1972  +** <dt>SQLITE_DBCONFIG_MAINDBNAME</dt>
         1973  +** <dd> ^This option is used to change the name of the "main" database
         1974  +** schema.  ^The sole argument is a pointer to a constant UTF8 string
         1975  +** which will become the new schema name in place of "main".  ^SQLite
         1976  +** does not make a copy of the new main schema name string, so the application
         1977  +** must ensure that the argument passed into this DBCONFIG option is unchanged
         1978  +** until after the database connection closes.
         1979  +** </dd>
         1980  +**
  1972   1981   ** </dl>
  1973   1982   */
         1983  +#define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */
  1974   1984   #define SQLITE_DBCONFIG_LOOKASIDE             1001 /* void* int int */
  1975   1985   #define SQLITE_DBCONFIG_ENABLE_FKEY           1002 /* int int* */
  1976   1986   #define SQLITE_DBCONFIG_ENABLE_TRIGGER        1003 /* int int* */
  1977   1987   #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
  1978   1988   #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
  1979   1989   
  1980   1990   

Changes to src/test1.c.

  7190   7190       return TCL_ERROR;
  7191   7191     }
  7192   7192     if( Tcl_GetIntFromObj(interp, objv[3], &v) ) return TCL_ERROR;
  7193   7193     sqlite3_db_config(db, aSetting[i].eVal, v, &v);
  7194   7194     Tcl_SetObjResult(interp, Tcl_NewIntObj(v));
  7195   7195     return TCL_OK;
  7196   7196   }
         7197  +
         7198  +/*
         7199  +** Change the name of the main database schema from "main" to "icecube".
         7200  +*/
         7201  +static int SQLITE_TCLAPI test_dbconfig_maindbname_icecube(
         7202  +  void * clientData,
         7203  +  Tcl_Interp *interp,
         7204  +  int objc,
         7205  +  Tcl_Obj *CONST objv[]
         7206  +){
         7207  +  int rc;
         7208  +  sqlite3 *db;
         7209  +  extern int getDbPointer(Tcl_Interp*, const char*, sqlite3**);
         7210  +  if( objc!=2 ){
         7211  +    Tcl_WrongNumArgs(interp, 1, objv, "DB");
         7212  +    return TCL_ERROR;
         7213  +  }else{
         7214  +    if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
         7215  +    rc = sqlite3_db_config(db, SQLITE_DBCONFIG_MAINDBNAME, "icecube");
         7216  +    Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
         7217  +    return TCL_OK;
         7218  +  }
         7219  +}
  7197   7220   
  7198   7221   /*
  7199   7222   ** Register commands with the TCL interpreter.
  7200   7223   */
  7201   7224   int Sqlitetest1_Init(Tcl_Interp *interp){
  7202   7225     extern int sqlite3_search_count;
  7203   7226     extern int sqlite3_found_count;
................................................................................
  7324   7347        { "sqlite3_thread_cleanup",        test_thread_cleanup,     0},
  7325   7348        { "sqlite3_pager_refcounts",       test_pager_refcounts,    0},
  7326   7349   
  7327   7350        { "sqlite3_load_extension",        test_load_extension,     0},
  7328   7351        { "sqlite3_enable_load_extension", test_enable_load,        0},
  7329   7352        { "sqlite3_extended_result_codes", test_extended_result_codes, 0},
  7330   7353        { "sqlite3_limit",                 test_limit,                 0},
         7354  +     { "dbconfig_maindbname_icecube",   test_dbconfig_maindbname_icecube },
  7331   7355   
  7332   7356        { "save_prng_state",               save_prng_state,    0 },
  7333   7357        { "restore_prng_state",            restore_prng_state, 0 },
  7334   7358        { "reset_prng_state",              reset_prng_state,   0 },
  7335   7359        { "database_never_corrupt",        database_never_corrupt, 0},
  7336   7360        { "database_may_be_corrupt",       database_may_be_corrupt, 0},
  7337   7361        { "optimization_control",          optimization_control,0},

Changes to test/misc8.test.

   103    103              (SELECT 0 AS i) AS x1,
   104    104              (SELECT 1) AS x2
   105    105            ) AS x3,
   106    106            (SELECT 6 AS j UNION ALL SELECT 7) AS x4
   107    107      WHERE i<rowid
   108    108      ORDER BY 1;
   109    109   } {0 1 6 0 1 7}
          110  +
          111  +# The SQLITE_DBCONFIG_MAINDBNAME interface
          112  +#
          113  +db close
          114  +forcedelete test.db test2.db
          115  +sqlite3 db test.db
          116  +do_execsql_test misc8-4.0 {
          117  +  CREATE TABLE t1(a,b,c);
          118  +  INSERT INTO t1 VALUES(1,2,3);
          119  +  ATTACH 'test2.db' AS aux2;
          120  +  CREATE TABLE aux2.t2(c,d,e);
          121  +  INSERT INTO t2 VALUES(4,5,6);
          122  +  SELECT * FROM t1, t2;
          123  +} {1 2 3 4 5 6}
          124  +do_execsql_test misc8-4.1 {
          125  +  PRAGMA database_list;
          126  +} {/0 main .* 2 aux2/}
          127  +dbconfig_maindbname_icecube db
          128  +do_execsql_test misc8-4.2 {
          129  +  SELECT name FROM icecube.sqlite_master;
          130  +} {t1}
          131  +do_execsql_test misc8-4.3 {
          132  +  PRAGMA database_list;
          133  +} {/0 icecube .* 2 aux2/}
          134  +
          135  +
   110    136   
   111    137   finish_test