/ Check-in [a716b9a3]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a716b9a3091072774d067c0a1258b0f4c39a4180
User & Date: mistachkin 2012-09-10 09:33:09
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: c2ad6911 user: drh tags: trunk
10:29
Initial prototype of SQLITE_CONFIG_READONLY. check-in: 7c340165 user: mistachkin tags: configReadOnly
09:33
Avoid using the sqlite3ErrStr function in the Tcl package if USE_SYSTEM_SQLITE is defined. check-in: a716b9a3 user: mistachkin tags: trunk
08:48
Make header comments for some Tcl test commands more consistent. No changes to code. check-in: af870ca9 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/tclsqlite.c.

41
42
43
44
45
46
47

48

49
50
51
52
53
54
55
....
3038
3039
3040
3041
3042
3043
3044

3045

3046
3047
3048
3049
3050

3051
3052
3053

3054
3055
3056
3057
3058
3059
3060
#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
................................................................................
    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);







>

>







 







>

>





>



>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
....
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
#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
................................................................................
    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);