SQLite

Check-in [a716b9a309]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid using the sqlite3ErrStr function in the Tcl package if USE_SYSTEM_SQLITE is defined.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a716b9a3091072774d067c0a1258b0f4c39a4180
User & Date: mistachkin 2012-09-10 09:33:09.064
Context
2012-09-10
15:02
Remove the stale implementation of the ifnull and coalesce functions - code that has been commented out for ages. No functional changes. (check-in: c2ad691174 user: drh tags: trunk)
10:29
Initial prototype of SQLITE_CONFIG_READONLY. (check-in: 7c3401657a user: mistachkin tags: configReadOnly)
09:33
Avoid using the sqlite3ErrStr function in the Tcl package if USE_SYSTEM_SQLITE is defined. (check-in: a716b9a309 user: mistachkin tags: trunk)
08:48
Make header comments for some Tcl test commands more consistent. No changes to code. (check-in: af870ca982 user: mistachkin tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/tclsqlite.c.
41
42
43
44
45
46
47

48

49
50
51
52
53
54
55
#endif
#include <ctype.h>

/*
** This function is used to translate a return code into an error
** message.
*/

const char *sqlite3ErrStr(int rc);


/*
 * Windows needs to know which symbols to export.  Unix does not.
 * BUILD_sqlite should be undefined for Unix.
 */
#ifdef BUILD_sqlite
#undef TCL_STORAGE_CLASS







>

>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#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.
 */
#ifdef BUILD_sqlite
#undef TCL_STORAGE_CLASS
3038
3039
3040
3041
3042
3043
3044

3045

3046
3047
3048
3049
3050

3051
3052
3053

3054
3055
3056
3057
3058
3059
3060
    return TCL_ERROR;
  }
  memset(p, 0, sizeof(*p));
  zFile = Tcl_GetStringFromObj(objv[2], 0);
  zFile = Tcl_TranslateFileName(interp, zFile, &translatedFilename);
  rc = sqlite3_open_v2(zFile, &p->db, flags, zVfs);
  Tcl_DStringFree(&translatedFilename);

  if( p->db ){

    if( SQLITE_OK!=sqlite3_errcode(p->db) ){
      zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(p->db));
      sqlite3_close(p->db);
      p->db = 0;
    }

  }else{
    zErrMsg = sqlite3_mprintf("%s", sqlite3ErrStr(rc));
  }

#ifdef SQLITE_HAS_CODEC
  if( p->db ){
    sqlite3_key(p->db, pKey, nKey);
  }
#endif
  if( p->db==0 ){
    Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE);







>

>





>



>







3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
    return TCL_ERROR;
  }
  memset(p, 0, sizeof(*p));
  zFile = Tcl_GetStringFromObj(objv[2], 0);
  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));
  }
#endif
#ifdef SQLITE_HAS_CODEC
  if( p->db ){
    sqlite3_key(p->db, pKey, nKey);
  }
#endif
  if( p->db==0 ){
    Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE);