1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Use the SQLITE_UTF* symbols instead of the old internal TEXT_Utf* symbols. (CVS 1572)

FossilOrigin-Name: 9b84f2f488e1d37ba1a4c4cf31490bcbba0f6edd
This commit is contained in:
danielk1977
2004-06-12 00:42:34 +00:00
parent 31ef3b91f5
commit dc8453fd7a
18 changed files with 143 additions and 139 deletions

View File

@@ -1,5 +1,5 @@
C Fix\stypos\sin\sthe\snew\slocking\sdocument.\s(CVS\s1571) C Use\sthe\sSQLITE_UTF*\ssymbols\sinstead\sof\sthe\sold\sinternal\sTEXT_Utf*\ssymbols.\s(CVS\s1572)
D 2004-06-11T22:04:31 D 2004-06-12T00:42:35
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -28,17 +28,17 @@ F src/attach.c 93b8ecec4a8d7b4e9f2479e2327d90c9d01765e8
F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79 F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79
F src/btree.c 281af87aa117de024f5b6c2728a2339cba9ef584 F src/btree.c 281af87aa117de024f5b6c2728a2339cba9ef584
F src/btree.h 589427ac13bb544d298cd99726e2572a6fe4bdaa F src/btree.h 589427ac13bb544d298cd99726e2572a6fe4bdaa
F src/build.c b36b62f49aea7d258cb804999dcc8650e4d79464 F src/build.c 1943d5910d0a9807dd788758c41c5b1900a8da78
F src/date.c 8e6fa3173386fb29fdef012ee08a853c1e9908b2 F src/date.c 2d193dbe7ca0d68a81be0ed64fb455b61ceb420d
F src/delete.c 911221aadb35d610c84fadb32e71c52990827e58 F src/delete.c 911221aadb35d610c84fadb32e71c52990827e58
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37 F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
F src/expr.c 97f3dd76c778a191834ea75d0cddeb82bba70f8b F src/expr.c 03ab3de3897a89c4b4fce4438566e8fef1d973f7
F src/func.c 91a21c9598b38b8122f745e6ac5cda4ce9f2cfa9 F src/func.c a58fef26514e26f49312785d2fde370e3a8a85a4
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
F src/insert.c 68c7f3ddd6a7f1e5596d6996da1a2861b3789a3a F src/insert.c 68c7f3ddd6a7f1e5596d6996da1a2861b3789a3a
F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f
F src/main.c 9f20ae4870fc0c0c6c7815316b9f77b4a5ad4e8f F src/main.c 59b662fab26dd6f39224971755836f328b426cf3
F src/md5.c 4302e84ae516c616bb079c4e6d038c0addb33481 F src/md5.c 4302e84ae516c616bb079c4e6d038c0addb33481
F src/os.h 23c69c5084e71b5fe199ff1c4e35a4aded0f1380 F src/os.h 23c69c5084e71b5fe199ff1c4e35a4aded0f1380
F src/os_common.h 6393ac67a3a7b4aea19ff17529980ecf77eb2348 F src/os_common.h 6393ac67a3a7b4aea19ff17529980ecf77eb2348
@@ -51,32 +51,32 @@ F src/os_win.h 004eec47b1780fcaf07420ddc2072294b698d48c
F src/pager.c 94ecf938607847e21fb794d2841c9a7f05e2ddb7 F src/pager.c 94ecf938607847e21fb794d2841c9a7f05e2ddb7
F src/pager.h ca8f293e1d623a7c628a1c5e0c6cf43d5bbb80bf F src/pager.h ca8f293e1d623a7c628a1c5e0c6cf43d5bbb80bf
F src/parse.y 097438674976355a10cf177bd97326c548820b86 F src/parse.y 097438674976355a10cf177bd97326c548820b86
F src/pragma.c 0bc3adea28df802074996bec067d506d55d28f84 F src/pragma.c e288bd122d3ca41ec2032475abde1ff5fa3095f4
F src/printf.c 63b15f1ea9fe3daa066bb7430fd20d4a2d717dc8 F src/printf.c 63b15f1ea9fe3daa066bb7430fd20d4a2d717dc8
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c d29488f86e61e0d45dff318e1f04ba6a7e5782d0 F src/select.c d29488f86e61e0d45dff318e1f04ba6a7e5782d0
F src/shell.c ca519519dcbbc582f6d88f7d0e7583b857fd3469 F src/shell.c ca519519dcbbc582f6d88f7d0e7583b857fd3469
F src/sqlite.h.in 56c53344a6fbd76328d641d9ddab90d4e4ba9129 F src/sqlite.h.in 33179b721472c6e2616b7c95f77a0b5b98d30d5a
F src/sqliteInt.h 625faf4c9ce2f99b9c85a2bca5c4e73736c30262 F src/sqliteInt.h c49c1841842973354bab645d705fdcd8c4b09006
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2 F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
F src/tclsqlite.c e974c0b2479ed37334aeb268de331e0a1b21b5a8 F src/tclsqlite.c e974c0b2479ed37334aeb268de331e0a1b21b5a8
F src/test1.c 5f5c0773df1091cc02ddf6608a8f6e0c65940a56 F src/test1.c 5f5c0773df1091cc02ddf6608a8f6e0c65940a56
F src/test2.c 05f810c90cf6262d5f352860e87d41a3f34207f9 F src/test2.c 05f810c90cf6262d5f352860e87d41a3f34207f9
F src/test3.c beafd0ccf7b9ae784744be1b1e66ffe8f64c25da F src/test3.c beafd0ccf7b9ae784744be1b1e66ffe8f64c25da
F src/test4.c a921a69821fd30209589228e64f94e9f715b6fe2 F src/test4.c a921a69821fd30209589228e64f94e9f715b6fe2
F src/test5.c 862784cd7a68e7d36f00287aac6e413ca996eaf8 F src/test5.c 13ac1db35b03acbc197ceb245fe862da5ebf2369
F src/tokenize.c 183c5d7da11affab5d70d903d33409c8c0ce6c5b F src/tokenize.c 183c5d7da11affab5d70d903d33409c8c0ce6c5b
F src/trigger.c d1a4d7a59b34c811bf6070d64d0497baa0140dcf F src/trigger.c d1a4d7a59b34c811bf6070d64d0497baa0140dcf
F src/update.c 168b6d523087ca4545b74ec9f3102b1f3c6b1e38 F src/update.c 168b6d523087ca4545b74ec9f3102b1f3c6b1e38
F src/utf.c c2c8e445bfea724f3502609d6389fe66651f02ab F src/utf.c e16737b3fc4201bf7ce9bd8ced5250596aa31b76
F src/util.c e8629f04d920ae968fced709dc7a3a2c62b65ac4 F src/util.c 90375fa253137562d536ccdd40b297f0fd7413fc
F src/vacuum.c b921eb778842592e1fb48a9d4cef7e861103878f F src/vacuum.c b921eb778842592e1fb48a9d4cef7e861103878f
F src/vdbe.c 56a97efecedecff984599763552a96cacce86319 F src/vdbe.c 73b2c3d0de81a97f7a0d210c9374f4ba6a17a20c
F src/vdbe.h 46f74444a213129bc4b5ce40124dd8ed613b0cde F src/vdbe.h 46f74444a213129bc4b5ce40124dd8ed613b0cde
F src/vdbeInt.h 57b7001bc18de348f2180c5fa8a85b687592a19b F src/vdbeInt.h 57b7001bc18de348f2180c5fa8a85b687592a19b
F src/vdbeapi.c bcf5821ed09070d586898374b905861c4dd73d0b F src/vdbeapi.c d7803664ea8bacc109ddb4b96ce8c5785ff60138
F src/vdbeaux.c 117d0d0a3178c203a0093d6fd7c26b69c34e9ed5 F src/vdbeaux.c fefea411bd41ac46fada191d017a414817f7d86b
F src/vdbemem.c 6407b5dcd6cae43ee1342d49bcd574f0f23f5beb F src/vdbemem.c 26cd5419a9c9e7a8959618376f04afdb433b77a3
F src/where.c dda77afaa593cd54e5955ec433076de18faf62f6 F src/where.c dda77afaa593cd54e5955ec433076de18faf62f6
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test aed659e52635662bcd5069599aaca823533edf5a F test/attach.test aed659e52635662bcd5069599aaca823533edf5a
@@ -194,7 +194,7 @@ F www/arch2.gif 49c6bb36160f03ca2b89eaa5bfb1f560c7d68ee7
F www/audit.tcl 90e09d580f79c7efec0c7d6f447b7ec5c2dce5c0 F www/audit.tcl 90e09d580f79c7efec0c7d6f447b7ec5c2dce5c0
F www/c_interface.tcl 2176519fc2bd2d2cf6fe74fd806fc2d8362de2c8 F www/c_interface.tcl 2176519fc2bd2d2cf6fe74fd806fc2d8362de2c8
F www/capi3.tcl a940c5ca0b0ebafd5acfe2ceca5a388bd8cfb468 F www/capi3.tcl a940c5ca0b0ebafd5acfe2ceca5a388bd8cfb468
F www/capi3ref.tcl 2cb0861c5219c6e44298c217a6c904464b4403bc F www/capi3ref.tcl 7a6e81eebe20b960aed02cb33e369b3645acceec
F www/changes.tcl cbe942607b2b9e5dc995395f37042dbb5a629c7f F www/changes.tcl cbe942607b2b9e5dc995395f37042dbb5a629c7f
F www/common.tcl f786e6be86fb2627ceb30e770e9efa83b9c67a3a F www/common.tcl f786e6be86fb2627ceb30e770e9efa83b9c67a3a
F www/conflict.tcl fb8a2ba83746c7fdfd9e52fa7f6aaf5c422b8246 F www/conflict.tcl fb8a2ba83746c7fdfd9e52fa7f6aaf5c422b8246
@@ -223,7 +223,7 @@ F www/support.tcl 1801397edd271cc39a2aadd54e701184b5181248
F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075 F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P 13cf1ba8256bf8cee0195dbaeac71a20cd2c2fc2 P 022075517cc0edc5f21de4b92ef188bda2034c98
R a74bbada06c34f6b3745d14293026d8d R abf75eaed31f2acb34d4cd05657f47f8
U drh U danielk1977
Z 5456fa4d6b2f147027153ff7013c301f Z d06de6886101bf9e57ad7761153b77ce

