95 const char* szErrMess,
109 szErrMess ? szErrMess :
"");
143 szErrMess ? szErrMess :
"");
147 if (bDeleteMsg && szErrMess)
151 sqlite3_free(szErrMess);
161 mnErrCode(e.mnErrCode)
189 case SQLITE_OK :
return "SQLITE_OK";
191 case SQLITE_ERROR :
return "SQLITE_ERROR";
193 case SQLITE_INTERNAL :
return "SQLITE_INTERNAL";
195 case SQLITE_PERM :
return "SQLITE_PERM";
197 case SQLITE_ABORT :
return "SQLITE_ABORT";
199 case SQLITE_BUSY :
return "SQLITE_BUSY";
201 case SQLITE_LOCKED :
return "SQLITE_LOCKED";
203 case SQLITE_NOMEM :
return "SQLITE_NOMEM";
205 case SQLITE_READONLY :
return "SQLITE_READONLY";
207 case SQLITE_INTERRUPT :
return "SQLITE_INTERRUPT";
209 case SQLITE_IOERR :
return "SQLITE_IOERR";
211 case SQLITE_CORRUPT :
return "SQLITE_CORRUPT";
213 case SQLITE_NOTFOUND :
return "SQLITE_NOTFOUND";
215 case SQLITE_FULL :
return "SQLITE_FULL";
217 case SQLITE_CANTOPEN :
return "SQLITE_CANTOPEN";
219 case SQLITE_PROTOCOL :
return "SQLITE_PROTOCOL";
221 case SQLITE_EMPTY :
return "SQLITE_EMPTY";
223 case SQLITE_SCHEMA :
return "SQLITE_SCHEMA";
225 case SQLITE_TOOBIG :
return "SQLITE_TOOBIG";
227 case SQLITE_CONSTRAINT :
return "SQLITE_CONSTRAINT";
229 case SQLITE_MISMATCH :
return "SQLITE_MISMATCH";
231 case SQLITE_MISUSE :
return "SQLITE_MISUSE";
233 case SQLITE_NOLFS :
return "SQLITE_NOLFS";
235 case SQLITE_AUTH :
return "SQLITE_AUTH";
237 case SQLITE_FORMAT :
return "SQLITE_FORMAT";
239 case SQLITE_RANGE :
return "SQLITE_RANGE";
241 case SQLITE_ROW :
return "SQLITE_ROW";
243 case SQLITE_DONE :
return "SQLITE_DONE";
247 default:
return "UNKNOWN_ERROR";
335 va_start(va, szFormat);
337 mpBuf = sqlite3_vmprintf(szFormat, va);
391 memcpy(
mpBuf, pBuf, nLen);
423 "Cannot allocate memory",
449 unsigned char* ptmp = (
unsigned char*)malloc(
mnBinaryLen);
491 "Cannot decode binary",
557 "Cannot allocate memory",
755 if (nField < 0 || nField >
mnCols-1)
761 "Invalid field index requested",
769 return (
const char*)sqlite3_column_text(
mpVM, nField);
783 return (
const char*)sqlite3_column_text(
mpVM, nField);
807 return sqlite3_column_int(
mpVM, nField);
847 return sqlite3_column_double(
mpVM, nField);
887 return (
const char*)sqlite3_column_text(
mpVM, nField);
919 if (nField < 0 || nField >
mnCols-1)
925 "Invalid field index requested",
933 nLen = sqlite3_column_bytes(
mpVM, nField);
935 return (
const unsigned char*)sqlite3_column_blob(
mpVM, nField);
995 for (
int nField = 0; nField <
mnCols; nField++)
999 const char* szTemp = sqlite3_column_name(
mpVM, nField);
1003 if (strcmp(szField, szTemp) == 0)
1019 "Invalid field name requested",
1037 if (nCol < 0 || nCol >
mnCols-1)
1043 "Invalid field index requested",
1051 return sqlite3_column_name(
mpVM, nCol);
1067 if (nCol < 0 || nCol >
mnCols-1)
1073 "Invalid field index requested",
1081 return sqlite3_column_decltype(
mpVM, nCol);
1097 if (nCol < 0 || nCol >
mnCols-1)
1103 "Invalid field index requested",
1111 return sqlite3_column_type(
mpVM, nCol);
1141 int nRet = sqlite3_step(
mpVM);
1145 if (nRet == SQLITE_DONE)
1155 else if (nRet == SQLITE_ROW)
1167 nRet = sqlite3_finalize(
mpVM);
1171 const char* szError = sqlite3_errmsg(
mpDB);
1195 int nRet = sqlite3_finalize(
mpVM);
1199 if (nRet != SQLITE_OK)
1203 const char* szError = sqlite3_errmsg(
mpDB);
1227 "Null Virtual Machine pointer",
1419 if (nField < 0 || nField >
mnCols-1)
1425 "Invalid field index requested",
1455 for (
int nField = 0; nField <
mnCols; nField++)
1477 "Invalid field name requested",
1679 if (nCol < 0 || nCol >
mnCols-1)
1685 "Invalid field index requested",
1709 if (nRow < 0 || nRow >
mnRows-1)
1715 "Invalid row index requested",
1741 "Null Results pointer",
1857 const char* szError=0;
1861 int nRet = sqlite3_step(
mpVM);
1865 if (nRet == SQLITE_DONE)
1869 int nRowsChanged = sqlite3_changes(
mpDB);
1873 nRet = sqlite3_reset(
mpVM);
1877 if (nRet != SQLITE_OK)
1881 szError = sqlite3_errmsg(
mpDB);
1889 return nRowsChanged;
1897 nRet = sqlite3_reset(
mpVM);
1899 szError = sqlite3_errmsg(
mpDB);
1921 int nRet = sqlite3_step(
mpVM);
1925 if (nRet == SQLITE_DONE)
1935 else if (nRet == SQLITE_ROW)
1949 nRet = sqlite3_reset(
mpVM);
1951 const char* szError = sqlite3_errmsg(
mpDB);
1969 int nRes = sqlite3_bind_text(
mpVM, nParam, szValue, -1, SQLITE_TRANSIENT);
1973 if (nRes != SQLITE_OK)
1979 "Error binding string param",
1997 int nRes = sqlite3_bind_int(
mpVM, nParam, nValue);
2001 if (nRes != SQLITE_OK)
2007 "Error binding int param",
2025 int nRes = sqlite3_bind_double(
mpVM, nParam, dValue);
2029 if (nRes != SQLITE_OK)
2035 "Error binding double param",
2053 int nRes = sqlite3_bind_blob(
mpVM, nParam,
2055 (
const void*)blobValue, nLen, SQLITE_TRANSIENT);
2059 if (nRes != SQLITE_OK)
2065 "Error binding blob param",
2083 int nRes = sqlite3_bind_null(
mpVM, nParam);
2087 if (nRes != SQLITE_OK)
2093 "Error binding NULL param",
2113 int nRet = sqlite3_reset(
mpVM);
2117 if (nRet != SQLITE_OK)
2121 const char* szError = sqlite3_errmsg(
mpDB);
2143 int nRet = sqlite3_finalize(
mpVM);
2149 if (nRet != SQLITE_OK)
2153 const char* szError = sqlite3_errmsg(
mpDB);
2177 "Database not open",
2199 "Null Virtual Machine pointer",
2275 int nRet = sqlite3_open(szFile, &
mpDB);
2279 if (nRet != SQLITE_OK)
2283 const char* szError = sqlite3_errmsg(
mpDB);
2307 sqlite3_close(
mpDB);
2327 sqlite3_stmt* pVM =
compile(szSQL);
2345 "select count(*) from sqlite_master where type='table' and name='%s'",
2371 int nRet = sqlite3_exec(
mpDB, szSQL, 0, 0, &szError);
2375 if (nRet == SQLITE_OK)
2379 return sqlite3_changes(
mpDB);
2405 sqlite3_stmt* pVM =
compile(szSQL);
2409 int nRet = sqlite3_step(pVM);
2413 if (nRet == SQLITE_DONE)
2423 else if (nRet == SQLITE_ROW)
2437 nRet = sqlite3_finalize(pVM);
2439 const char* szError= sqlite3_errmsg(
mpDB);
2465 "Invalid scalar query",
2491 char** paszResults=0;
2501 nRet = sqlite3_get_table(
mpDB, szSQL, &paszResults, &nRows, &nCols, &szError);
2505 if (nRet == SQLITE_OK)
2531 return sqlite3_last_insert_rowid(
mpDB);
2563 "Database not open",
2585 const char* szTail=0;
2591 int nRet = sqlite3_prepare(
mpDB, szSQL, -1, &pVM, &szTail);
2595 if (nRet != SQLITE_OK)
2871 memset(cnt, 0,
sizeof(cnt));
2873 for(i=n-1; i>=0; i--){ cnt[in[i]]++; }
2877 for(i=1; i<256; i++){
2881 if( i==
'\'' )
continue;
2883 sum = cnt[i] + cnt[(i+1)&0xff] + cnt[(i+
'\'')&0xff];
2903 int c = (in[i] - e)&0xff;
2917 }
else if( c==
'\'' ){
2967 while( (c = *(in++))!=0 ){
2993 out[i++] = (c + e)&0xff;