Bring the documenation and implementation of sqlite3_collation_needed() into
agreement. Use a more efficient implementation of sqlite3ErrStr(). sqlite3_result_error_code() now calls sqlite3ErrStr() if no prior error string was set. (CVS 6550) FossilOrigin-Name: cb9af8293624da35c32077d0f46d5b0cf826dcf5
This commit is contained in:
parent
6f050aa2bf
commit
51c7d86476
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Tests\sfor\sthe\snew\sasynchronous\sIO\sAPI.\s(CVS\s6549)
|
||||
D 2009-04-25T08:39:15
|
||||
C Bring\sthe\sdocumenation\sand\simplementation\sof\ssqlite3_collation_needed()\sinto\nagreement.\s\sUse\sa\smore\sefficient\simplementation\sof\ssqlite3ErrStr().\nsqlite3_result_error_code()\snow\scalls\ssqlite3ErrStr()\sif\sno\sprior\nerror\sstring\swas\sset.\s(CVS\s6550)
|
||||
D 2009-04-27T18:46:06
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -125,7 +125,7 @@ F src/insert.c 71286d081a919a27ef22eaeccbe2718f93dc6aa9
|
||||
F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
|
||||
F src/legacy.c 2ad5b52df322d0f132f66817095e0e79c8942611
|
||||
F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
|
||||
F src/main.c 81b74ada97292a09906e76d0a3c75cc37ce42a12
|
||||
F src/main.c a3270aeabcfa2fafea04ab42778eaa68ff39eeaa
|
||||
F src/malloc.c a1f0f8ae110abb8eb546e259ab0eaea7e0f9b588
|
||||
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
|
||||
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
|
||||
@ -160,7 +160,7 @@ F src/resolve.c 094e44450371fb27869eb8bf679aacbe51fdc56d
|
||||
F src/rowset.c 14d12b5e81b5907b87d511f6f4219805f96a4b55
|
||||
F src/select.c 40748e8044b79d41ba04ce1014ae45434ed452d3
|
||||
F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7
|
||||
F src/sqlite.h.in 8e0e256079bac2319380bdfebf403fcbe630510f
|
||||
F src/sqlite.h.in e50559931ebd0c20728d765e9e31006544eb2738
|
||||
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
|
||||
F src/sqliteInt.h d34f80cf38227ce8ed5c519e748375bd9b40d8f7
|
||||
F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
|
||||
@ -206,7 +206,7 @@ F src/vacuum.c 07121a727beeee88f27d704a00313ad6a7c9bef0
|
||||
F src/vdbe.c b7a27b4c3de1d2df80f3f9ee5a206c4af2abeb5a
|
||||
F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a
|
||||
F src/vdbeInt.h 8726f7b4e3b55c8acf6d304a5b5f727ac1b6c5ab
|
||||
F src/vdbeapi.c 015c9d0fb7047657a13a7bb6aa886f75e43db02d
|
||||
F src/vdbeapi.c 86aa27a5f3493aaffb8ac051782aa3b22670d7ed
|
||||
F src/vdbeaux.c 34524d499fc6081e97771dcfdf6c2523d5877ef5
|
||||
F src/vdbeblob.c e67757450ae8581a8b354d9d7e467e41502dfe38
|
||||
F src/vdbemem.c 111d8193859d16aefd5d3cb57472808584ea5503
|
||||
@ -725,7 +725,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
P 3ceae3579bc42974865cf6fe0bc42001e786e894
|
||||
R 44d916fcf80f3e78683dbc53a4849cab
|
||||
U danielk1977
|
||||
Z d6aacbfa0984c74675fa8631efe9436d
|
||||
P 11b2564e7159168cd0815bb9bc93688586fad1e0
|
||||
R b88c3723887470271f990b426c83f42c
|
||||
U drh
|
||||
Z 277ade239b059b3b8c0adf4c55726554
|
||||
|
@ -1 +1 @@
|
||||
11b2564e7159168cd0815bb9bc93688586fad1e0
|
||||
cb9af8293624da35c32077d0f46d5b0cf826dcf5
|
74
src/main.c
74
src/main.c
@ -14,7 +14,7 @@
|
||||
** other files are for internal use by SQLite and should not be
|
||||
** accessed by users of the library.
|
||||
**
|
||||
** $Id: main.c,v 1.539 2009/04/21 12:02:56 drh Exp $
|
||||
** $Id: main.c,v 1.540 2009/04/27 18:46:06 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -738,37 +738,41 @@ void sqlite3RollbackAll(sqlite3 *db){
|
||||
** argument.
|
||||
*/
|
||||
const char *sqlite3ErrStr(int rc){
|
||||
const char *z;
|
||||
switch( rc & 0xff ){
|
||||
case SQLITE_ROW:
|
||||
case SQLITE_DONE:
|
||||
case SQLITE_OK: z = "not an error"; break;
|
||||
case SQLITE_ERROR: z = "SQL logic error or missing database"; break;
|
||||
case SQLITE_PERM: z = "access permission denied"; break;
|
||||
case SQLITE_ABORT: z = "callback requested query abort"; break;
|
||||
case SQLITE_BUSY: z = "database is locked"; break;
|
||||
case SQLITE_LOCKED: z = "database table is locked"; break;
|
||||
case SQLITE_NOMEM: z = "out of memory"; break;
|
||||
case SQLITE_READONLY: z = "attempt to write a readonly database"; break;
|
||||
case SQLITE_INTERRUPT: z = "interrupted"; break;
|
||||
case SQLITE_IOERR: z = "disk I/O error"; break;
|
||||
case SQLITE_CORRUPT: z = "database disk image is malformed"; break;
|
||||
case SQLITE_FULL: z = "database or disk is full"; break;
|
||||
case SQLITE_CANTOPEN: z = "unable to open database file"; break;
|
||||
case SQLITE_EMPTY: z = "table contains no data"; break;
|
||||
case SQLITE_SCHEMA: z = "database schema has changed"; break;
|
||||
case SQLITE_TOOBIG: z = "String or BLOB exceeded size limit"; break;
|
||||
case SQLITE_CONSTRAINT: z = "constraint failed"; break;
|
||||
case SQLITE_MISMATCH: z = "datatype mismatch"; break;
|
||||
case SQLITE_MISUSE: z = "library routine called out of sequence";break;
|
||||
case SQLITE_NOLFS: z = "large file support is disabled"; break;
|
||||
case SQLITE_AUTH: z = "authorization denied"; break;
|
||||
case SQLITE_FORMAT: z = "auxiliary database format error"; break;
|
||||
case SQLITE_RANGE: z = "bind or column index out of range"; break;
|
||||
case SQLITE_NOTADB: z = "file is encrypted or is not a database";break;
|
||||
default: z = "unknown error"; break;
|
||||
static const char* const aMsg[] = {
|
||||
/* SQLITE_OK */ "not an error",
|
||||
/* SQLITE_ERROR */ "SQL logic error or missing database",
|
||||
/* SQLITE_INTERNAL */ 0,
|
||||
/* SQLITE_PERM */ "access permission denied",
|
||||
/* SQLITE_ABORT */ "callback requested query abort",
|
||||
/* SQLITE_BUSY */ "database is locked",
|
||||
/* SQLITE_LOCKED */ "database table is locked",
|
||||
/* SQLITE_NOMEM */ "out of memory",
|
||||
/* SQLITE_READONLY */ "attempt to write a readonly database",
|
||||
/* SQLITE_INTERRUPT */ "interrupted",
|
||||
/* SQLITE_IOERR */ "disk I/O error",
|
||||
/* SQLITE_CORRUPT */ "database disk image is malformed",
|
||||
/* SQLITE_NOTFOUND */ 0,
|
||||
/* SQLITE_FULL */ "database or disk is full",
|
||||
/* SQLITE_CANTOPEN */ "unable to open database file",
|
||||
/* SQLITE_PROTOCOL */ 0,
|
||||
/* SQLITE_EMPTY */ "table contains no data",
|
||||
/* SQLITE_SCHEMA */ "database schema has changed",
|
||||
/* SQLITE_TOOBIG */ "String or BLOB exceeded size limit",
|
||||
/* SQLITE_CONSTRAINT */ "constraint failed",
|
||||
/* SQLITE_MISMATCH */ "datatype mismatch",
|
||||
/* SQLITE_MISUSE */ "library routine called out of sequence",
|
||||
/* SQLITE_NOLFS */ "large file support is disabled",
|
||||
/* SQLITE_AUTH */ "authorization denied",
|
||||
/* SQLITE_FORMAT */ "auxiliary database format error",
|
||||
/* SQLITE_RANGE */ "bind or column index out of range",
|
||||
/* SQLITE_NOTADB */ "file is encrypted or is not a database",
|
||||
};
|
||||
rc &= 0xff;
|
||||
if( ALWAYS(rc>=0) && rc<sizeof(aMsg)/sizeof(aMsg[0]) && aMsg[rc]!=0 ){
|
||||
return aMsg[rc];
|
||||
}else{
|
||||
return "unknown error";
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1356,11 +1360,13 @@ static int createCollation(
|
||||
** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the
|
||||
** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally.
|
||||
*/
|
||||
enc2 = enc & ~SQLITE_UTF16_ALIGNED;
|
||||
if( enc2==SQLITE_UTF16 ){
|
||||
enc2 = enc;
|
||||
testcase( enc2 & SQLITE_UTF16 );
|
||||
testcase( enc2 & SQLITE_UTF16_ALIGNED );
|
||||
if( enc2 & (SQLITE_UTF16|SQLITE_UTF16_ALIGNED) ){
|
||||
enc2 = SQLITE_UTF16NATIVE;
|
||||
}
|
||||
if( (enc2&~3)!=0 ){
|
||||
if( enc2<SQLITE_UTF8 || enc2>SQLITE_UTF16BE ){
|
||||
return SQLITE_MISUSE;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
** the version number) and changes its name to "sqlite3.h" as
|
||||
** part of the build process.
|
||||
**
|
||||
** @(#) $Id: sqlite.h.in,v 1.443 2009/04/20 12:31:46 drh Exp $
|
||||
** @(#) $Id: sqlite.h.in,v 1.444 2009/04/27 18:46:06 drh Exp $
|
||||
*/
|
||||
#ifndef _SQLITE3_H_
|
||||
#define _SQLITE3_H_
|
||||
@ -3496,12 +3496,14 @@ void sqlite3_result_zeroblob(sqlite3_context*, int n);
|
||||
** the name is passed as the second function argument.
|
||||
**
|
||||
** The third argument may be one of the constants [SQLITE_UTF8],
|
||||
** [SQLITE_UTF16LE] or [SQLITE_UTF16BE], indicating that the user-supplied
|
||||
** [SQLITE_UTF16LE], or [SQLITE_UTF16BE], indicating that the user-supplied
|
||||
** routine expects to be passed pointers to strings encoded using UTF-8,
|
||||
** UTF-16 little-endian, or UTF-16 big-endian, respectively. The
|
||||
** third argument might also be [SQLITE_UTF16_ALIGNED] to indicate that
|
||||
** third argument might also be [SQLITE_UTF16] to indicate that the routine
|
||||
** expects pointers to be UTF-16 strings in the native byte order, or the
|
||||
** argument can be [SQLITE_UTF16_ALIGNED] if the
|
||||
** the routine expects pointers to 16-bit word aligned strings
|
||||
** of UTF-16 in the native byte order of the host computer.
|
||||
** of UTF-16 in the native byte order.
|
||||
**
|
||||
** A pointer to the user supplied routine must be passed as the fifth
|
||||
** argument. If it is NULL, this is the same as deleting the collation
|
||||
@ -3526,6 +3528,8 @@ void sqlite3_result_zeroblob(sqlite3_context*, int n);
|
||||
** collation creation functions or when the [database connection] is closed
|
||||
** using [sqlite3_close()].
|
||||
**
|
||||
** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
|
||||
**
|
||||
** Requirements:
|
||||
** [H16603] [H16604] [H16606] [H16609] [H16612] [H16615] [H16618] [H16621]
|
||||
** [H16624] [H16627] [H16630]
|
||||
|
@ -13,7 +13,7 @@
|
||||
** This file contains code use to implement APIs that are part of the
|
||||
** VDBE.
|
||||
**
|
||||
** $Id: vdbeapi.c,v 1.163 2009/04/14 12:58:20 drh Exp $
|
||||
** $Id: vdbeapi.c,v 1.164 2009/04/27 18:46:06 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "vdbeInt.h"
|
||||
@ -400,6 +400,10 @@ void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
|
||||
}
|
||||
void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
|
||||
pCtx->isError = errCode;
|
||||
if( pCtx->s.flags & MEM_Null ){
|
||||
sqlite3VdbeMemSetStr(&pCtx->s, sqlite3ErrStr(errCode), -1,
|
||||
SQLITE_UTF8, SQLITE_STATIC);
|
||||
}
|
||||
}
|
||||
|
||||
/* Force an SQLITE_TOOBIG error. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user