SQLite

Check-in [e47cd31437]
Login

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

Overview
Comment:Define the sqlite3ErrName() function only when necessary. More robust handling of unknown return codes.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | winOsTrace
Files: files | file ages | folders
SHA1: e47cd314371c2be6e00d96392b3892a7f3015f98
User & Date: mistachkin 2013-04-30 07:54:42.804
Context
2013-04-30
07:58
Add the #ifdefs for sqlite3ErrName() to sqliteInt.h as well. (Closed-Leaf check-in: 400fc4c37f user: mistachkin tags: winOsTrace)
07:54
Define the sqlite3ErrName() function only when necessary. More robust handling of unknown return codes. (check-in: e47cd31437 user: mistachkin tags: winOsTrace)
2013-04-29
09:20
Merge mmap test fix from trunk. (check-in: 95811877fd user: mistachkin tags: winOsTrace)
Changes
Side-by-Side Diff Show Whitespace Changes Patch
Changes to src/main.c.
1029
1030
1031
1032
1033
1034
1035


1036
1037
1038

1039
1040
1041
1042
1043
1044
1045
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039

1040
1041
1042
1043
1044
1045
1046
1047







+
+


-
+







  }
}

/*
** Return a static string containing the name corresponding to the error code
** specified in the argument.
*/
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) || \
    defined(SQLITE_DEBUG_OS_TRACE)
const char *sqlite3ErrName(int rc){
  const char *zName = 0;
  int i;
  int i, origRc = rc;
  for(i=0; i<2 && zName==0; i++, rc &= 0xff){
    switch( rc ){
      case SQLITE_OK:                 zName = "SQLITE_OK";                break;
      case SQLITE_ERROR:              zName = "SQLITE_ERROR";             break;
      case SQLITE_INTERNAL:           zName = "SQLITE_INTERNAL";          break;
      case SQLITE_PERM:               zName = "SQLITE_PERM";              break;
      case SQLITE_ABORT:              zName = "SQLITE_ABORT";             break;
1118
1119
1120
1121
1122
1123
1124
1125





1126
1127

1128
1129
1130
1131
1132
1133
1134
1120
1121
1122
1123
1124
1125
1126

1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141







-
+
+
+
+
+


+







      case SQLITE_NOTICE_RECOVER_WAL: zName = "SQLITE_NOTICE_RECOVER_WAL";break;
      case SQLITE_NOTICE_RECOVER_ROLLBACK:
                                zName = "SQLITE_NOTICE_RECOVER_ROLLBACK"; break;
      case SQLITE_WARNING:            zName = "SQLITE_WARNING";           break;
      case SQLITE_DONE:               zName = "SQLITE_DONE";              break;
    }
  }
  if( zName==0 ) zName = "SQLITE_Unknown";
  if( zName==0 ){
    static char zBuf[50];
    sqlite3_snprintf(sizeof(zBuf), zBuf, "SQLITE_UNKNOWN(%d)", origRc);
    zName = zBuf;
  }
  return zName;
}
#endif

/*
** Return a static string that describes the kind of error specified in the
** argument.
*/
const char *sqlite3ErrStr(int rc){
  static const char* const aMsg[] = {