Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch build-bug Excluding Merge-Ins
This is equivalent to a diff from 37e6e10f43 to 5f804da182
2021-12-29
| ||
04:13 | Add the sqlite3_error_offset() interface. Use it to enhance error reporting in the CLI. (check-in: 416602a851 user: drh tags: trunk) | |
04:10 | Change an assert() in FTS3 into assert_fts3_nc(), since it is a harmless condition that can occur when processing a corrupt database file. (check-in: e773d6219b user: drh tags: trunk) | |
04:08 | Fix the build-breaker bug in test1.c introduced by check-in [7fa20ca4c09ab024]. (Closed-Leaf check-in: 5f804da182 user: drh tags: build-bug) | |
2021-12-28
| ||
05:08 | Make .read's help tell of piped input (check-in: e4ddcd8aa5 user: larrybr tags: build-bug) | |
2021-12-25
| ||
00:26 | Add the sqlite3_error_offset() interface. Use it to enhance error reporting in the CLI. (Later:) There is a bug in src/test1.c that prevents the code from even building. How did this pass tests? Moving to a branch to prevent fugure bisect problems. (check-in: 7fa20ca4c0 user: drh tags: build-bug) | |
2021-12-24
| ||
20:51 | Create new branch named "instr-bidir-more" (Leaf check-in: 4ca96d2d73 user: larrybr tags: instr-bidir-more) | |
20:22 | Add the sqlite3_error_offset() interface. Use it in the CLI to provide better context for error messages. (check-in: b518ce7743 user: drh tags: improved-error-context) | |
19:44 | Fix a minor problem in the CLI introduced by [d156123885abe6bf], apparently. (check-in: 37e6e10f43 user: drh tags: trunk) | |
13:30 | Raise an error if a schema name is attached to the table-alias name of a subquery or view. See forum post 021a33600b for the bug report. (check-in: 8af8c153f8 user: drh tags: trunk) | |
Changes to ext/fts3/fts3.c.
︙ | |||
4482 4483 4484 4485 4486 4487 4488 | 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 | - + | int *pnList, /* OUT: List length pointer */ u8 *pbEof /* OUT: End-of-file flag */ ){ char *p = *ppIter; assert( nDoclist>0 ); assert( *pbEof==0 ); |
︙ |
Changes to src/loadext.c.
︙ | |||
481 482 483 484 485 486 487 488 489 490 491 492 493 494 | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | + + | /* Version 3.34.0 and later */ sqlite3_txn_state, /* Version 3.36.1 and later */ sqlite3_changes64, sqlite3_total_changes64, /* Version 3.37.0 and later */ sqlite3_autovacuum_pages, /* Version 3.38.0 and later */ sqlite3_error_offset, }; /* True if x is the directory separator character */ #if SQLITE_OS_WIN # define DirSep(X) ((X)=='/'||(X)=='\\') #else |
︙ |
Changes to src/main.c.
︙ | |||
2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 | 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 | + + + + + + + + + + + + + | if( z==0 ){ z = sqlite3ErrStr(db->errCode); } } sqlite3_mutex_leave(db->mutex); return z; } /* ** Return the byte offset of the most recent error */ int sqlite3_error_offset(sqlite3 *db){ int iOffset = -1; if( db && sqlite3SafetyCheckSickOrOk(db) && db->errCode ){ sqlite3_mutex_enter(db->mutex); iOffset = db->errByteOffset; sqlite3_mutex_leave(db->mutex); } return iOffset; } #ifndef SQLITE_OMIT_UTF16 /* ** Return UTF-16 encoded English language explanation of the most recent ** error. */ const void *sqlite3_errmsg16(sqlite3 *db){ |
︙ |
Changes to src/printf.c.
︙ | |||
851 852 853 854 855 856 857 858 859 860 861 862 863 864 | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | + | case etTOKEN: { Token *pToken; if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return; pToken = va_arg(ap, Token*); assert( bArgList==0 ); if( pToken && pToken->n ){ sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n); sqlite3RecordErrorByteOffset(pAccum->db, pToken->z); } length = width = 0; break; } case etSRCITEM: { SrcItem *pItem; if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return; |
︙ | |||
905 906 907 908 909 910 911 912 913 914 915 916 917 918 | 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | + + + + + + + + + + + + + + + + + + + + + + + + | if( zExtra ){ sqlite3DbFree(pAccum->db, zExtra); zExtra = 0; } }/* End for loop over the format string */ } /* End of function */ /* ** The z string points to the first character of a token that is ** associated with an error. If db does not already have an error ** byte offset recorded, try to compute the error byte offset for ** z and set the error byte offset in db. */ void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){ const Parse *pParse; const char *zText; const char *zEnd; assert( z!=0 ); if( NEVER(db==0) ) return; if( db->errByteOffset!=(-2) ) return; pParse = db->pParse; if( NEVER(pParse==0) ) return; zText =pParse->zTail; if( NEVER(zText==0) ) return; zEnd = &zText[strlen(zText)]; if( SQLITE_WITHIN(z,zText,zEnd) ){ db->errByteOffset = (int)(z-zText); } } /* ** Enlarge the memory allocation on a StrAccum object so that it is ** able to accept at least N more bytes of text. ** ** Return the number of bytes of text that StrAccum is able to accept ** after the attempted enlargement. The value returned might be zero. */ |
︙ |
Changes to src/shell.c.in.
︙ | |||
2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 | 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | z[n++] = zName[i]; if( zName[i]==cQuote ) z[n++] = cQuote; } if( cQuote ) z[n++] = cQuote; z[n] = 0; } /* ** Maybe construct two lines of text that point out the position of a ** syntax error. Return a pointer to the text, in memory obtained from ** sqlite3_malloc(). Or, if the most recent error does not involve a ** specific token that we can point to, return an empty string. ** ** In all cases, the memory returned is obtained from sqlite3_malloc64() ** and should be released by the caller invoking sqlite3_free(). */ static char *shell_error_context(const char *zSql, sqlite3 *db){ int iOffset; size_t len; char *zCode; char *zMsg; int i; if( db==0 || zSql==0 || (iOffset = sqlite3_error_offset(db))<0 ){ return sqlite3_mprintf(""); } while( iOffset>50 ){ iOffset--; zSql++; while( (zSql[0]&0xc0)==0x80 ){ zSql++; iOffset--; } } len = strlen(zSql); if( len>78 ){ len = 78; while( (zSql[len]&0xc0)==0x80 ) len--; } zCode = sqlite3_mprintf("%.*s", len, zSql); for(i=0; zCode[i]; i++){ if( IsSpace(zSql[i]) ) zCode[i] = ' '; } if( iOffset<25 ){ zMsg = sqlite3_mprintf("\n %z\n %*s^--- error here", zCode, iOffset, ""); }else{ zMsg = sqlite3_mprintf("\n %z\n %*serror here ---^", zCode, iOffset-14, ""); } return zMsg; } /* ** Execute a query statement that will generate SQL output. Print ** the result columns, comma-separated, on a line and then add a ** semicolon terminator to the end of that line. ** ** If the number of columns is 1 and that column contains text "--" |
︙ | |||
2537 2538 2539 2540 2541 2542 2543 | 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 | + - - + + + | sqlite3_stmt *pSelect; int rc; int nResult; int i; const char *z; rc = sqlite3_prepare_v2(p->db, zSelect, -1, &pSelect, 0); if( rc!=SQLITE_OK || !pSelect ){ char *zContext = shell_error_context(zSelect, p->db); |
︙ | |||
2574 2575 2576 2577 2578 2579 2580 | 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 | - + + + - - + + + + | /* ** Allocate space and save off string indicating current error. */ static char *save_err_msg( sqlite3 *db, /* Database to query */ const char *zWhen, /* Qualifier (format) wrapper */ |
︙ | |||
3514 3515 3516 3517 3518 3519 3520 | 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 | - + | #endif while( zSql[0] && (SQLITE_OK == rc) ){ static const char *zStmtSql; rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover); if( SQLITE_OK != rc ){ if( pzErrMsg ){ |
︙ | |||
3630 3631 3632 3633 3634 3635 3636 | 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 | - + | ** next statement to execute. */ rc2 = sqlite3_finalize(pStmt); if( rc!=SQLITE_NOMEM ) rc = rc2; if( rc==SQLITE_OK ){ zSql = zLeftover; while( IsSpace(zSql[0]) ) zSql++; }else if( pzErrMsg ){ |
︙ | |||
4096 4097 4098 4099 4100 4101 4102 | 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 | - + + | " --limit N Interrupt after N progress callbacks", " --once Do no more than one progress interrupt", " --quiet|-q No output except at interrupts", " --reset Reset the count for each input and interrupt", #endif ".prompt MAIN CONTINUE Replace the standard prompts", ".quit Exit this program", |
︙ |
Changes to src/sqlite.h.in.
︙ | |||
3820 3821 3822 3823 3824 3825 3826 | 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 | - + + + + + + + + + + | ** [extended result code] even when extended result codes are ** disabled. ** ** The values returned by sqlite3_errcode() and/or ** sqlite3_extended_errcode() might change with each API call. ** Except, there are some interfaces that are guaranteed to never ** change the value of the error code. The error-code preserving |
︙ |
Changes to src/sqlite3ext.h.
︙ | |||
340 341 342 343 344 345 346 347 348 349 350 351 352 353 | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | + + | /* Version 3.36.1 and later */ sqlite3_int64 (*changes64)(sqlite3*); sqlite3_int64 (*total_changes64)(sqlite3*); /* Version 3.37.0 and later */ int (*autovacuum_pages)(sqlite3*, unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int), void*, void(*)(void*)); /* Version 3.38.0 and later */ int (*error_offset)(sqlite3*); }; /* ** This is the function signature used for all extension entry points. It ** is also defined in the file "loadext.c". */ typedef int (*sqlite3_loadext_entry)( |
︙ | |||
651 652 653 654 655 656 657 658 659 660 661 662 663 664 | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | + + | /* Version 3.34.0 and later */ #define sqlite3_txn_state sqlite3_api->txn_state /* Version 3.36.1 and later */ #define sqlite3_changes64 sqlite3_api->changes64 #define sqlite3_total_changes64 sqlite3_api->total_changes64 /* Version 3.37.0 and later */ #define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages /* Version 3.38.0 and later */ #define sqlite3_error_offset sqlite3_api->error_offset #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) /* This case when the file really is being compiled as a loadable ** extension */ # define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0; # define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v; |
︙ |
Changes to src/sqliteInt.h.
︙ | |||
1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 | + | u32 mDbFlags; /* flags recording internal state */ u64 flags; /* flags settable by pragmas. See below */ i64 lastRowid; /* ROWID of most recent insert (see above) */ i64 szMmap; /* Default mmap_size setting */ u32 nSchemaLock; /* Do not reset the schema when non-zero */ unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */ int errCode; /* Most recent error code (SQLITE_*) */ int errByteOffset; /* Byte offset of error in SQL statement */ int errMask; /* & result codes with this before returning */ int iSysErrno; /* Errno value from last system error */ u32 dbOptFlags; /* Flags to enable/disable optimizations */ u8 enc; /* Text encoding */ u8 autoCommit; /* The auto-commit flag. */ u8 temp_store; /* 1: file 2: memory 0: default */ u8 mallocFailed; /* True if we have seen a malloc failure */ |
︙ | |||
4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 | 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 | + | void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int); int sqlite3StrAccumEnlarge(StrAccum*, int); char *sqlite3StrAccumFinish(StrAccum*); void sqlite3StrAccumSetError(StrAccum*, u8); void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*); void sqlite3SelectDestInit(SelectDest*,int,int); Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); void sqlite3RecordErrorByteOffset(sqlite3*,const char*); void sqlite3BackupRestart(sqlite3_backup *); void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); #ifndef SQLITE_OMIT_SUBQUERY int sqlite3ExprCheckIN(Parse*, Expr*); #else |
︙ |
Changes to src/test1.c.
︙ | |||
4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 | 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; zErr = sqlite3_errmsg(db); Tcl_SetObjResult(interp, Tcl_NewStringObj(zErr, -1)); return TCL_OK; } /* ** Usage: sqlite3_error_offset DB ** ** Return the byte offset into the input UTF8 SQL for the most recent ** error, or -1 of the error does not refer to a specific token. */ static int SQLITE_TCLAPI test_error_offset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int iByteOffset; if( objc!=2 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", Tcl_GetString(objv[0]), " DB", 0); return TCL_ERROR; } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; iByteOffset = sqlite3_error_offset(db); Tcl_SetObjResult(interp, Tcl_NewIntObj(iByteOffset)); return TCL_OK; } /* ** Usage: test_errmsg16 DB ** ** Returns the UTF-16 representation of the error message string for the ** most recent sqlite3_* API call. This is a byte array object at the TCL ** level, and it includes the 0x00 0x00 terminator bytes at the end of the ** UTF-16 string. |
︙ | |||
8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 | 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 | + | { "sqlite3_bind_parameter_name", test_bind_parameter_name, 0}, { "sqlite3_bind_parameter_index", test_bind_parameter_index, 0}, { "sqlite3_clear_bindings", test_clear_bindings, 0}, { "sqlite3_sleep", test_sleep, 0}, { "sqlite3_errcode", test_errcode ,0 }, { "sqlite3_extended_errcode", test_ex_errcode ,0 }, { "sqlite3_errmsg", test_errmsg ,0 }, { "sqlite3_error_offset", test_error_offset ,0 }, { "sqlite3_errmsg16", test_errmsg16 ,0 }, { "sqlite3_open", test_open ,0 }, { "sqlite3_open16", test_open16 ,0 }, { "sqlite3_open_v2", test_open_v2 ,0 }, { "sqlite3_complete16", test_complete16 ,0 }, { "sqlite3_normalize", test_normalize ,0 }, |
︙ |
Changes to src/util.c.
︙ | |||
113 114 115 116 117 118 119 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | - + + + + + + - - - - - - - - - - - + + | ** Set the current error code to err_code and clear any prior error message. ** Also set iSysErrno (by calling sqlite3System) if the err_code indicates ** that would be appropriate. */ void sqlite3Error(sqlite3 *db, int err_code){ assert( db!=0 ); db->errCode = err_code; |
︙ | |||
177 178 179 180 181 182 183 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | - - - - - - - + + | va_end(ap); sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC); } } /* ** Add an error message to pParse->zErrMsg and increment pParse->nErr. |
︙ |