]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Added sqlite3_errstr API to translate a result code to the corresponding error message.
authormistachkin <mistachkin@noemail.net>
Tue, 11 Sep 2012 02:00:25 +0000 (02:00 +0000)
committermistachkin <mistachkin@noemail.net>
Tue, 11 Sep 2012 02:00:25 +0000 (02:00 +0000)
FossilOrigin-Name: bf8a9ca5b58404112a8af666f5840b462b7bbfe1

manifest
manifest.uuid
src/main.c
src/sqlite.h.in
src/tclsqlite.c

index 42bc0d99d947e535a4ac3776cde0f2ad1007c39c..a88fd0f6b9b1db62bcbd4eba18501f6b40e1362a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Correct\stwo\sduplicated\stest\snames.
-D 2012-09-10T23:44:12.573
+C Added\ssqlite3_errstr\sAPI\sto\stranslate\sa\sresult\scode\sto\sthe\scorresponding\serror\smessage.
+D 2012-09-11T02:00:25.116
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in abd5c10d21d1395f140d9e50ea999df8fa4d6376
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -145,7 +145,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
 F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
 F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416
 F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d
-F src/main.c 02255cf1da50956c5427c469abddb15bccc4ba09
+F src/main.c 259472ec0c694fe6a4fb6e8781be7fd8feacb09c
 F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c 437c7c4af964895d4650f29881df63535caaa1fa
@@ -178,14 +178,14 @@ F src/resolve.c 9e28280ec98035f31900fdd1db01f86f68ca6c32
 F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
 F src/select.c f843c872a97baa1594c2cc3d4c003409a7bd03af
 F src/shell.c 87953c5d9c73d9494db97d1607e2e2280418f261
-F src/sqlite.h.in 39ddd714b62c651bfb5646440c594ca7ff6c7453
+F src/sqlite.h.in 193c0496be6046604d1b8aa518012d3cf411f57f
 F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
 F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
 F src/sqliteInt.h 053e03a532beb909ead2df0721db67cdb4c48ae8
 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
 F src/status.c 35939e7e03abf1b7577ce311f48f682c40de3208
 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
-F src/tclsqlite.c f6bc566b5a52128759d6eb954b53930a6353ed58
+F src/tclsqlite.c e4de2458b3ef38fdd0498bc4e5ea5367a241b0f3
 F src/test1.c 3d70f7c5987f186884cfebbfa7151a7d3d67d86e
 F src/test2.c 4178056dd1e7d70f954ad8a1e3edb71a2a784daf
 F src/test3.c 3c3c2407fa6ec7a19e24ae23f7cb439d0275a60d
@@ -1014,7 +1014,7 @@ F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
-P c2ad691174b8af2e8b158d8840cfc93f75d7db71
-R 01a5d1c903c9a5a720ae8b76fe55d59d
+P ced49974a969f11e5ebe2280bd7eec20b059e501
+R 96b0793061802196b5e5b329338c3e20
 U mistachkin
-Z 8f15859569cbba9d92e0949a6ba62979
+Z 09221de0840bfda8cdeb1fd3b6a60ff7
index 0542b3d17d6cecd9c70aa4e94149144477eaa346..6f8cf23f11e0b52a00efedc93f00b1202411b0a2 100644 (file)
@@ -1 +1 @@
-ced49974a969f11e5ebe2280bd7eec20b059e501
\ No newline at end of file
+bf8a9ca5b58404112a8af666f5840b462b7bbfe1
\ No newline at end of file
index 16294a619977abac0edd5dd980716eb756526f4b..cc19f78a81b46abb53bd776038d1c5bd7537a02e 100644 (file)
@@ -1767,6 +1767,15 @@ int sqlite3_extended_errcode(sqlite3 *db){
   return db->errCode;
 }
 
+/*
+** 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.
index e66dcc72b399c31703e2fb05f4dabdb4fbd70e11..3729ae6dcb94f3e9a789e83eb314ebbff039f78a 100644 (file)
@@ -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
index abec51e67acc2807f43c13e55b4ecf41a24f1960..0a586e489fe6c8fbc386d184d972f0ea122bf955 100644 (file)
 #endif
 #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);