Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch sqlite3_db_log Excluding Merge-Ins
This is equivalent to a diff from 025e8370 to 658e20f5
2015-04-23
| ||
11:52 | Fix a problem causing the fts3 integrity-check to fail if run inside a transaction. (check-in: 3b925189 user: dan tags: trunk) | |
2015-04-22
| ||
14:41 | Prototype for an sqlite3_db_log() interface. (Leaf check-in: 658e20f5 user: drh tags: sqlite3_db_log) | |
13:16 | Improved filtering of input for fuzzershell for modes other than generic. (check-in: 025e8370 user: drh tags: trunk) | |
11:16 | Change the printf, strftime, and glob modes of fuzzershell so that they reject all inputs that do not start with a string literal followed by a comma. This helps the fuzzer focus in on the kinds of behavior those modes are intended to test. (check-in: 1cceefa7 user: drh tags: trunk) | |
Changes to src/func.c.
︙ | ︙ | |||
882 883 884 885 886 887 888 | /* IMP: R-24470-31136 This function is an SQL wrapper around the ** sqlite3_sourceid() C interface. */ sqlite3_result_text(context, sqlite3_sourceid(), -1, SQLITE_STATIC); } /* ** Implementation of the sqlite_log() function. This is a wrapper around | | | > > | | 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | /* IMP: R-24470-31136 This function is an SQL wrapper around the ** sqlite3_sourceid() C interface. */ sqlite3_result_text(context, sqlite3_sourceid(), -1, SQLITE_STATIC); } /* ** Implementation of the sqlite_log() function. This is a wrapper around ** sqlite3_db_log(). The return value is NULL. The function exists purely ** for its side-effects. */ static void errlogFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ UNUSED_PARAMETER(argc); UNUSED_PARAMETER(context); sqlite3_db_log(sqlite3_context_db_handle(context), sqlite3_value_int(argv[0]), "%s", sqlite3_value_text(argv[1])); } /* ** Implementation of the sqlite_compileoption_used() function. ** The result is an integer that identifies if the compiler option ** was used to build SQLite. */ |
︙ | ︙ |
Changes to src/main.c.
︙ | ︙ | |||
730 731 732 733 734 735 736 737 738 739 740 741 742 743 | switch( op ){ case SQLITE_DBCONFIG_LOOKASIDE: { void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */ int sz = va_arg(ap, int); /* IMP: R-47871-25994 */ int cnt = va_arg(ap, int); /* IMP: R-04460-53386 */ rc = setupLookaside(db, pBuf, sz, cnt); break; } default: { static const struct { int op; /* The opcode */ u32 mask; /* Mask of the bit in sqlite3.flags to set/clear */ } aFlagOp[] = { { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys }, | > > > > > > > > | 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | switch( op ){ case SQLITE_DBCONFIG_LOOKASIDE: { void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */ int sz = va_arg(ap, int); /* IMP: R-47871-25994 */ int cnt = va_arg(ap, int); /* IMP: R-04460-53386 */ rc = setupLookaside(db, pBuf, sz, cnt); break; } case SQLITE_DBCONFIG_LOG: { /* MSVC is picky about pulling func ptrs from va lists. ** http://support.microsoft.com/kb/47961 */ typedef void(*LOGFUNC_t)(void*,int,const char*); db->xLog = va_arg(ap, LOGFUNC_t); db->pLogArg = va_arg(ap, void*); break; } default: { static const struct { int op; /* The opcode */ u32 mask; /* Mask of the bit in sqlite3.flags to set/clear */ } aFlagOp[] = { { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys }, |
︙ | ︙ |
Changes to src/printf.c.
︙ | ︙ | |||
1032 1033 1034 1035 1036 1037 1038 | ** We house it in a separate routine from sqlite3_log() to avoid using ** stack space on small-stack systems when logging is disabled. ** ** sqlite3_log() must render into a static buffer. It cannot dynamically ** allocate memory because it might be called while the memory allocator ** mutex is held. */ | | > > > > > > < | > | > > > > > > > > > > > > > | 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | ** We house it in a separate routine from sqlite3_log() to avoid using ** stack space on small-stack systems when logging is disabled. ** ** sqlite3_log() must render into a static buffer. It cannot dynamically ** allocate memory because it might be called while the memory allocator ** mutex is held. */ static void renderLogMsg( void (*xLog)(void*,int,const char*), /* Logging function */ void *pArg, /* First argument to xLog */ int iErrCode, /* Error code */ const char *zFormat, /* Format string for error message */ va_list ap /* Arguments to format string */ ){ StrAccum acc; /* String accumulator */ char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */ sqlite3StrAccumInit(&acc, zMsg, sizeof(zMsg), 0); acc.useMalloc = 0; sqlite3VXPrintf(&acc, 0, zFormat, ap); xLog(pArg, iErrCode, sqlite3StrAccumFinish(&acc)); } /* ** Format and write a message to the log if logging is enabled. */ void sqlite3_log(int iErrCode, const char *zFormat, ...){ va_list ap; /* Vararg list */ if( sqlite3GlobalConfig.xLog ){ va_start(ap, zFormat); renderLogMsg(sqlite3GlobalConfig.xLog, sqlite3GlobalConfig.pLogArg, iErrCode, zFormat, ap); va_end(ap); } } void sqlite3_db_log(sqlite3 *db, int iErrCode, const char *zFormat, ...){ va_list ap; /* Vararg list */ if( db && db->xLog ){ va_start(ap, zFormat); renderLogMsg(db->xLog, db->pLogArg, iErrCode, zFormat, ap); va_end(ap); }else if( sqlite3GlobalConfig.xLog ){ va_start(ap, zFormat); renderLogMsg(sqlite3GlobalConfig.xLog, sqlite3GlobalConfig.pLogArg, iErrCode, zFormat, ap); va_end(ap); } } #if defined(SQLITE_DEBUG) /* ** A version of printf() that understands %lld. Used for debugging. |
︙ | ︙ |
Changes to src/sqlite.h.in.
︙ | ︙ | |||
1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 | ** The first argument is an integer which is 0 to disable triggers, ** positive to enable triggers or negative to leave the setting unchanged. ** The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether triggers are disabled or enabled ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back. </dd> ** ** </dl> */ #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes ** METHOD: sqlite3 ** ** ^The sqlite3_extended_result_codes() routine enables or disables the | > > > > > > > > > > > > > > > > > > > > > > > > > | 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 | ** The first argument is an integer which is 0 to disable triggers, ** positive to enable triggers or negative to leave the setting unchanged. ** The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether triggers are disabled or enabled ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back. </dd> ** ** [[SQLITE_DBCONFIG_LOG]] <dt>SQLITE_DBCONFIG_LOG</dt> ** <dd> The SQLITE_DBCONFIG_LOG option is used to configure the SQLite ** [error log] for a specific database connection. See also the ** [SQLITE_CONFIG_LOG] option to [sqlite3_config()] for the global log ** callback. ** (^The SQLITE_DBCONFIG_LOG option takes two arguments: a pointer to a ** function with a call signature of void(*)(void*,int,const char*), ** and a pointer to void. ^If the function pointer is not NULL, it is ** invoked by [sqlite3_db_log()] to process each logging event. ^If the ** function pointer is NULL, then calls to [sqlite3_db_log()] interface try ** to use the [SQLITE_CONFIG_LOG|global error log]. If both the connection ** and global error log callbacks are NULL then [sqlite3_db_log()] is a ** harmless no-op. ** ^The void pointer that is the second argument to SQLITE_DBCONFIG_LOG is ** passed through as the first parameter to the application-defined logger ** function whenever that function is invoked. ^The second parameter to ** the logger function is a copy of the second parameter to the corresponding ** [sqlite3_db_log()] call and is intended to be a [result code] or an ** [extended result code]. ^The third parameter passed to the logger is ** log message after formatting via [sqlite3_snprintf()]. ** The SQLite logging interface is not reentrant; the logger function ** supplied by the application must not invoke any SQLite interface. ** </dd> ** ** </dl> */ #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ #define SQLITE_DBCONFIG_LOG 1004 /* xFunc, void* */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes ** METHOD: sqlite3 ** ** ^The sqlite3_extended_result_codes() routine enables or disables the |
︙ | ︙ | |||
7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 | int sqlite3_strglob(const char *zGlob, const char *zStr); /* ** CAPI3REF: Error Logging Interface ** ** ^The [sqlite3_log()] interface writes a message into the [error log] ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. ** ^If logging is enabled, the zFormat string and subsequent arguments are ** used with [sqlite3_snprintf()] to generate the final output string. ** | > > > > > > > > > | > | 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 | int sqlite3_strglob(const char *zGlob, const char *zStr); /* ** CAPI3REF: Error Logging Interface ** ** ^The [sqlite3_log()] interface writes a message into the [error log] ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. ** ^The [sqlite3_db_log()] interface writes a message into the [error log] ** established by the [SQLITE_DBCONFIG_LOG] option to [sqlite3_db_config()]. ** ^If logging is enabled, the zFormat string and subsequent arguments are ** used with [sqlite3_snprintf()] to generate the final output string. ** ** ^The [sqlite3_db_log()] interface writes error and warning information ** to the callback identified by the [SQLITE_DBCONFIG_LOG] option if that ** callback is not NULL, falling back to the [SQLITE_CONFIG_LOG] callback ** if the first parameter to [sqlite3_db_log()] is NULL or if the ** [SQLITE_DBCONFIG_LOG] callback is NULL. ** ** The sqlite3_log() and sqlite3_db_log() interfaces are intended for ** use by extensions such as ** virtual tables, collating functions, and SQL functions. While there is ** nothing to prevent an application from calling sqlite3_log(), doing so ** is considered bad form. ** ** The zFormat string must not be NULL. ** ** To avoid deadlocks and other threading problems, the sqlite3_log() routine ** will not use dynamically allocated memory. The log message is stored in ** a fixed-length buffer on the stack. If the log message is longer than ** a few hundred characters, it will be truncated to the length of the ** buffer. */ void sqlite3_log(int iErrCode, const char *zFormat, ...); void sqlite3_db_log(sqlite3*, int iErrCode, const char *zFormat, ...); /* ** CAPI3REF: Write-Ahead Log Commit Hook ** METHOD: sqlite3 ** ** ^The [sqlite3_wal_hook()] function is used to register a callback that ** is invoked each time data is committed to a database in wal mode. |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 | void *pCollNeededArg; sqlite3_value *pErr; /* Most recent error message */ union { volatile int isInterrupted; /* True if sqlite3_interrupt has been called */ double notUsed1; /* Spacer */ } u1; Lookaside lookaside; /* Lookaside malloc configuration */ #ifndef SQLITE_OMIT_AUTHORIZATION sqlite3_xauth xAuth; /* Access authorization function */ void *pAuthArg; /* 1st argument to the access auth function */ #endif #ifndef SQLITE_OMIT_PROGRESS_CALLBACK int (*xProgress)(void *); /* The progress callback */ void *pProgressArg; /* Argument to the progress callback */ | > > | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 | void *pCollNeededArg; sqlite3_value *pErr; /* Most recent error message */ union { volatile int isInterrupted; /* True if sqlite3_interrupt has been called */ double notUsed1; /* Spacer */ } u1; Lookaside lookaside; /* Lookaside malloc configuration */ void (*xLog)(void*,int,const char*); /* Function for logging */ void *pLogArg; /* First argument to xLog() */ #ifndef SQLITE_OMIT_AUTHORIZATION sqlite3_xauth xAuth; /* Access authorization function */ void *pAuthArg; /* 1st argument to the access auth function */ #endif #ifndef SQLITE_OMIT_PROGRESS_CALLBACK int (*xProgress)(void *); /* The progress callback */ void *pProgressArg; /* Argument to the progress callback */ |
︙ | ︙ |
Changes to src/test1.c.
︙ | ︙ | |||
5793 5794 5795 5796 5797 5798 5799 | } if( logcallback.pObj ){ Tcl_DecrRefCount(logcallback.pObj); logcallback.pObj = 0; logcallback.pInterp = 0; sqlite3_config(SQLITE_CONFIG_LOG, 0, 0); } | | > > > > > > > > > > > > > > > > > > > > > > > > > > | 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 | } if( logcallback.pObj ){ Tcl_DecrRefCount(logcallback.pObj); logcallback.pObj = 0; logcallback.pInterp = 0; sqlite3_config(SQLITE_CONFIG_LOG, 0, 0); } if( objc==2 ){ logcallback.pObj = objv[1]; Tcl_IncrRefCount(logcallback.pObj); logcallback.pInterp = interp; sqlite3_config(SQLITE_CONFIG_LOG, xLogcallback, 0); } return TCL_OK; } static int test_sqlite3_db_log( ClientData clientData, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; if( objc<1 || objc>3 ){ Tcl_WrongNumArgs(interp, 1, objv, "DB SCRIPT"); return TCL_ERROR; } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; if( logcallback.pObj ){ Tcl_DecrRefCount(logcallback.pObj); logcallback.pObj = 0; logcallback.pInterp = 0; sqlite3_db_config(db, SQLITE_DBCONFIG_LOG, 0, 0); } if( objc==3 ){ logcallback.pObj = objv[2]; Tcl_IncrRefCount(logcallback.pObj); logcallback.pInterp = interp; sqlite3_db_config(db, SQLITE_DBCONFIG_LOG, xLogcallback, 0); } return TCL_OK; } /* ** tcl_objproc COMMANDNAME ARGS... ** ** Run a TCL command using its objProc interface. Throw an error if ** the command has no objProc interface. |
︙ | ︙ | |||
6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 | #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY { "sqlite3_unlock_notify", test_unlock_notify, 0 }, #endif { "sqlite3_wal_checkpoint", test_wal_checkpoint, 0 }, { "sqlite3_wal_checkpoint_v2",test_wal_checkpoint_v2, 0 }, { "sqlite3_wal_autocheckpoint",test_wal_autocheckpoint, 0 }, { "test_sqlite3_log", test_sqlite3_log, 0 }, #ifndef SQLITE_OMIT_EXPLAIN { "print_explain_query_plan", test_print_eqp, 0 }, #endif { "sqlite3_test_control", test_test_control }, #if SQLITE_OS_UNIX { "getrusage", test_getrusage }, #endif | > | 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 | #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY { "sqlite3_unlock_notify", test_unlock_notify, 0 }, #endif { "sqlite3_wal_checkpoint", test_wal_checkpoint, 0 }, { "sqlite3_wal_checkpoint_v2",test_wal_checkpoint_v2, 0 }, { "sqlite3_wal_autocheckpoint",test_wal_autocheckpoint, 0 }, { "test_sqlite3_log", test_sqlite3_log, 0 }, { "test_sqlite3_db_log", test_sqlite3_db_log, 0 }, #ifndef SQLITE_OMIT_EXPLAIN { "print_explain_query_plan", test_print_eqp, 0 }, #endif { "sqlite3_test_control", test_test_control }, #if SQLITE_OS_UNIX { "getrusage", test_getrusage }, #endif |
︙ | ︙ |
Changes to src/tokenize.c.
︙ | ︙ | |||
471 472 473 474 475 476 477 | } if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc)); } assert( pzErrMsg!=0 ); if( pParse->zErrMsg ){ *pzErrMsg = pParse->zErrMsg; | | | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | } if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc)); } assert( pzErrMsg!=0 ); if( pParse->zErrMsg ){ *pzErrMsg = pParse->zErrMsg; sqlite3_db_log(db, pParse->rc, "%s", *pzErrMsg); pParse->zErrMsg = 0; nErr++; } if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){ sqlite3VdbeDelete(pParse->pVdbe); pParse->pVdbe = 0; } |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
970 971 972 973 974 975 976 | sqlite3SetString(&p->zErrMsg, db, "%s constraint failed: %s", zType, pOp->p4.z); }else if( pOp->p4.z ){ sqlite3SetString(&p->zErrMsg, db, "%s", pOp->p4.z); }else{ sqlite3SetString(&p->zErrMsg, db, "%s constraint failed", zType); } | | | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | sqlite3SetString(&p->zErrMsg, db, "%s constraint failed: %s", zType, pOp->p4.z); }else if( pOp->p4.z ){ sqlite3SetString(&p->zErrMsg, db, "%s", pOp->p4.z); }else{ sqlite3SetString(&p->zErrMsg, db, "%s constraint failed", zType); } sqlite3_db_log(db, pOp->p1, zLogFmt, pcx, p->zSql, p->zErrMsg); } rc = sqlite3VdbeHalt(p); assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR ); if( rc==SQLITE_BUSY ){ p->rc = rc = SQLITE_BUSY; }else{ assert( rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ); |
︙ | ︙ | |||
6525 6526 6527 6528 6529 6530 6531 | /* If we reach this point, it means that execution is finished with ** an error of some kind. */ vdbe_error_halt: assert( rc ); p->rc = rc; testcase( sqlite3GlobalConfig.xLog!=0 ); | | | 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 | /* If we reach this point, it means that execution is finished with ** an error of some kind. */ vdbe_error_halt: assert( rc ); p->rc = rc; testcase( sqlite3GlobalConfig.xLog!=0 ); sqlite3_db_log(db, rc, "statement aborts at %d: [%s] %s", (int)(pOp - aOp), p->zSql, p->zErrMsg); sqlite3VdbeHalt(p); if( rc==SQLITE_IOERR_NOMEM ) db->mallocFailed = 1; rc = SQLITE_ERROR; if( resetSchemaOnFault>0 ){ sqlite3ResetOneSchema(db, resetSchemaOnFault-1); } |
︙ | ︙ |
Changes to src/vdbeapi.c.
︙ | ︙ | |||
1141 1142 1143 1144 1145 1146 1147 | Mem *pVar; if( vdbeSafetyNotNull(p) ){ return SQLITE_MISUSE_BKPT; } sqlite3_mutex_enter(p->db->mutex); if( p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){ sqlite3Error(p->db, SQLITE_MISUSE); | < | > | 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | Mem *pVar; if( vdbeSafetyNotNull(p) ){ return SQLITE_MISUSE_BKPT; } sqlite3_mutex_enter(p->db->mutex); if( p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){ sqlite3Error(p->db, SQLITE_MISUSE); sqlite3_db_log(p->db, SQLITE_MISUSE, "bind on a busy prepared statement: [%s]", p->zSql); sqlite3_mutex_leave(p->db->mutex); return SQLITE_MISUSE_BKPT; } if( i<1 || i>p->nVar ){ sqlite3Error(p->db, SQLITE_RANGE); sqlite3_mutex_leave(p->db->mutex); return SQLITE_RANGE; } |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
2049 2050 2051 2052 2053 2054 2055 | nMainFile = sqlite3Strlen30(zMainFile); zMaster = sqlite3MPrintf(db, "%s-mjXXXXXX9XXz", zMainFile); if( zMaster==0 ) return SQLITE_NOMEM; do { u32 iRandom; if( retryCount ){ if( retryCount>100 ){ | | | | 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 | nMainFile = sqlite3Strlen30(zMainFile); zMaster = sqlite3MPrintf(db, "%s-mjXXXXXX9XXz", zMainFile); if( zMaster==0 ) return SQLITE_NOMEM; do { u32 iRandom; if( retryCount ){ if( retryCount>100 ){ sqlite3_db_log(db, SQLITE_FULL, "MJ delete: %s", zMaster); sqlite3OsDelete(pVfs, zMaster, 0); break; }else if( retryCount==1 ){ sqlite3_db_log(db, SQLITE_FULL, "MJ collide: %s", zMaster); } } retryCount++; sqlite3_randomness(sizeof(iRandom), &iRandom); sqlite3_snprintf(13, &zMaster[nMainFile], "-mj%06X9%02X", (iRandom>>8)&0xffffff, iRandom&0xff); /* The antipenultimate character of the master journal name must |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
1746 1747 1748 1749 1750 1751 1752 | } if( termCanDriveIndex(pTerm, pSrc, notReady) ){ int iCol = pTerm->u.leftColumn; Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); testcase( iCol==BMS ); testcase( iCol==BMS-1 ); if( !sentWarning ){ | | | 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 | } if( termCanDriveIndex(pTerm, pSrc, notReady) ){ int iCol = pTerm->u.leftColumn; Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); testcase( iCol==BMS ); testcase( iCol==BMS-1 ); if( !sentWarning ){ sqlite3_db_log(pParse->db, SQLITE_WARNING_AUTOINDEX, "automatic index on %s(%s)", pTable->zName, pTable->aCol[iCol].zName); sentWarning = 1; } if( (idxCols & cMask)==0 ){ if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){ goto end_auto_index_create; |
︙ | ︙ |
Added test/errlog01.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # 2015-04-22 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #************************************************************************* # Test cases for the sqlite3_log() and sqlite3_db_log() interfaces. # set testdir [file dirname $argv0] source $testdir/tester.tcl unset -nocomplain log set log {} do_test errlog01-1.0 { test_sqlite3_db_log db [list lappend ::log] db eval {SELECT sqlite_log(7,'simulated error')} } {{}} do_test errlog01-1.1 { set ::log } {SQLITE_NOMEM {simulated error}} do_test errlog01-1.2 { sqlite3 db2 :memory: set ::log {} db2 eval {SELECT sqlite_log(7,'simulated error')} } {{}} do_test errlog01-1.3 { set ::log } {} finish_test |