View File

@@ -1 +1 @@
022075517cc0edc5f21de4b92ef188bda2034c98 9b84f2f488e1d37ba1a4c4cf31490bcbba0f6edd

View File

@@ -23,7 +23,7 @@
** ROLLBACK ** ROLLBACK
** PRAGMA ** PRAGMA
** **
** $Id: build.c,v 1.216 2004/06/10 14:01:08 danielk1977 Exp $ ** $Id: build.c,v 1.217 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -879,11 +879,11 @@ static CollSeq * findCollSeqEntry(
pColl = sqliteMalloc( 3*sizeof(*pColl) + nName + 1 ); pColl = sqliteMalloc( 3*sizeof(*pColl) + nName + 1 );
if( pColl ){ if( pColl ){
pColl[0].zName = (char*)&pColl[3]; pColl[0].zName = (char*)&pColl[3];
pColl[0].enc = TEXT_Utf8; pColl[0].enc = SQLITE_UTF8;
pColl[1].zName = (char*)&pColl[3]; pColl[1].zName = (char*)&pColl[3];
pColl[1].enc = TEXT_Utf16le; pColl[1].enc = SQLITE_UTF16LE;
pColl[2].zName = (char*)&pColl[3]; pColl[2].zName = (char*)&pColl[3];
pColl[2].enc = TEXT_Utf16be; pColl[2].enc = SQLITE_UTF16BE;
memcpy(pColl[0].zName, zName, nName); memcpy(pColl[0].zName, zName, nName);
pColl[0].zName[nName] = 0; pColl[0].zName[nName] = 0;
sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, nName, pColl); sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, nName, pColl);
@@ -909,12 +909,12 @@ CollSeq *sqlite3FindCollSeq(
){ ){
CollSeq *pColl = findCollSeqEntry(db, zName, nName, create); CollSeq *pColl = findCollSeqEntry(db, zName, nName, create);
if( pColl ) switch( enc ){ if( pColl ) switch( enc ){
case TEXT_Utf8: case SQLITE_UTF8:
break; break;
case TEXT_Utf16le: case SQLITE_UTF16LE:
pColl = &pColl[1]; pColl = &pColl[1];
break; break;
case TEXT_Utf16be: case SQLITE_UTF16BE:
pColl = &pColl[2]; pColl = &pColl[2];
break; break;
default: default:
@@ -957,27 +957,27 @@ static int synthCollSeq(Parse *pParse, CollSeq *pColl){
char *z = pColl->zName; char *z = pColl->zName;
int n = strlen(z); int n = strlen(z);
switch( pParse->db->enc ){ switch( pParse->db->enc ){
case TEXT_Utf16le: case SQLITE_UTF16LE:
pColl2 = sqlite3FindCollSeq(pParse->db, TEXT_Utf16be, z, n, 0); pColl2 = sqlite3FindCollSeq(pParse->db, SQLITE_UTF16BE, z, n, 0);
assert( pColl2 ); assert( pColl2 );
if( pColl2->xCmp ) break; if( pColl2->xCmp ) break;
pColl2 = sqlite3FindCollSeq(pParse->db, TEXT_Utf8, z, n, 0); pColl2 = sqlite3FindCollSeq(pParse->db, SQLITE_UTF8, z, n, 0);
assert( pColl2 ); assert( pColl2 );
break; break;
case TEXT_Utf16be: case SQLITE_UTF16BE:
pColl2 = sqlite3FindCollSeq(pParse->db,TEXT_Utf16le, z, n, 0); pColl2 = sqlite3FindCollSeq(pParse->db,SQLITE_UTF16LE, z, n, 0);
assert( pColl2 ); assert( pColl2 );
if( pColl2->xCmp ) break; if( pColl2->xCmp ) break;
pColl2 = sqlite3FindCollSeq(pParse->db,TEXT_Utf8, z, n, 0); pColl2 = sqlite3FindCollSeq(pParse->db,SQLITE_UTF8, z, n, 0);
assert( pColl2 ); assert( pColl2 );
break; break;
case TEXT_Utf8: case SQLITE_UTF8:
pColl2 = sqlite3FindCollSeq(pParse->db,TEXT_Utf16be, z, n, 0); pColl2 = sqlite3FindCollSeq(pParse->db,SQLITE_UTF16BE, z, n, 0);
assert( pColl2 ); assert( pColl2 );
if( pColl2->xCmp ) break; if( pColl2->xCmp ) break;
pColl2 = sqlite3FindCollSeq(pParse->db,TEXT_Utf16le, z, n, 0); pColl2 = sqlite3FindCollSeq(pParse->db,SQLITE_UTF16LE, z, n, 0);
assert( pColl2 ); assert( pColl2 );
break; break;
} }

View File

@@ -16,7 +16,7 @@
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope. ** All other code has file scope.
** **
** $Id: date.c,v 1.27 2004/05/31 18:51:58 drh Exp $ ** $Id: date.c,v 1.28 2004/06/12 00:42:35 danielk1977 Exp $
** **
** NOTES: ** NOTES:
** **
@@ -321,7 +321,7 @@ static int parseDateOrTime(const char *zDate, DateTime *p){
return 0; return 0;
} }
return 1; return 1;
}else if( sqlite3IsNumber(zDate, 0, TEXT_Utf8) ){ }else if( sqlite3IsNumber(zDate, 0, SQLITE_UTF8) ){
p->rJD = sqlite3AtoF(zDate, 0); p->rJD = sqlite3AtoF(zDate, 0);
p->validJD = 1; p->validJD = 1;
return 0; return 0;

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and ** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite. ** for generating VDBE code that evaluates expressions in SQLite.
** **
** $Id: expr.c,v 1.139 2004/06/11 10:51:27 danielk1977 Exp $ ** $Id: expr.c,v 1.140 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -1012,7 +1012,7 @@ int sqlite3ExprCheck(Parse *pParse, Expr *pExpr, int allowAgg, int *pIsAgg){
int nId; /* Number of characters in function name */ int nId; /* Number of characters in function name */
const char *zId; /* The function name. */ const char *zId; /* The function name. */
FuncDef *pDef; FuncDef *pDef;
int iPrefEnc = (pParse->db->enc==TEXT_Utf8)?0:1; int iPrefEnc = (pParse->db->enc==SQLITE_UTF8)?0:1;
getFunctionName(pExpr, &zId, &nId); getFunctionName(pExpr, &zId, &nId);
pDef = sqlite3FindFunction(pParse->db, zId, nId, n, iPrefEnc, 0); pDef = sqlite3FindFunction(pParse->db, zId, nId, n, iPrefEnc, 0);
@@ -1280,7 +1280,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
const char *zId; const char *zId;
int p2 = 0; int p2 = 0;
int i; int i;
int iPrefEnc = (pParse->db->enc==TEXT_Utf8)?0:1; int iPrefEnc = (pParse->db->enc==SQLITE_UTF8)?0:1;
CollSeq *pColl = 0; CollSeq *pColl = 0;
getFunctionName(pExpr, &zId, &nId); getFunctionName(pExpr, &zId, &nId);
pDef = sqlite3FindFunction(pParse->db, zId, nId, nExpr, iPrefEnc, 0); pDef = sqlite3FindFunction(pParse->db, zId, nId, nExpr, iPrefEnc, 0);
@@ -1724,7 +1724,7 @@ int sqlite3ExprAnalyzeAggregates(Parse *pParse, Expr *pExpr){
} }
} }
if( i>=pParse->nAgg ){ if( i>=pParse->nAgg ){
int iPrefEnc = (pParse->db->enc==TEXT_Utf8)?0:1; int iPrefEnc = (pParse->db->enc==SQLITE_UTF8)?0:1;
i = appendAggInfo(pParse); i = appendAggInfo(pParse);
if( i<0 ) return 1; if( i<0 ) return 1;
pParse->aAgg[i].isAgg = 1; pParse->aAgg[i].isAgg = 1;

View File

@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope. ** All other code has file scope.
** **
** $Id: func.c,v 1.66 2004/06/11 10:51:32 danielk1977 Exp $ ** $Id: func.c,v 1.67 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
@@ -397,7 +397,7 @@ LikePattern *compileLike(sqlite3_value *pPattern, u8 enc){
int offset = 0; int offset = 0;
const char *zLike; const char *zLike;
if( enc==TEXT_Utf8 ){ if( enc==SQLITE_UTF8 ){
zLike = sqlite3_value_text(pPattern); zLike = sqlite3_value_text(pPattern);
n = sqlite3_value_bytes(pPattern) + 1; n = sqlite3_value_bytes(pPattern) + 1;
}else{ }else{
@@ -488,11 +488,11 @@ static void likeFunc(
/* If the user-data pointer is NULL, use UTF-8. Otherwise UTF-16. */ /* If the user-data pointer is NULL, use UTF-8. Otherwise UTF-16. */
if( sqlite3_user_data(context) ){ if( sqlite3_user_data(context) ){
enc = TEXT_Utf16; enc = SQLITE_UTF16NATIVE;
zString = (const unsigned char *)sqlite3_value_text16(argv[1]); zString = (const unsigned char *)sqlite3_value_text16(argv[1]);
assert(0); assert(0);
}else{ }else{
enc = TEXT_Utf8; enc = SQLITE_UTF8;
zString = sqlite3_value_text(argv[1]); zString = sqlite3_value_text(argv[1]);
} }
@@ -509,7 +509,7 @@ static void likeFunc(
pState = aState; pState = aState;
do { do {
if( enc==TEXT_Utf8 ){ if( enc==SQLITE_UTF8 ){
c = zString[offset++]; c = zString[offset++];
if( c&0x80 ){ if( c&0x80 ){
offset--; offset--;

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** accessed by users of the library.
** **
** $Id: main.c,v 1.215 2004/06/11 10:51:32 danielk1977 Exp $ ** $Id: main.c,v 1.216 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -223,14 +223,14 @@ static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){
** meta[1] File format of schema layer. ** meta[1] File format of schema layer.
** meta[2] Size of the page cache. ** meta[2] Size of the page cache.
** meta[3] Synchronous setting. 1:off, 2:normal, 3:full ** meta[3] Synchronous setting. 1:off, 2:normal, 3:full
** meta[4] Db text encoding. 1:UTF-8 2:UTF-16 LE 3:UTF-16 BE ** meta[4] Db text encoding. 1:UTF-8 3:UTF-16 LE 4:UTF-16 BE
** meta[5] Pragma temp_store value. See comments on BtreeFactory ** meta[5] Pragma temp_store value. See comments on BtreeFactory
** meta[6] ** meta[6]
** meta[7] ** meta[7]
** meta[8] ** meta[8]
** meta[9] ** meta[9]
** **
** Note: The hash defined TEXT_Utf* symbols in sqliteInt.h correspond to ** Note: The hash defined SQLITE_UTF* symbols in sqliteInt.h correspond to
** the possible values of meta[4]. ** the possible values of meta[4].
*/ */
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
@@ -1054,7 +1054,7 @@ static int openDatabase(
db->magic = SQLITE_MAGIC_BUSY; db->magic = SQLITE_MAGIC_BUSY;
db->nDb = 2; db->nDb = 2;
db->aDb = db->aDbStatic; db->aDb = db->aDbStatic;
db->enc = TEXT_Utf8; db->enc = SQLITE_UTF8;
db->autoCommit = 1; db->autoCommit = 1;
/* db->flags |= SQLITE_ShortColNames; */ /* db->flags |= SQLITE_ShortColNames; */
sqlite3HashInit(&db->aFunc, SQLITE_HASH_STRING, 0); sqlite3HashInit(&db->aFunc, SQLITE_HASH_STRING, 0);

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** This file contains code used to implement the PRAGMA command. ** This file contains code used to implement the PRAGMA command.
** **
** $Id: pragma.c,v 1.42 2004/06/10 10:50:25 danielk1977 Exp $ ** $Id: pragma.c,v 1.43 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -769,14 +769,14 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
char *zName; char *zName;
u8 enc; u8 enc;
} encnames[] = { } encnames[] = {
{ "UTF-8", TEXT_Utf8 }, { "UTF-8", SQLITE_UTF8 },
{ "UTF-16le", TEXT_Utf16le }, { "UTF-16le", SQLITE_UTF16LE },
{ "UTF-16be", TEXT_Utf16be }, { "UTF-16be", SQLITE_UTF16BE },
{ "UTF-16", TEXT_Utf16 }, { "UTF-16", SQLITE_UTF16NATIVE },
{ "UTF8", TEXT_Utf8 }, { "UTF8", SQLITE_UTF8 },
{ "UTF16le", TEXT_Utf16le }, { "UTF16le", SQLITE_UTF16LE },
{ "UTF16be", TEXT_Utf16be }, { "UTF16be", SQLITE_UTF16BE },
{ "UTF16", TEXT_Utf16 }, { "UTF16", SQLITE_UTF16NATIVE },
{ 0, 0 } { 0, 0 }
}; };
struct EncName *pEnc; struct EncName *pEnc;

View File

@@ -12,7 +12,7 @@
** This header file defines the interface that the SQLite library ** This header file defines the interface that the SQLite library
** presents to client programs. ** presents to client programs.
** **
** @(#) $Id: sqlite.h.in,v 1.98 2004/06/11 17:48:03 drh Exp $ ** @(#) $Id: sqlite.h.in,v 1.99 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#ifndef _SQLITE_H_ #ifndef _SQLITE_H_
#define _SQLITE_H_ #define _SQLITE_H_
@@ -968,9 +968,9 @@ void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
** sqlite3_create_collation and sqlite3_create_function. ** sqlite3_create_collation and sqlite3_create_function.
*/ */
#define SQLITE_UTF8 1 #define SQLITE_UTF8 1
#define SQLITE_UTF16 2 /* Use native byte order */ #define SQLITE_UTF16LE 2
#define SQLITE_UTF16LE 3 #define SQLITE_UTF16BE 3
#define SQLITE_UTF16BE 4 #define SQLITE_UTF16 4 /* Use native byte order */
#define SQLITE_ANY 5 /* sqlite3_create_function only */ #define SQLITE_ANY 5 /* sqlite3_create_function only */
/* /*

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** Internal interface definitions for SQLite.
** **
** @(#) $Id: sqliteInt.h,v 1.282 2004/06/11 10:51:35 danielk1977 Exp $ ** @(#) $Id: sqliteInt.h,v 1.283 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#include "config.h" #include "config.h"
#include "sqlite3.h" #include "sqlite3.h"
@@ -320,6 +320,7 @@ struct Db {
#define DB_SchemaLoaded 0x0004 /* The schema has been loaded */ #define DB_SchemaLoaded 0x0004 /* The schema has been loaded */
#define DB_UnresetViews 0x0008 /* Some views have defined column names */ #define DB_UnresetViews 0x0008 /* Some views have defined column names */
#if 0
/* /*
** Possible values for the Db.textEnc field. ** Possible values for the Db.textEnc field.
*/ */
@@ -327,6 +328,9 @@ struct Db {
#define TEXT_Utf16le 2 #define TEXT_Utf16le 2
#define TEXT_Utf16be 3 #define TEXT_Utf16be 3
#define TEXT_Utf16 (SQLITE_BIGENDIAN?TEXT_Utf16be:TEXT_Utf16le) #define TEXT_Utf16 (SQLITE_BIGENDIAN?TEXT_Utf16be:TEXT_Utf16le)
#endif
#define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
/* /*
** An instance of the following structure is used to store the busy-handler ** An instance of the following structure is used to store the busy-handler

View File

@@ -15,7 +15,7 @@
** is used for testing the SQLite routines for converting between ** is used for testing the SQLite routines for converting between
** the various supported unicode encodings. ** the various supported unicode encodings.
** **
** $Id: test5.c,v 1.9 2004/06/09 09:55:19 danielk1977 Exp $ ** $Id: test5.c,v 1.10 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "vdbeInt.h" #include "vdbeInt.h"
@@ -270,7 +270,7 @@ static int test_value_overhead(
val.flags = MEM_Str|MEM_Term|MEM_Static; val.flags = MEM_Str|MEM_Term|MEM_Static;
val.z = "hello world"; val.z = "hello world";
val.type = SQLITE_TEXT; val.type = SQLITE_TEXT;
val.enc = TEXT_Utf8; val.enc = SQLITE_UTF8;
for(i=0; i<repeat_count; i++){ for(i=0; i<repeat_count; i++){
if( do_calls ){ if( do_calls ){

View File

@@ -12,7 +12,7 @@
** This file contains routines used to translate between UTF-8, ** This file contains routines used to translate between UTF-8,
** UTF-16, UTF-16BE, and UTF-16LE. ** UTF-16, UTF-16BE, and UTF-16LE.
** **
** $Id: utf.c,v 1.18 2004/06/06 12:41:50 danielk1977 Exp $ ** $Id: utf.c,v 1.19 2004/06/12 00:42:35 danielk1977 Exp $
** **
** Notes on UTF-8: ** Notes on UTF-8:
** **
@@ -100,8 +100,8 @@ static unsigned char UpperToLower[91] = {
** reads a single character from the string and returns the codepoint value ** reads a single character from the string and returns the codepoint value
** of the character read. ** of the character read.
** **
** The value of *pEnc is the string encoding. If *pEnc is TEXT_Utf16le or ** The value of *pEnc is the string encoding. If *pEnc is SQLITE_UTF16LE or
** TEXT_Utf16be, and the first character read is a byte-order-mark, then ** SQLITE_UTF16BE, and the first character read is a byte-order-mark, then
** the value of *pEnc is modified if necessary. In this case the next ** the value of *pEnc is modified if necessary. In this case the next
** character is read and it's code-point value returned. ** character is read and it's code-point value returned.
** **
@@ -116,7 +116,7 @@ int sqlite3ReadUniChar(const char *zStr, int *pOffset, u8 *pEnc, int fold){
int ret = 0; int ret = 0;
switch( *pEnc ){ switch( *pEnc ){
case TEXT_Utf8: { case SQLITE_UTF8: {
#if 0 #if 0
static const int initVal[] = { static const int initVal[] = {
@@ -184,12 +184,12 @@ int sqlite3ReadUniChar(const char *zStr, int *pOffset, u8 *pEnc, int fold){
break; break;
} }
case TEXT_Utf16le: case SQLITE_UTF16LE:
case TEXT_Utf16be: { case SQLITE_UTF16BE: {
u32 code_point; /* the first code-point in the character */ u32 code_point; /* the first code-point in the character */
u32 code_point2; /* the second code-point in the character, if any */ u32 code_point2; /* the second code-point in the character, if any */
code_point = READ_16(&zStr[*pOffset], (*pEnc==TEXT_Utf16be)); code_point = READ_16(&zStr[*pOffset], (*pEnc==SQLITE_UTF16BE));
*pOffset += 2; *pOffset += 2;
/* If this is a non-surrogate code-point, just cast it to an int and /* If this is a non-surrogate code-point, just cast it to an int and
@@ -211,7 +211,7 @@ int sqlite3ReadUniChar(const char *zStr, int *pOffset, u8 *pEnc, int fold){
** is not enough data left or the next code-point is not a trailing ** is not enough data left or the next code-point is not a trailing
** surrogate, return the replacement character. ** surrogate, return the replacement character.
*/ */
code_point2 = READ_16(&zStr[*pOffset], (*pEnc==TEXT_Utf16be)); code_point2 = READ_16(&zStr[*pOffset], (*pEnc==SQLITE_UTF16BE));
*pOffset += 2; *pOffset += 2;
if( code_point2<0xDC00 || code_point>0xDFFF ){ if( code_point2<0xDC00 || code_point>0xDFFF ){
return (int)0xFFFD; return (int)0xFFFD;
@@ -257,7 +257,7 @@ static int readUtf16Bom(UtfString *pStr, int big_endian){
u8 bom = sqlite3UtfReadBom(pStr->pZ, 2); u8 bom = sqlite3UtfReadBom(pStr->pZ, 2);
if( bom ){ if( bom ){
pStr->c += 2; pStr->c += 2;
return (bom==TEXT_Utf16le)?0:1; return (bom==SQLITE_UTF16LE)?0:1;
} }
} }
@@ -267,8 +267,8 @@ static int readUtf16Bom(UtfString *pStr, int big_endian){
/* /*
** zData is a UTF-16 encoded string, nData bytes in length. This routine ** zData is a UTF-16 encoded string, nData bytes in length. This routine
** checks if there is a byte-order mark at the start of zData. If no ** checks if there is a byte-order mark at the start of zData. If no
** byte order mark is found 0 is returned. Otherwise TEXT_Utf16be or ** byte order mark is found 0 is returned. Otherwise SQLITE_UTF16BE or
** TEXT_Utf16le is returned, depending on whether The BOM indicates that ** SQLITE_UTF16LE is returned, depending on whether The BOM indicates that
** the text is big-endian or little-endian. ** the text is big-endian or little-endian.
*/ */
u8 sqlite3UtfReadBom(const void *zData, int nData){ u8 sqlite3UtfReadBom(const void *zData, int nData){
@@ -276,10 +276,10 @@ u8 sqlite3UtfReadBom(const void *zData, int nData){
u8 b1 = *(u8 *)zData; u8 b1 = *(u8 *)zData;
u8 b2 = *(((u8 *)zData) + 1); u8 b2 = *(((u8 *)zData) + 1);
if( b1==0xFE && b2==0xFF ){ if( b1==0xFE && b2==0xFF ){
return TEXT_Utf16be; return SQLITE_UTF16BE;
} }
if( b1==0xFF && b2==0xFE ){ if( b1==0xFF && b2==0xFE ){
return TEXT_Utf16le; return SQLITE_UTF16LE;
} }
} }
return 0; return 0;
@@ -292,7 +292,7 @@ u8 sqlite3UtfReadBom(const void *zData, int nData){
** strings, the unicode replacement character U+FFFD may be returned. ** strings, the unicode replacement character U+FFFD may be returned.
*/ */
static u32 readUtf8(UtfString *pStr){ static u32 readUtf8(UtfString *pStr){
u8 enc = TEXT_Utf8; u8 enc = SQLITE_UTF8;
return sqlite3ReadUniChar(pStr->pZ, &pStr->c, &enc, 0); return sqlite3ReadUniChar(pStr->pZ, &pStr->c, &enc, 0);
} }
@@ -687,15 +687,15 @@ int sqlite3utfTranslate(
void **zOut, int *nOut, /* Output string */ void **zOut, int *nOut, /* Output string */
u8 enc2 /* Desired encoding of output */ u8 enc2 /* Desired encoding of output */
){ ){
assert( enc1==TEXT_Utf8 || enc1==TEXT_Utf16le || enc1==TEXT_Utf16be ); assert( enc1==SQLITE_UTF8 || enc1==SQLITE_UTF16LE || enc1==SQLITE_UTF16BE );
assert( enc2==TEXT_Utf8 || enc2==TEXT_Utf16le || enc2==TEXT_Utf16be ); assert( enc2==SQLITE_UTF8 || enc2==SQLITE_UTF16LE || enc2==SQLITE_UTF16BE );
assert( assert(
(enc1==TEXT_Utf8 && (enc2==TEXT_Utf16le || enc2==TEXT_Utf16be)) || (enc1==SQLITE_UTF8 && (enc2==SQLITE_UTF16LE || enc2==SQLITE_UTF16BE)) ||
(enc2==TEXT_Utf8 && (enc1==TEXT_Utf16le || enc1==TEXT_Utf16be)) (enc2==SQLITE_UTF8 && (enc1==SQLITE_UTF16LE || enc1==SQLITE_UTF16BE))
); );
if( enc1==TEXT_Utf8 ){ if( enc1==SQLITE_UTF8 ){
if( enc2==TEXT_Utf16le ){ if( enc2==SQLITE_UTF16LE ){
*zOut = sqlite3utf8to16le(zData, nData); *zOut = sqlite3utf8to16le(zData, nData);
}else{ }else{
*zOut = sqlite3utf8to16be(zData, nData); *zOut = sqlite3utf8to16be(zData, nData);
@@ -703,7 +703,7 @@ int sqlite3utfTranslate(
if( !(*zOut) ) return SQLITE_NOMEM; if( !(*zOut) ) return SQLITE_NOMEM;
*nOut = sqlite3utf16ByteLen(*zOut, -1); *nOut = sqlite3utf16ByteLen(*zOut, -1);
}else{ }else{
*zOut = sqlite3utf16to8(zData, nData, enc1==TEXT_Utf16be); *zOut = sqlite3utf16to8(zData, nData, enc1==SQLITE_UTF16BE);
if( !(*zOut) ) return SQLITE_NOMEM; if( !(*zOut) ) return SQLITE_NOMEM;
*nOut = strlen(*zOut); *nOut = strlen(*zOut);
} }

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing ** This file contains functions for allocating memory, comparing
** strings, and stuff like that. ** strings, and stuff like that.
** **
** $Id: util.c,v 1.100 2004/06/09 14:01:53 drh Exp $ ** $Id: util.c,v 1.101 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <stdarg.h> #include <stdarg.h>
@@ -565,8 +565,8 @@ int sqlite3StrNICmp(const char *zLeft, const char *zRight, int N){
** Am empty string is considered non-numeric. ** Am empty string is considered non-numeric.
*/ */
int sqlite3IsNumber(const char *z, int *realnum, u8 enc){ int sqlite3IsNumber(const char *z, int *realnum, u8 enc){
int incr = (enc==TEXT_Utf8?1:2); int incr = (enc==SQLITE_UTF8?1:2);
if( enc==TEXT_Utf16be ) z++; if( enc==SQLITE_UTF16LE ) z++;
if( *z=='-' || *z=='+' ) z += incr; if( *z=='-' || *z=='+' ) z += incr;
if( !isdigit(*z) ){ if( !isdigit(*z) ){
return 0; return 0;
@@ -767,8 +767,8 @@ int sqlite3Compare(const char *atext, const char *btext){
}else if( btext==0 ){ }else if( btext==0 ){
return 1; return 1;
} }
isNumA = sqlite3IsNumber(atext, 0, TEXT_Utf8); isNumA = sqlite3IsNumber(atext, 0, SQLITE_UTF8);
isNumB = sqlite3IsNumber(btext, 0, TEXT_Utf8); isNumB = sqlite3IsNumber(btext, 0, SQLITE_UTF8);
if( isNumA ){ if( isNumA ){
if( !isNumB ){ if( !isNumB ){
result = -1; result = -1;
@@ -859,8 +859,8 @@ int sqlite3SortCompare(const char *a, const char *b){
res = strcmp(&a[1],&b[1]); res = strcmp(&a[1],&b[1]);
if( res ) break; if( res ) break;
}else{ }else{
isNumA = sqlite3IsNumber(&a[1], 0, TEXT_Utf8); isNumA = sqlite3IsNumber(&a[1], 0, SQLITE_UTF8);
isNumB = sqlite3IsNumber(&b[1], 0, TEXT_Utf8); isNumB = sqlite3IsNumber(&b[1], 0, SQLITE_UTF8);
if( isNumA ){ if( isNumA ){
double rA, rB; double rA, rB;
if( !isNumB ){ if( !isNumB ){

View File

@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing ** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code. ** commenting and indentation practices when changing or adding code.
** **
** $Id: vdbe.c,v 1.365 2004/06/11 13:19:21 danielk1977 Exp $ ** $Id: vdbe.c,v 1.366 2004/06/12 00:42:35 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -702,7 +702,7 @@ case OP_Integer: {
pTos->flags = MEM_Str|MEM_Static|MEM_Term; pTos->flags = MEM_Str|MEM_Static|MEM_Term;
pTos->z = pOp->p3; pTos->z = pOp->p3;
pTos->n = strlen(pTos->z); pTos->n = strlen(pTos->z);
pTos->enc = TEXT_Utf8; pTos->enc = SQLITE_UTF8;
Integerify(pTos, 0); Integerify(pTos, 0);
} }
break; break;
@@ -717,7 +717,7 @@ case OP_Real: {
pTos->flags = MEM_Str|MEM_Static|MEM_Term; pTos->flags = MEM_Str|MEM_Static|MEM_Term;
pTos->z = pOp->p3; pTos->z = pOp->p3;
pTos->n = strlen(pTos->z); pTos->n = strlen(pTos->z);
pTos->enc = TEXT_Utf8; pTos->enc = SQLITE_UTF8;
Realify(pTos, 0); Realify(pTos, 0);
break; break;
} }
@@ -730,8 +730,8 @@ case OP_Real: {
case OP_String8: { case OP_String8: {
pOp->opcode = OP_String; pOp->opcode = OP_String;
if( db->enc!=TEXT_Utf8 && pOp->p3 ){ if( db->enc!=SQLITE_UTF8 && pOp->p3 ){
if( db->enc==TEXT_Utf16le ){ if( db->enc==SQLITE_UTF16LE ){
pOp->p3 = sqlite3utf8to16le(pOp->p3, -1); pOp->p3 = sqlite3utf8to16le(pOp->p3, -1);
}else{ }else{
pOp->p3 = sqlite3utf8to16be(pOp->p3, -1); pOp->p3 = sqlite3utf8to16be(pOp->p3, -1);
@@ -753,7 +753,7 @@ case OP_String: {
if( pOp->p3 ){ if( pOp->p3 ){
pTos->flags = MEM_Str|MEM_Static|MEM_Term; pTos->flags = MEM_Str|MEM_Static|MEM_Term;
pTos->z = pOp->p3; pTos->z = pOp->p3;
if( db->enc==TEXT_Utf8 ){ if( db->enc==SQLITE_UTF8 ){
pTos->n = strlen(pTos->z); pTos->n = strlen(pTos->z);
}else{ }else{
pTos->n = sqlite3utf16ByteLen(pTos->z, -1); pTos->n = sqlite3utf16ByteLen(pTos->z, -1);
@@ -1061,7 +1061,7 @@ case OP_Concat: {
mSep.z = pOp->p3; mSep.z = pOp->p3;
mSep.n = strlen(mSep.z); mSep.n = strlen(mSep.z);
mSep.flags = MEM_Str|MEM_Static|MEM_Term; mSep.flags = MEM_Str|MEM_Static|MEM_Term;
mSep.enc = TEXT_Utf8; mSep.enc = SQLITE_UTF8;
sqlite3VdbeChangeEncoding(&mSep, db->enc); sqlite3VdbeChangeEncoding(&mSep, db->enc);
}else{ }else{
mSep.flags = MEM_Null; mSep.flags = MEM_Null;
@@ -1492,16 +1492,16 @@ case OP_MustBeInt: {
pTos->i = i; pTos->i = i;
}else if( pTos->flags & MEM_Str ){ }else if( pTos->flags & MEM_Str ){
i64 v; i64 v;
if( sqlite3VdbeChangeEncoding(pTos, TEXT_Utf8) if( sqlite3VdbeChangeEncoding(pTos, SQLITE_UTF8)
|| sqlite3VdbeMemNulTerminate(pTos) ){ || sqlite3VdbeMemNulTerminate(pTos) ){
goto no_mem; goto no_mem;
} }
if( !sqlite3atoi64(pTos->z, &v) ){ if( !sqlite3atoi64(pTos->z, &v) ){
double r; double r;
if( !sqlite3IsNumber(pTos->z, 0, TEXT_Utf8) ){ if( !sqlite3IsNumber(pTos->z, 0, db->enc) ){
goto mismatch; goto mismatch;
} }
Realify(pTos, TEXT_Utf8); Realify(pTos, db->enc);
v = (int)pTos->r; v = (int)pTos->r;
r = (double)v; r = (double)v;
if( r!=pTos->r ){ if( r!=pTos->r ){
@@ -3929,7 +3929,7 @@ case OP_IntegrityCk: {
pTos->n = strlen(z); pTos->n = strlen(z);
pTos->flags = MEM_Str | MEM_Dyn | MEM_Term; pTos->flags = MEM_Str | MEM_Dyn | MEM_Term;
} }
pTos->enc = TEXT_Utf8; pTos->enc = SQLITE_UTF8;
sqlite3VdbeChangeEncoding(pTos, db->enc); sqlite3VdbeChangeEncoding(pTos, db->enc);
sqliteFree(aRoot); sqliteFree(aRoot);
break; break;

View File

@@ -58,10 +58,10 @@ long long int sqlite3_value_int64(sqlite3_value *pVal){
return pVal->i; return pVal->i;
} }
const unsigned char *sqlite3_value_text(sqlite3_value *pVal){ const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
return (const char *)sqlite3ValueText(pVal, TEXT_Utf8); return (const char *)sqlite3ValueText(pVal, SQLITE_UTF8);
} }
const void *sqlite3_value_text16(sqlite3_value* pVal){ const void *sqlite3_value_text16(sqlite3_value* pVal){
return sqlite3ValueText(pVal, TEXT_Utf16); return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);
} }
int sqlite3_value_type(sqlite3_value* pVal){ int sqlite3_value_type(sqlite3_value* pVal){
return pVal->type; return pVal->type;
@@ -85,11 +85,11 @@ void sqlite3_result_double(sqlite3_context *pCtx, double rVal){
} }
void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){ void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){
pCtx->isError = 1; pCtx->isError = 1;
sqlite3VdbeMemSetStr(&pCtx->s, z, n, TEXT_Utf8, 1); sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, 1);
} }
void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){ void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){
pCtx->isError = 1; pCtx->isError = 1;
sqlite3VdbeMemSetStr(&pCtx->s, z, n, TEXT_Utf16, 1); sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, 1);
} }
void sqlite3_result_int(sqlite3_context *pCtx, int iVal){ void sqlite3_result_int(sqlite3_context *pCtx, int iVal){
sqlite3VdbeMemSetInt64(&pCtx->s, (i64)iVal); sqlite3VdbeMemSetInt64(&pCtx->s, (i64)iVal);
@@ -106,7 +106,7 @@ void sqlite3_result_text(
int n, int n,
int eCopy int eCopy
){ ){
sqlite3VdbeMemSetStr(&pCtx->s, z, n, TEXT_Utf8, eCopy); sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, eCopy);
} }
void sqlite3_result_text16( void sqlite3_result_text16(
sqlite3_context *pCtx, sqlite3_context *pCtx,
@@ -114,7 +114,7 @@ void sqlite3_result_text16(
int n, int n,
int eCopy int eCopy
){ ){
sqlite3VdbeMemSetStr(&pCtx->s, z, n, TEXT_Utf16, eCopy); sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, eCopy);
} }
void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){ void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
sqlite3VdbeMemCopy(&pCtx->s, pValue); sqlite3VdbeMemCopy(&pCtx->s, pValue);
@@ -474,7 +474,7 @@ int sqlite3_bind_text(
return rc; return rc;
} }
pVar = &p->apVar[i-1]; pVar = &p->apVar[i-1];
rc = sqlite3VdbeMemSetStr(pVar, zData, nData, TEXT_Utf8, eCopy); rc = sqlite3VdbeMemSetStr(pVar, zData, nData, SQLITE_UTF8, eCopy);
if( rc ){ if( rc ){
return rc; return rc;
} }
@@ -499,7 +499,7 @@ int sqlite3_bind_text16(
pVar = &p->apVar[i-1]; pVar = &p->apVar[i-1];
/* There may or may not be a byte order mark at the start of the UTF-16. /* There may or may not be a byte order mark at the start of the UTF-16.
** Either way set 'txt_enc' to the TEXT_Utf16* value indicating the ** Either way set 'txt_enc' to the SQLITE_UTF16* value indicating the
** actual byte order used by this string. If the string does happen ** actual byte order used by this string. If the string does happen
** to contain a BOM, then move zData so that it points to the first ** to contain a BOM, then move zData so that it points to the first
** byte after the BOM. ** byte after the BOM.
@@ -509,7 +509,7 @@ int sqlite3_bind_text16(
zData = (void *)(((u8 *)zData) + 2); zData = (void *)(((u8 *)zData) + 2);
nData -= 2; nData -= 2;
}else{ }else{
txt_enc = SQLITE_BIGENDIAN?TEXT_Utf16be:TEXT_Utf16le; txt_enc = SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE;
} }
rc = sqlite3VdbeMemSetStr(pVar, zData, nData, txt_enc, eCopy); rc = sqlite3VdbeMemSetStr(pVar, zData, nData, txt_enc, eCopy);
if( rc ){ if( rc ){

View File

@@ -579,7 +579,7 @@ int sqlite3VdbeList(
pMem->z = sqlite3OpcodeNames[pOp->opcode]; /* Opcode */ pMem->z = sqlite3OpcodeNames[pOp->opcode]; /* Opcode */
pMem->n = strlen(pMem->z); pMem->n = strlen(pMem->z);
pMem->type = SQLITE_TEXT; pMem->type = SQLITE_TEXT;
pMem->enc = TEXT_Utf8; pMem->enc = SQLITE_UTF8;
pMem++; pMem++;
pMem->flags = MEM_Int; pMem->flags = MEM_Int;
@@ -595,7 +595,7 @@ int sqlite3VdbeList(
pMem->flags = MEM_Short|MEM_Str|MEM_Term; /* P3 */ pMem->flags = MEM_Short|MEM_Str|MEM_Term; /* P3 */
pMem->z = displayP3(pOp, pMem->zShort, sizeof(pMem->zShort)); pMem->z = displayP3(pOp, pMem->zShort, sizeof(pMem->zShort));
pMem->type = SQLITE_TEXT; pMem->type = SQLITE_TEXT;
pMem->enc = TEXT_Utf8; pMem->enc = SQLITE_UTF8;
p->nResColumn = 5; p->nResColumn = 5;
p->pTos = pMem; p->pTos = pMem;
@@ -1008,9 +1008,9 @@ int sqlite3VdbeSetColName(Vdbe *p, int idx, const char *zName, int N){
pColName = &(p->aColName[idx]); pColName = &(p->aColName[idx]);
if( N==0 ){ if( N==0 ){
rc = sqlite3VdbeMemSetStr(pColName, zName, -1, TEXT_Utf8, 1); rc = sqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, 1);
}else{ }else{
rc = sqlite3VdbeMemSetStr(pColName, zName, N, TEXT_Utf8, N>0); rc = sqlite3VdbeMemSetStr(pColName, zName, N, SQLITE_UTF8, N>0);
} }
if( rc==SQLITE_OK && N==P3_DYNAMIC ){ if( rc==SQLITE_OK && N==P3_DYNAMIC ){
pColName->flags = (pColName->flags&(~MEM_Static))|MEM_Dyn; pColName->flags = (pColName->flags&(~MEM_Static))|MEM_Dyn;

View File

@@ -41,7 +41,7 @@ int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
return SQLITE_OK; return SQLITE_OK;
} }
if( pMem->enc==TEXT_Utf8 || desiredEnc==TEXT_Utf8 ){ if( pMem->enc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF8 ){
/* If the current encoding does not match the desired encoding, then /* If the current encoding does not match the desired encoding, then
** we will need to do some translation between encodings. ** we will need to do some translation between encodings.
*/ */
@@ -191,7 +191,7 @@ int sqlite3VdbeMemStringify(Mem *pMem, int enc){
} }
pMem->n = strlen(z); pMem->n = strlen(z);
pMem->z = z; pMem->z = z;
pMem->enc = TEXT_Utf8; pMem->enc = SQLITE_UTF8;
pMem->flags |= MEM_Str | MEM_Short | MEM_Term; pMem->flags |= MEM_Str | MEM_Short | MEM_Term;
sqlite3VdbeChangeEncoding(pMem, enc); sqlite3VdbeChangeEncoding(pMem, enc);
} }
@@ -219,7 +219,7 @@ int sqlite3VdbeMemIntegerify(Mem *pMem){
}else if( flags & MEM_Real ){ }else if( flags & MEM_Real ){
pMem->i = (i64)pMem->r; pMem->i = (i64)pMem->r;
}else if( flags & (MEM_Str|MEM_Blob) ){ }else if( flags & (MEM_Str|MEM_Blob) ){
if( sqlite3VdbeChangeEncoding(pMem, TEXT_Utf8) if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
|| sqlite3VdbeMemNulTerminate(pMem) ){ || sqlite3VdbeMemNulTerminate(pMem) ){
return SQLITE_NOMEM; return SQLITE_NOMEM;
} }
@@ -243,7 +243,7 @@ int sqlite3VdbeMemRealify(Mem *pMem){
}else if( (pMem->flags & MEM_Int) && pMem->type!=SQLITE_TEXT ){ }else if( (pMem->flags & MEM_Int) && pMem->type!=SQLITE_TEXT ){
pMem->r = pMem->i; pMem->r = pMem->i;
}else if( pMem->flags & (MEM_Str|MEM_Blob) ){ }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
if( sqlite3VdbeChangeEncoding(pMem, TEXT_Utf8) if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
|| sqlite3VdbeMemNulTerminate(pMem) ){ || sqlite3VdbeMemNulTerminate(pMem) ){
return SQLITE_NOMEM; return SQLITE_NOMEM;
} }
@@ -332,7 +332,7 @@ int sqlite3VdbeMemSetStr(
pMem->flags |= MEM_Blob; pMem->flags |= MEM_Blob;
break; break;
case TEXT_Utf8: case SQLITE_UTF8:
pMem->flags |= MEM_Str; pMem->flags |= MEM_Str;
if( n<0 ){ if( n<0 ){
pMem->n = strlen(z); pMem->n = strlen(z);
@@ -340,8 +340,8 @@ int sqlite3VdbeMemSetStr(
} }
break; break;
case TEXT_Utf16le: case SQLITE_UTF16LE:
case TEXT_Utf16be: case SQLITE_UTF16BE:
pMem->flags |= MEM_Str; pMem->flags |= MEM_Str;
if( n<0 ){ if( n<0 ){
pMem->n = sqlite3utf16ByteLen(z,-1); pMem->n = sqlite3utf16ByteLen(z,-1);
@@ -433,8 +433,8 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
} }
assert( pMem1->enc==pMem2->enc ); assert( pMem1->enc==pMem2->enc );
assert( pMem1->enc==TEXT_Utf8 || assert( pMem1->enc==SQLITE_UTF8 ||
pMem1->enc==TEXT_Utf16le || pMem1->enc==TEXT_Utf16be ); pMem1->enc==SQLITE_UTF16LE || pMem1->enc==SQLITE_UTF16BE );
/* FIX ME: This may fail if the collation sequence is deleted after /* FIX ME: This may fail if the collation sequence is deleted after
** this vdbe program is compiled. We cannot just use BINARY in this ** this vdbe program is compiled. We cannot just use BINARY in this
@@ -554,14 +554,14 @@ void sqlite3VdbeMemSanity(Mem *pMem, u8 db_enc){
assert( (pMem->flags & MEM_Short)!=0 || pMem->z!=pMem->zShort ); assert( (pMem->flags & MEM_Short)!=0 || pMem->z!=pMem->zShort );
if( (flags & MEM_Str) ){ if( (flags & MEM_Str) ){
assert( pMem->enc==TEXT_Utf8 || assert( pMem->enc==SQLITE_UTF8 ||
pMem->enc==TEXT_Utf16le || pMem->enc==SQLITE_UTF16BE ||
pMem->enc==TEXT_Utf16be pMem->enc==SQLITE_UTF16LE
); );
/* If the string is UTF-8 encoded and nul terminated, then pMem->n /* If the string is UTF-8 encoded and nul terminated, then pMem->n
** must be the length of the string. ** must be the length of the string.
*/ */
if( pMem->enc==TEXT_Utf8 && (flags & MEM_Term) ){ if( pMem->enc==SQLITE_UTF8 && (flags & MEM_Term) ){
assert( strlen(pMem->z)==pMem->n ); assert( strlen(pMem->z)==pMem->n );
} }
} }

View File

@@ -1,4 +1,4 @@
set rcsid {$Id: capi3ref.tcl,v 1.2 2004/06/11 17:48:04 drh Exp $} set rcsid {$Id: capi3ref.tcl,v 1.3 2004/06/12 00:42:36 danielk1977 Exp $}
source common.tcl source common.tcl
header {C/C++ Interface For SQLite Version 3} header {C/C++ Interface For SQLite Version 3}
puts { puts {
@@ -330,9 +330,9 @@ int sqlite3_create_collation16(
int(*xCompare)(void*,int,const void*,int,const void*) int(*xCompare)(void*,int,const void*,int,const void*)
); );
#define SQLITE_UTF8 1 #define SQLITE_UTF8 1
#define SQLITE_UTF16 2 #define SQLITE_UTF16BE 2
#define SQLITE_UTF16BE 3 #define SQLITE_UTF16LE 3
#define SQLITE_UTF16LE 4 #define SQLITE_UTF16 4
} { } {
These two functions are used to add new collation sequences to the These two functions are used to add new collation sequences to the
sqlite3 handle specified as the first argument. sqlite3 handle specified as the first argument.