mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Added sqlite3_errstr API to translate a result code to the corresponding error message.
FossilOrigin-Name: bf8a9ca5b58404112a8af666f5840b462b7bbfe1
This commit is contained in:
@@ -41,14 +41,6 @@
|
||||
#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);
|
||||
|
Reference in New Issue
Block a user