diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 9 | ||||
-rw-r--r-- | src/sqlite.h.in | 6 | ||||
-rw-r--r-- | src/tclsqlite.c | 16 |
3 files changed, 17 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c index 16294a619..cc19f78a8 100644 --- a/src/main.c +++ b/src/main.c @@ -1768,6 +1768,15 @@ int sqlite3_extended_errcode(sqlite3 *db){ } /* +** Return a string that describes the kind of error specified in the +** argument. For now, this simply calls the internal sqlite3ErrStr() +** function. +*/ +const char *sqlite3_errstr(int rc){ + return sqlite3ErrStr(rc); +} + +/* ** Create a new collating function for database "db". The name is zName ** and the encoding is enc. */ diff --git a/src/sqlite.h.in b/src/sqlite.h.in index e66dcc72b..3729ae6dc 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2747,6 +2747,11 @@ sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64); ** However, the error string might be overwritten or deallocated by ** subsequent calls to other SQLite interface functions.)^ ** +** ^The sqlite3_errstr() interface returns the English-language text +** that describes the [result code], as UTF-8. +** ^(Memory to hold the error message string is managed internally +** and must not be freed by the application)^. +** ** When the serialized [threading mode] is in use, it might be the ** case that a second error occurs on a separate thread in between ** the time of the first error and the call to these interfaces. @@ -2765,6 +2770,7 @@ int sqlite3_errcode(sqlite3 *db); int sqlite3_extended_errcode(sqlite3 *db); const char *sqlite3_errmsg(sqlite3*); const void *sqlite3_errmsg16(sqlite3*); +const char *sqlite3_errstr(int); /* ** CAPI3REF: SQL Statement Object diff --git a/src/tclsqlite.c b/src/tclsqlite.c index abec51e67..0a586e489 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -42,14 +42,6 @@ #include <ctype.h> /* -** This function is used to translate a return code into an error -** message. -*/ -#ifndef USE_SYSTEM_SQLITE -const char *sqlite3ErrStr(int rc); -#endif - -/* * Windows needs to know which symbols to export. Unix does not. * BUILD_sqlite should be undefined for Unix. */ @@ -2566,7 +2558,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ pKey = Tcl_GetByteArrayFromObj(objv[2], &nKey); rc = sqlite3_rekey(pDb->db, pKey, nKey); if( rc ){ - Tcl_AppendResult(interp, sqlite3ErrStr(rc), 0); + Tcl_AppendResult(interp, sqlite3_errstr(rc), 0); rc = TCL_ERROR; } #endif @@ -3044,19 +3036,15 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ zFile = Tcl_TranslateFileName(interp, zFile, &translatedFilename); rc = sqlite3_open_v2(zFile, &p->db, flags, zVfs); Tcl_DStringFree(&translatedFilename); -#ifndef USE_SYSTEM_SQLITE if( p->db ){ -#endif if( SQLITE_OK!=sqlite3_errcode(p->db) ){ zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(p->db)); sqlite3_close(p->db); p->db = 0; } -#ifndef USE_SYSTEM_SQLITE }else{ - zErrMsg = sqlite3_mprintf("%s", sqlite3ErrStr(rc)); + zErrMsg = sqlite3_mprintf("%s", sqlite3_errstr(rc)); } -#endif #ifdef SQLITE_HAS_CODEC if( p->db ){ sqlite3_key(p->db, pKey, nKey); |