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

Change all SQLITE3 preprocessor macros to SQLITE. Documentation updates. (CVS 1511)

FossilOrigin-Name: adf7e29ff60dc559f64832fadb09f0b9decc0e76
This commit is contained in:
drh
2004-05-31 18:51:57 +00:00
parent 1d482dd917
commit 9c054830b4
20 changed files with 179 additions and 141 deletions

View File

@@ -1,5 +1,5 @@
C Change\sthe\sname\sof\sthe\sinclude\sfile\sto\s"sqlite3.h".\s\sThe\snames\sof\sthe\sshell\ncommand\sand\sstatic\slibrary\sbecome\s"sqlite3"\sand\s"libsqlite3.a".\s(CVS\s1510) C Change\sall\sSQLITE3\spreprocessor\smacros\sto\sSQLITE.\s\sDocumentation\supdates.\s(CVS\s1511)
D 2004-05-31T18:23:08 D 2004-05-31T18:51:58
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -26,17 +26,17 @@ F src/attach.c c315c58cb16fd6e913b3bfa6412aedecb4567fa5
F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79 F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79
F src/btree.c 652efb14a17ba26759f73ca167f7d1e5d6651eb3 F src/btree.c 652efb14a17ba26759f73ca167f7d1e5d6651eb3
F src/btree.h 1e2beb41b4b4a4fc41da67cb4692614938066f2f F src/btree.h 1e2beb41b4b4a4fc41da67cb4692614938066f2f
F src/build.c 2f791d1d52778b9a2ec251465215ca480a966f36 F src/build.c 13985630bf6b3db4c7e7d4c9476bb94495b7d5fa
F src/date.c 0eb922af5c5f5e2455f8dc2f98023ed3e04a857e F src/date.c 8e6fa3173386fb29fdef012ee08a853c1e9908b2
F src/delete.c 72f8febf6170cda830f509c8f9dffbed3df3596c F src/delete.c 72f8febf6170cda830f509c8f9dffbed3df3596c
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37 F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
F src/expr.c 5145de7d25a4b960a4afdb754a9e88b60cce0405 F src/expr.c 5145de7d25a4b960a4afdb754a9e88b60cce0405
F src/func.c 1fe0763675eb38b6e3992d3edfbec2271798b658 F src/func.c 3b87e2e8b9aaa3a6d36b2c9616e7f404be38a667
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
F src/insert.c 4268d9e3959cc845ea243fb4ec7507269404dad9 F src/insert.c 4268d9e3959cc845ea243fb4ec7507269404dad9
F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f
F src/main.c 9bb9578c15db0205616fcf474885b83aba53d910 F src/main.c b4aed6c790ecae05a345c684e178aa88dccd274b
F src/md5.c 4302e84ae516c616bb079c4e6d038c0addb33481 F src/md5.c 4302e84ae516c616bb079c4e6d038c0addb33481
F src/os.h ab42f4a7c4c716f26b988e759b6e12085a3bfc67 F src/os.h ab42f4a7c4c716f26b988e759b6e12085a3bfc67
F src/os_common.h 744286a27de55c52f1b18921e8d17abbf7fafc0f F src/os_common.h 744286a27de55c52f1b18921e8d17abbf7fafc0f
@@ -54,27 +54,27 @@ F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c 0297717eb7331604687c2e29c147d3a311359df1 F src/select.c 0297717eb7331604687c2e29c147d3a311359df1
F src/shell.c b71bdc3586c1c254941a236f3461615fd032eab1 F src/shell.c b71bdc3586c1c254941a236f3461615fd032eab1
F src/sqlite.h.in edc6408c7f53c2104f781a76b926036e17018ec9 F src/sqlite.h.in 88b6f09398c9e5b4d2dd7420597e0d6490a81b1f
F src/sqliteInt.h de20432992233b394a7fc80458f03d7cb7138bc5 F src/sqliteInt.h 950104baea45ee81c9113e3c41b5e9f30def9eaa
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2 F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
F src/tclsqlite.c b314f12760547e4ef090e055f1298f70627450d3 F src/tclsqlite.c 8146beb4ade50cd83d3bf7a41c8ebddb9840e967
F src/test1.c 32934478366531503d634968db414df17cb38238 F src/test1.c 187992df6d835d1d713dd154c6ea4a6929302378
F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872 F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872
F src/test3.c 86117b74ec7353d76f5cd85c144c7cda23a7e11b F src/test3.c 86117b74ec7353d76f5cd85c144c7cda23a7e11b
F src/test4.c 34848a9fd31aa65857b20a8bfc03aff77d8c3426 F src/test4.c 34848a9fd31aa65857b20a8bfc03aff77d8c3426
F src/test5.c 9a1f15133f6955f067c5246e564723b5f23ff221 F src/test5.c a894fbfa8a7dcdc2cbc0c38c11149cc5c8252cea
F src/tokenize.c 50a87c7414de54a008427c9fed22e4e86efb6844 F src/tokenize.c b68758abaccd8882c48209b7a54db975f17d498a
F src/trigger.c 04b2c310d0d056b213609cab6df5fff03d5eaf88 F src/trigger.c 04b2c310d0d056b213609cab6df5fff03d5eaf88
F src/update.c 259f06e7b22c684b2d3dda54a18185892d6e9573 F src/update.c 259f06e7b22c684b2d3dda54a18185892d6e9573
F src/utf.c f8604999a54483533ac20a63879074f01b0df384 F src/utf.c c18b4e66bd13872b7199444addaa04785ff1b80a
F src/util.c 3b647719c0bece41491300b605cff96a7a26f03a F src/util.c 3b647719c0bece41491300b605cff96a7a26f03a
F src/vacuum.c c91acc316127411980982938d050b299d42b81ef F src/vacuum.c c91acc316127411980982938d050b299d42b81ef
F src/vdbe.c fdb990a681d39872047fec65fffaedb7225e7420 F src/vdbe.c bff63e4fe25a1378bfb6e577fbba3291a4e3625a
F src/vdbe.h e73f890e0f2a6c42b183d7d6937947930fe4fdeb F src/vdbe.h e73f890e0f2a6c42b183d7d6937947930fe4fdeb
F src/vdbeInt.h 51d37798ba7bc5f2f767db0e3dbae31156ae9ff3 F src/vdbeInt.h 5d357541db688b21ce05a88b3ea4d9a1fb09f232
F src/vdbeapi.c d43d36efeaf709bae71b743aaaee430e0b29cd1e F src/vdbeapi.c 77d2e681a992ef189032cd9c1b7bf922f01ebe3e
F src/vdbeaux.c a6af136bc6928eb6656d0198ae1dfcc313f37c23 F src/vdbeaux.c a422970213a2fe9b0048df756fc81f20939eeada
F src/vdbemem.c 627d714c347f6af8092cc48ae1c06fd774a1ad9c F src/vdbemem.c 5d029d83bc60eaf9c45837fcbc0b03348ec95d7a
F src/where.c 444a7c3a8b1eb7bba072e489af628555d21d92a4 F src/where.c 444a7c3a8b1eb7bba072e489af628555d21d92a4
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test 5f7e21fce56e3055de15a86c58fa3d8ab74f5243 F test/attach.test 5f7e21fce56e3055de15a86c58fa3d8ab74f5243
@@ -184,14 +184,14 @@ F www/arch2.fig 613b5ac63511109064c2f93c5754ee662219937d
F www/arch2.gif 49c6bb36160f03ca2b89eaa5bfb1f560c7d68ee7 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 79fec496d95e87420c40e4058f2685a6df2f93c7 F www/capi3.tcl 2825f418f5c5d8376d0e83474796363db1d9e875
F www/changes.tcl 9d562205db584d26b358ebe93fb58039feefd1b8 F www/changes.tcl 9d562205db584d26b358ebe93fb58039feefd1b8
F www/common.tcl f786e6be86fb2627ceb30e770e9efa83b9c67a3a F www/common.tcl f786e6be86fb2627ceb30e770e9efa83b9c67a3a
F www/conflict.tcl fb8a2ba83746c7fdfd9e52fa7f6aaf5c422b8246 F www/conflict.tcl fb8a2ba83746c7fdfd9e52fa7f6aaf5c422b8246
F www/copyright-release.html 294e011760c439c44951a6bfecd4c81a1ae359e8 F www/copyright-release.html 294e011760c439c44951a6bfecd4c81a1ae359e8
F www/copyright-release.pdf cfca3558fc97095e57c6117d08f1f5b80d95125a F www/copyright-release.pdf cfca3558fc97095e57c6117d08f1f5b80d95125a
F www/copyright.tcl 82c9670c7ddb0311912ab7fe24703f33c531066c F www/copyright.tcl 82c9670c7ddb0311912ab7fe24703f33c531066c
F www/datatype3.tcl 3dcc0baaccc7d3bc28e12a3acc45f5ab7f723ca2 F www/datatype3.tcl ddfc758410109cb6a9bd617836b9334a7ddbd929
F www/datatypes.tcl 566004b81c36877397ddbe6e1907aae6065f6b41 F www/datatypes.tcl 566004b81c36877397ddbe6e1907aae6065f6b41
F www/docs.tcl 5ea8a84edd33030879725fca85905899c89c7075 F www/docs.tcl 5ea8a84edd33030879725fca85905899c89c7075
F www/download.tcl 8c84f15695c92cb01486930055fdf5192995f474 F www/download.tcl 8c84f15695c92cb01486930055fdf5192995f474
@@ -212,7 +212,7 @@ F www/support.tcl 67682848d6ddd283370451dc3da2e56cded9fc9a
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 2005bfdad03ac2aa70a82ba7ff9b2f469d129367 P 4c37b6d2b78e88e2a9dfed4d764caeb0f626f92e
R 783e591d80614a85072d6745be4be04f R 89ae3d2c6e5f559c1b737a98efcaeabb
U drh U drh
Z bb28014f004f9d7fe5e7794b01035f95 Z b0d4078bb2a2022230156e75979ba4b4

View File

@@ -1 +1 @@
4c37b6d2b78e88e2a9dfed4d764caeb0f626f92e adf7e29ff60dc559f64832fadb09f0b9decc0e76

View File

@@ -23,7 +23,7 @@
** ROLLBACK ** ROLLBACK
** PRAGMA ** PRAGMA
** **
** $Id: build.c,v 1.204 2004/05/31 11:51:45 danielk1977 Exp $ ** $Id: build.c,v 1.205 2004/05/31 18:51:58 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -886,6 +886,9 @@ char sqlite3AffinityType(const char *zType, int nType){
{"BLOB", 4, SQLITE_AFF_NONE}, {"BLOB", 4, SQLITE_AFF_NONE},
}; };
if( nType==0 ){
return SQLITE_AFF_NONE;
}
for(i=0; i<sizeof(substrings)/sizeof(substrings[0]); i++){ for(i=0; i<sizeof(substrings)/sizeof(substrings[0]); i++){
int c1 = substrings[i].zSub[0]; int c1 = substrings[i].zSub[0];
int c2 = tolower(c1); int c2 = tolower(c1);

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.26 2004/05/26 23:25:31 drh Exp $ ** $Id: date.c,v 1.27 2004/05/31 18:51:58 drh Exp $
** **
** NOTES: ** NOTES:
** **
@@ -644,10 +644,10 @@ static int parseModifier(const char *zMod, DateTime *p){
static int isDate(int argc, sqlite3_value **argv, DateTime *p){ static int isDate(int argc, sqlite3_value **argv, DateTime *p){
int i; int i;
if( argc==0 ) return 1; if( argc==0 ) return 1;
if( SQLITE3_NULL==sqlite3_value_type(argv[0]) || if( SQLITE_NULL==sqlite3_value_type(argv[0]) ||
parseDateOrTime(sqlite3_value_text(argv[0]), p) ) return 1; parseDateOrTime(sqlite3_value_text(argv[0]), p) ) return 1;
for(i=1; i<argc; i++){ for(i=1; i<argc; i++){
if( SQLITE3_NULL==sqlite3_value_type(argv[i]) || if( SQLITE_NULL==sqlite3_value_type(argv[i]) ||
parseModifier(sqlite3_value_text(argv[i]), p) ) return 1; parseModifier(sqlite3_value_text(argv[i]), p) ) return 1;
} }
return 0; return 0;

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.61 2004/05/27 10:30:53 danielk1977 Exp $ ** $Id: func.c,v 1.62 2004/05/31 18:51:58 drh Exp $
*/ */
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
@@ -42,9 +42,9 @@ static void minmaxFunc(
mask = (int)sqlite3_user_data(context); mask = (int)sqlite3_user_data(context);
assert( mask==-1 || mask==0 ); assert( mask==-1 || mask==0 );
iBest = 0; iBest = 0;
if( sqlite3_value_type(argv[0])==SQLITE3_NULL ) return; if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
for(i=1; i<argc; i++){ for(i=1; i<argc; i++){
if( sqlite3_value_type(argv[i])==SQLITE3_NULL ) return; if( sqlite3_value_type(argv[i])==SQLITE_NULL ) return;
if( (sqlite3MemCompare(argv[iBest], argv[i], 0)^mask)>=0 ){ if( (sqlite3MemCompare(argv[iBest], argv[i], 0)^mask)>=0 ){
iBest = i; iBest = i;
} }
@@ -62,11 +62,11 @@ static void typeofFunc(
){ ){
const char *z = 0; const char *z = 0;
switch( sqlite3_value_type(argv[0]) ){ switch( sqlite3_value_type(argv[0]) ){
case SQLITE3_NULL: z = "null"; break; case SQLITE_NULL: z = "null"; break;
case SQLITE3_INTEGER: z = "integer"; break; case SQLITE_INTEGER: z = "integer"; break;
case SQLITE3_TEXT: z = "text"; break; case SQLITE_TEXT: z = "text"; break;
case SQLITE3_FLOAT: z = "real"; break; case SQLITE_FLOAT: z = "real"; break;
case SQLITE3_BLOB: z = "blob"; break; case SQLITE_BLOB: z = "blob"; break;
} }
sqlite3_result_text(context, z, -1, 0); sqlite3_result_text(context, z, -1, 0);
} }
@@ -83,13 +83,13 @@ static void lengthFunc(
assert( argc==1 ); assert( argc==1 );
switch( sqlite3_value_type(argv[0]) ){ switch( sqlite3_value_type(argv[0]) ){
case SQLITE3_BLOB: case SQLITE_BLOB:
case SQLITE3_INTEGER: case SQLITE_INTEGER:
case SQLITE3_FLOAT: { case SQLITE_FLOAT: {
sqlite3_result_int(context, sqlite3_value_bytes(argv[0])); sqlite3_result_int(context, sqlite3_value_bytes(argv[0]));
break; break;
} }
case SQLITE3_TEXT: { case SQLITE_TEXT: {
const char *z = sqlite3_value_text(argv[0]); const char *z = sqlite3_value_text(argv[0]);
for(len=0; *z; z++){ if( (0xc0&*z)!=0x80 ) len++; } for(len=0; *z; z++){ if( (0xc0&*z)!=0x80 ) len++; }
sqlite3_result_int(context, len); sqlite3_result_int(context, len);
@@ -108,13 +108,13 @@ static void lengthFunc(
static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
assert( argc==1 ); assert( argc==1 );
switch( sqlite3_value_type(argv[0]) ){ switch( sqlite3_value_type(argv[0]) ){
case SQLITE3_INTEGER: { case SQLITE_INTEGER: {
i64 iVal = sqlite3_value_int64(argv[0]); i64 iVal = sqlite3_value_int64(argv[0]);
if( iVal<0 ) iVal = iVal * -1; if( iVal<0 ) iVal = iVal * -1;
sqlite3_result_int64(context, iVal); sqlite3_result_int64(context, iVal);
break; break;
} }
case SQLITE3_NULL: { case SQLITE_NULL: {
sqlite3_result_null(context); sqlite3_result_null(context);
break; break;
} }
@@ -179,12 +179,12 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
char zBuf[100]; char zBuf[100];
assert( argc==1 || argc==2 ); assert( argc==1 || argc==2 );
if( argc==2 ){ if( argc==2 ){
if( SQLITE3_NULL==sqlite3_value_type(argv[1]) ) return; if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;
n = sqlite3_value_int(argv[1]); n = sqlite3_value_int(argv[1]);
if( n>30 ) n = 30; if( n>30 ) n = 30;
if( n<0 ) n = 0; if( n<0 ) n = 0;
} }
if( SQLITE3_NULL==sqlite3_value_type(argv[0]) ) return; if( SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
r = sqlite3_value_double(argv[0]); r = sqlite3_value_double(argv[0]);
sprintf(zBuf,"%.*f",n,r); sprintf(zBuf,"%.*f",n,r);
sqlite3_result_text(context, zBuf, -1, 1); sqlite3_result_text(context, zBuf, -1, 1);
@@ -196,7 +196,7 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
char *z; char *z;
int i; int i;
if( argc<1 || SQLITE3_NULL==sqlite3_value_type(argv[0]) ) return; if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
z = sqliteMalloc(sqlite3_value_bytes(argv[0])+1); z = sqliteMalloc(sqlite3_value_bytes(argv[0])+1);
if( z==0 ) return; if( z==0 ) return;
strcpy(z, sqlite3_value_text(argv[0])); strcpy(z, sqlite3_value_text(argv[0]));
@@ -209,7 +209,7 @@ static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
char *z; char *z;
int i; int i;
if( argc<1 || SQLITE3_NULL==sqlite3_value_type(argv[0]) ) return; if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
z = sqliteMalloc(sqlite3_value_bytes(argv[0])+1); z = sqliteMalloc(sqlite3_value_bytes(argv[0])+1);
if( z==0 ) return; if( z==0 ) return;
strcpy(z, sqlite3_value_text(argv[0])); strcpy(z, sqlite3_value_text(argv[0]));
@@ -232,7 +232,7 @@ static void ifnullFunc(
){ ){
int i; int i;
for(i=0; i<argc; i++){ for(i=0; i<argc; i++){
if( SQLITE3_NULL!=sqlite3_value_type(argv[i]) ){ if( SQLITE_NULL!=sqlite3_value_type(argv[i]) ){
sqlite3_result_value(context, argv[i]); sqlite3_result_value(context, argv[i]);
break; break;
} }
@@ -371,17 +371,17 @@ static void versionFunc(
static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
if( argc<1 ) return; if( argc<1 ) return;
switch( sqlite3_value_type(argv[0]) ){ switch( sqlite3_value_type(argv[0]) ){
case SQLITE3_NULL: { case SQLITE_NULL: {
sqlite3_result_text(context, "NULL", 4, 0); sqlite3_result_text(context, "NULL", 4, 0);
break; break;
} }
case SQLITE3_INTEGER: case SQLITE_INTEGER:
case SQLITE3_FLOAT: { case SQLITE_FLOAT: {
sqlite3_result_value(context, argv[0]); sqlite3_result_value(context, argv[0]);
break; break;
} }
case SQLITE3_BLOB: /*** FIX ME. Use a BLOB encoding ***/ case SQLITE_BLOB: /*** FIX ME. Use a BLOB encoding ***/
case SQLITE3_TEXT: { case SQLITE_TEXT: {
int i,j,n; int i,j,n;
const char *zArg = sqlite3_value_text(argv[0]); const char *zArg = sqlite3_value_text(argv[0]);
char *z; char *z;
@@ -504,7 +504,7 @@ static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){
SumCtx *p; SumCtx *p;
if( argc<1 ) return; if( argc<1 ) return;
p = sqlite3_aggregate_context(context, sizeof(*p)); p = sqlite3_aggregate_context(context, sizeof(*p));
if( p && SQLITE3_NULL!=sqlite3_value_type(argv[0]) ){ if( p && SQLITE_NULL!=sqlite3_value_type(argv[0]) ){
p->sum += sqlite3_value_double(argv[0]); p->sum += sqlite3_value_double(argv[0]);
p->cnt++; p->cnt++;
} }
@@ -575,7 +575,7 @@ struct CountCtx {
static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){ static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){
CountCtx *p; CountCtx *p;
p = sqlite3_aggregate_context(context, sizeof(*p)); p = sqlite3_aggregate_context(context, sizeof(*p));
if( (argc==0 || SQLITE3_NULL!=sqlite3_value_type(argv[0])) && p ){ if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){
p->n++; p->n++;
} }
} }
@@ -604,7 +604,7 @@ static void minmaxStep(sqlite3_context *context, int argc, sqlite3_value **argv)
Mem *pArg = (Mem *)argv[0]; Mem *pArg = (Mem *)argv[0];
Mem *pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest)); Mem *pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));
if( SQLITE3_NULL==sqlite3_value_type(argv[0]) ) return; if( SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
if( pBest->flags ){ if( pBest->flags ){
/* This step function is used for both the min() and max() aggregates, /* This step function is used for both the min() and max() aggregates,

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.198 2004/05/31 08:55:34 danielk1977 Exp $ ** $Id: main.c,v 1.199 2004/05/31 18:51:58 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -30,8 +30,8 @@ typedef struct {
} InitData; } InitData;
/* /*
** The following constant value is used by the SQLITE3_BIGENDIAN and ** The following constant value is used by the SQLITE_BIGENDIAN and
** SQLITE3_LITTLEENDIAN macros. ** SQLITE_LITTLEENDIAN macros.
*/ */
const int sqlite3one = 1; const int sqlite3one = 1;
@@ -692,7 +692,7 @@ int sqlite3_create_function16(
){ ){
int rc; int rc;
char *zFunctionName8; char *zFunctionName8;
zFunctionName8 = sqlite3utf16to8(zFunctionName, -1, SQLITE3_BIGENDIAN); zFunctionName8 = sqlite3utf16to8(zFunctionName, -1, SQLITE_BIGENDIAN);
if( !zFunctionName8 ){ if( !zFunctionName8 ){
return SQLITE_NOMEM; return SQLITE_NOMEM;
} }
@@ -819,7 +819,7 @@ const void *sqlite3_errmsg16(sqlite3 *db){
}; };
static char *outOfMemLe = &outOfMemBe[1]; static char *outOfMemLe = &outOfMemBe[1];
if( SQLITE3_BIGENDIAN ){ if( SQLITE_BIGENDIAN ){
return (void *)outOfMemBe; return (void *)outOfMemBe;
}else{ }else{
return (void *)outOfMemLe; return (void *)outOfMemLe;
@@ -827,7 +827,7 @@ const void *sqlite3_errmsg16(sqlite3 *db){
} }
if( !db->zErrMsg16 ){ if( !db->zErrMsg16 ){
char const *zErr8 = sqlite3_errmsg(db); char const *zErr8 = sqlite3_errmsg(db);
if( SQLITE3_BIGENDIAN ){ if( SQLITE_BIGENDIAN ){
db->zErrMsg16 = sqlite3utf8to16be(zErr8, -1); db->zErrMsg16 = sqlite3utf8to16be(zErr8, -1);
}else{ }else{
db->zErrMsg16 = sqlite3utf8to16le(zErr8, -1); db->zErrMsg16 = sqlite3utf8to16le(zErr8, -1);
@@ -960,7 +960,7 @@ int sqlite3_prepare16(
char const *zTail8 = 0; char const *zTail8 = 0;
int rc; int rc;
zSql8 = sqlite3utf16to8(zSql, nBytes, SQLITE3_BIGENDIAN); zSql8 = sqlite3utf16to8(zSql, nBytes, SQLITE_BIGENDIAN);
if( !zSql8 ){ if( !zSql8 ){
sqlite3Error(db, SQLITE_NOMEM, 0); sqlite3Error(db, SQLITE_NOMEM, 0);
return SQLITE_NOMEM; return SQLITE_NOMEM;
@@ -1090,7 +1090,7 @@ int sqlite3_open16(
assert( ppDb ); assert( ppDb );
zFilename8 = sqlite3utf16to8(zFilename, -1, SQLITE3_BIGENDIAN); zFilename8 = sqlite3utf16to8(zFilename, -1, SQLITE_BIGENDIAN);
if( !zFilename8 ){ if( !zFilename8 ){
*ppDb = 0; *ppDb = 0;
return SQLITE_NOMEM; return SQLITE_NOMEM;
@@ -1098,7 +1098,7 @@ int sqlite3_open16(
/* FIX ME: Also need to translate the option strings */ /* FIX ME: Also need to translate the option strings */
if( SQLITE3_BIGENDIAN ){ if( SQLITE_BIGENDIAN ){
rc = openDatabase(zFilename8, ppDb, options, TEXT_Utf16be); rc = openDatabase(zFilename8, ppDb, options, TEXT_Utf16be);
}else{ }else{
rc = openDatabase(zFilename8, ppDb, options, TEXT_Utf16le); rc = openDatabase(zFilename8, ppDb, options, TEXT_Utf16le);

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.85 2004/05/27 23:56:16 danielk1977 Exp $ ** @(#) $Id: sqlite.h.in,v 1.86 2004/05/31 18:51:58 drh Exp $
*/ */
#ifndef _SQLITE_H_ #ifndef _SQLITE_H_
#define _SQLITE_H_ #define _SQLITE_H_
@@ -768,11 +768,11 @@ int sqlite3_data_count(sqlite3_stmt *pStmt);
** Values are stored in the database in one of the following fundamental ** Values are stored in the database in one of the following fundamental
** types. ** types.
*/ */
#define SQLITE3_INTEGER 1 #define SQLITE_INTEGER 1
#define SQLITE3_FLOAT 2 #define SQLITE_FLOAT 2
#define SQLITE3_TEXT 3 #define SQLITE_TEXT 3
#define SQLITE3_BLOB 4 #define SQLITE_BLOB 4
#define SQLITE3_NULL 5 #define SQLITE_NULL 5
/* /*
** The next group of routines returns information about the information ** The next group of routines returns information about the information

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** Internal interface definitions for SQLite.
** **
** @(#) $Id: sqliteInt.h,v 1.264 2004/05/31 18:23:09 drh Exp $ ** @(#) $Id: sqliteInt.h,v 1.265 2004/05/31 18:51:58 drh Exp $
*/ */
#include "config.h" #include "config.h"
#include "sqlite3.h" #include "sqlite3.h"
@@ -134,8 +134,8 @@ typedef unsigned INTPTR_TYPE uptr; /* Big enough to hold a pointer */
** evaluated at runtime. ** evaluated at runtime.
*/ */
extern const int sqlite3one; extern const int sqlite3one;
#define SQLITE3_BIGENDIAN (*(char *)(&sqlite3one)==0) #define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
#define SQLITE3_LITTLEENDIAN (*(char *)(&sqlite3one)==1) #define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
/* /*
** Defer sourcing vdbe.h until after the "u8" typedef is defined. ** Defer sourcing vdbe.h until after the "u8" typedef is defined.
@@ -324,7 +324,7 @@ struct Db {
#define TEXT_Utf8 1 #define TEXT_Utf8 1
#define TEXT_Utf16le 2 #define TEXT_Utf16le 2
#define TEXT_Utf16be 3 #define TEXT_Utf16be 3
#define TEXT_Utf16 (SQLITE3_BIGENDIAN?TEXT_Utf16be:TEXT_Utf16le) #define TEXT_Utf16 (SQLITE_BIGENDIAN?TEXT_Utf16be:TEXT_Utf16le)
/* /*
** Each database is an instance of the following structure. ** Each database is an instance of the following structure.

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** A TCL Interface to SQLite ** A TCL Interface to SQLite
** **
** $Id: tclsqlite.c,v 1.76 2004/05/29 02:37:19 danielk1977 Exp $ ** $Id: tclsqlite.c,v 1.77 2004/05/31 18:51:58 drh Exp $
*/ */
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
@@ -213,7 +213,7 @@ static void tclSqlFunc(sqlite3_context *context, int argc, sqlite3_value **argv)
Tcl_DStringInit(&cmd); Tcl_DStringInit(&cmd);
Tcl_DStringAppend(&cmd, p->zScript, -1); Tcl_DStringAppend(&cmd, p->zScript, -1);
for(i=0; i<argc; i++){ for(i=0; i<argc; i++){
if( SQLITE3_NULL==sqlite3_value_type(argv[i]) ){ if( SQLITE_NULL==sqlite3_value_type(argv[i]) ){
Tcl_DStringAppendElement(&cmd, ""); Tcl_DStringAppendElement(&cmd, "");
}else{ }else{
Tcl_DStringAppendElement(&cmd, sqlite3_value_text(argv[i])); Tcl_DStringAppendElement(&cmd, sqlite3_value_text(argv[i]));
@@ -658,7 +658,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
Tcl_Obj *pVal; Tcl_Obj *pVal;
/* Set pVal to contain the i'th column of this row. */ /* Set pVal to contain the i'th column of this row. */
if( SQLITE3_BLOB!=sqlite3_column_type(pStmt, i) ){ if( SQLITE_BLOB!=sqlite3_column_type(pStmt, i) ){
pVal = dbTextToObj(sqlite3_column_text(pStmt, i)); pVal = dbTextToObj(sqlite3_column_text(pStmt, i));
}else{ }else{
int bytes = sqlite3_column_bytes(pStmt, i); int bytes = sqlite3_column_bytes(pStmt, i);

View File

@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated ** is not included in the SQLite library. It is used for automated
** testing of the SQLite library. ** testing of the SQLite library.
** **
** $Id: test1.c,v 1.65 2004/05/27 14:23:36 danielk1977 Exp $ ** $Id: test1.c,v 1.66 2004/05/31 18:51:58 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "tcl.h" #include "tcl.h"
@@ -325,7 +325,7 @@ static int sqlite_test_close(
static void ifnullFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ static void ifnullFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
int i; int i;
for(i=0; i<argc; i++){ for(i=0; i<argc; i++){
if( SQLITE3_NULL!=sqlite3_value_type(argv[i]) ){ if( SQLITE_NULL!=sqlite3_value_type(argv[i]) ){
sqlite3_result_text(context, sqlite3_value_text(argv[i]), -1, 1); sqlite3_result_text(context, sqlite3_value_text(argv[i]), -1, 1);
break; break;
} }
@@ -450,7 +450,7 @@ struct CountCtx {
static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){ static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){
CountCtx *p; CountCtx *p;
p = sqlite3_aggregate_context(context, sizeof(*p)); p = sqlite3_aggregate_context(context, sizeof(*p));
if( (argc==0 || SQLITE3_NULL!=sqlite3_value_type(argv[0]) ) && p ){ if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0]) ) && p ){
p->n++; p->n++;
} }
} }
@@ -1399,19 +1399,19 @@ static int test_column_type(
tp = sqlite3_column_type(pStmt, col); tp = sqlite3_column_type(pStmt, col);
switch( tp ){ switch( tp ){
case SQLITE3_INTEGER: case SQLITE_INTEGER:
Tcl_SetResult(interp, "INTEGER", TCL_STATIC); Tcl_SetResult(interp, "INTEGER", TCL_STATIC);
break; break;
case SQLITE3_NULL: case SQLITE_NULL:
Tcl_SetResult(interp, "NULL", TCL_STATIC); Tcl_SetResult(interp, "NULL", TCL_STATIC);
break; break;
case SQLITE3_FLOAT: case SQLITE_FLOAT:
Tcl_SetResult(interp, "FLOAT", TCL_STATIC); Tcl_SetResult(interp, "FLOAT", TCL_STATIC);
break; break;
case SQLITE3_TEXT: case SQLITE_TEXT:
Tcl_SetResult(interp, "TEXT", TCL_STATIC); Tcl_SetResult(interp, "TEXT", TCL_STATIC);
break; break;
case SQLITE3_BLOB: case SQLITE_BLOB:
Tcl_SetResult(interp, "BLOB", TCL_STATIC); Tcl_SetResult(interp, "BLOB", TCL_STATIC);
break; break;
default: default:

View File

@@ -15,10 +15,10 @@
** 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.5 2004/05/22 03:05:34 danielk1977 Exp $ ** $Id: test5.c,v 1.6 2004/05/31 18:51:58 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" /* to get SQLITE3_BIGENDIAN */ #include "os.h" /* to get SQLITE_BIGENDIAN */
#include "tcl.h" #include "tcl.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -167,7 +167,7 @@ static int sqlite_utf16to8(
} }
in = Tcl_GetByteArrayFromObj(objv[1], 0); in = Tcl_GetByteArrayFromObj(objv[1], 0);
out = sqlite3utf16to8(in, -1, SQLITE3_BIGENDIAN); out = sqlite3utf16to8(in, -1, SQLITE_BIGENDIAN);
res = Tcl_NewByteArrayObj(out, strlen(out)+1); res = Tcl_NewByteArrayObj(out, strlen(out)+1);
sqliteFree(out); sqliteFree(out);
@@ -221,6 +221,3 @@ int Sqlitetest5_Init(Tcl_Interp *interp){
return TCL_OK; return TCL_OK;
} }

View File

@@ -15,7 +15,7 @@
** individual tokens and sends those tokens one-by-one over to the ** individual tokens and sends those tokens one-by-one over to the
** parser for analysis. ** parser for analysis.
** **
** $Id: tokenize.c,v 1.74 2004/05/27 23:56:16 danielk1977 Exp $ ** $Id: tokenize.c,v 1.75 2004/05/31 18:51:58 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -702,10 +702,9 @@ int sqlite3_complete(const char *zSql){
*/ */
int sqlite3_complete16(const void *zSql){ int sqlite3_complete16(const void *zSql){
int rc; int rc;
char *zSql8 = sqlite3utf16to8(zSql, -1, SQLITE3_BIGENDIAN); char *zSql8 = sqlite3utf16to8(zSql, -1, SQLITE_BIGENDIAN);
if( !zSql8 ) return 0; if( !zSql8 ) return 0;
rc = sqlite3_complete(zSql8); rc = sqlite3_complete(zSql8);
sqliteFree(zSql8); sqliteFree(zSql8);
return rc; return rc;
} }

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.14 2004/05/29 02:44:02 danielk1977 Exp $ ** $Id: utf.c,v 1.15 2004/05/31 18:51:58 drh Exp $
** **
** Notes on UTF-8: ** Notes on UTF-8:
** **
@@ -62,9 +62,9 @@ struct UtfString {
/* TODO: Implement this macro in os.h. It should be 1 on big-endian /* TODO: Implement this macro in os.h. It should be 1 on big-endian
** machines, and 0 on little-endian. ** machines, and 0 on little-endian.
*/ */
#define SQLITE3_NATIVE_BIGENDIAN 0 #define SQLITE_NATIVE_BIGENDIAN 0
#if SQLITE3_NATIVE_BIGENDIAN == 1 #if SQLITE_NATIVE_BIGENDIAN == 1
#define BOM_BIGENDIAN 0x0000FFFE #define BOM_BIGENDIAN 0x0000FFFE
#define BOM_LITTLEENDIAN 0x0000FEFF #define BOM_LITTLEENDIAN 0x0000FEFF
#else #else
@@ -523,7 +523,7 @@ static void utf16to16(void *pData, int N, int big_endian){
inout.n = sqlite3utf16ByteLen(inout.pZ, -1); inout.n = sqlite3utf16ByteLen(inout.pZ, -1);
} }
if( readUtf16Bom(&inout, SQLITE3_BIGENDIAN)!=big_endian ){ if( readUtf16Bom(&inout, SQLITE_BIGENDIAN)!=big_endian ){
/* swab(&inout.pZ[inout.c], inout.pZ, inout.n-inout.c); */ /* swab(&inout.pZ[inout.c], inout.pZ, inout.n-inout.c); */
int i; int i;
for(i=0; i<(inout.n-inout.c); i += 2){ for(i=0; i<(inout.n-inout.c); i += 2){

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.352 2004/05/31 10:01:35 danielk1977 Exp $ ** $Id: vdbe.c,v 1.353 2004/05/31 18:51:58 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -138,18 +138,18 @@ int sqlite3_interrupt_count = 0;
static void _storeTypeInfo(Mem *pMem){ static void _storeTypeInfo(Mem *pMem){
int flags = pMem->flags; int flags = pMem->flags;
if( flags & MEM_Null ){ if( flags & MEM_Null ){
pMem->type = SQLITE3_NULL; pMem->type = SQLITE_NULL;
} }
else if( flags & MEM_Int ){ else if( flags & MEM_Int ){
pMem->type = SQLITE3_INTEGER; pMem->type = SQLITE_INTEGER;
} }
else if( flags & MEM_Real ){ else if( flags & MEM_Real ){
pMem->type = SQLITE3_FLOAT; pMem->type = SQLITE_FLOAT;
} }
else if( flags & MEM_Str ){ else if( flags & MEM_Str ){
pMem->type = SQLITE3_TEXT; pMem->type = SQLITE_TEXT;
}else{ }else{
pMem->type = SQLITE3_BLOB; pMem->type = SQLITE_BLOB;
} }
} }

View File

@@ -124,8 +124,8 @@ struct Sorter {
** **
** Each value has a manifest type. The manifest type of the value stored ** Each value has a manifest type. The manifest type of the value stored
** in a Mem struct is returned by the MemType(Mem*) macro. The type is ** in a Mem struct is returned by the MemType(Mem*) macro. The type is
** one of SQLITE3_NULL, SQLITE3_INTEGER, SQLITE3_REAL, SQLITE3_TEXT or ** one of SQLITE_NULL, SQLITE_INTEGER, SQLITE_REAL, SQLITE_TEXT or
** SQLITE3_BLOB. ** SQLITE_BLOB.
*/ */
struct Mem { struct Mem {
i64 i; /* Integer value */ i64 i; /* Integer value */

View File

@@ -497,7 +497,7 @@ int sqlite3_bind_text16(
zData = (void *)(((u8 *)zData) + 2); zData = (void *)(((u8 *)zData) + 2);
nData -= 2; nData -= 2;
}else{ }else{
txt_enc = SQLITE3_BIGENDIAN?TEXT_Utf16be:TEXT_Utf16le; txt_enc = SQLITE_BIGENDIAN?TEXT_Utf16be:TEXT_Utf16le;
} }
rc = sqlite3VdbeMemSetStr(pVar, zData, nData, txt_enc, eCopy); rc = sqlite3VdbeMemSetStr(pVar, zData, nData, txt_enc, eCopy);
if( rc ){ if( rc ){

View File

@@ -571,30 +571,30 @@ int sqlite3VdbeList(
Op *pOp = &p->aOp[i]; Op *pOp = &p->aOp[i];
Mem *pMem = p->aStack; Mem *pMem = p->aStack;
pMem->flags = MEM_Int; pMem->flags = MEM_Int;
pMem->type = SQLITE3_INTEGER; pMem->type = SQLITE_INTEGER;
pMem->i = i; /* Program counter */ pMem->i = i; /* Program counter */
pMem++; pMem++;
pMem->flags = MEM_Static|MEM_Str|MEM_Term; pMem->flags = MEM_Static|MEM_Str|MEM_Term;
pMem->z = sqlite3OpcodeNames[pOp->opcode]; /* Opcode */ pMem->z = sqlite3OpcodeNames[pOp->opcode]; /* Opcode */
pMem->n = strlen(pMem->z); pMem->n = strlen(pMem->z);
pMem->type = SQLITE3_TEXT; pMem->type = SQLITE_TEXT;
pMem->enc = TEXT_Utf8; pMem->enc = TEXT_Utf8;
pMem++; pMem++;
pMem->flags = MEM_Int; pMem->flags = MEM_Int;
pMem->i = pOp->p1; /* P1 */ pMem->i = pOp->p1; /* P1 */
pMem->type = SQLITE3_INTEGER; pMem->type = SQLITE_INTEGER;
pMem++; pMem++;
pMem->flags = MEM_Int; pMem->flags = MEM_Int;
pMem->i = pOp->p2; /* P2 */ pMem->i = pOp->p2; /* P2 */
pMem->type = SQLITE3_INTEGER; pMem->type = SQLITE_INTEGER;
pMem++; pMem++;
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 = SQLITE3_TEXT; pMem->type = SQLITE_TEXT;
pMem->enc = TEXT_Utf8; pMem->enc = TEXT_Utf8;
p->nResColumn = 5; p->nResColumn = 5;

View File

@@ -179,7 +179,7 @@ int sqlite3VdbeMemStringify(Mem *pMem, int enc){
** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16. ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.
*/ */
u8 *z = pMem->zShort; u8 *z = pMem->zShort;
if( fg & MEM_Real || (pMem->type==SQLITE3_FLOAT) ){ if( fg & MEM_Real || (pMem->type==SQLITE_FLOAT) ){
sqlite3_snprintf(NBFS, z, "%.15g", pMem->r); sqlite3_snprintf(NBFS, z, "%.15g", pMem->r);
}else{ }else{
assert( fg & MEM_Int ); assert( fg & MEM_Int );
@@ -236,7 +236,7 @@ int sqlite3VdbeMemIntegerify(Mem *pMem){
int sqlite3VdbeMemRealify(Mem *pMem){ int sqlite3VdbeMemRealify(Mem *pMem){
if( pMem->flags & MEM_Real ){ if( pMem->flags & MEM_Real ){
/* Do nothing */ /* Do nothing */
}else if( (pMem->flags & MEM_Int) && pMem->type!=SQLITE3_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, TEXT_Utf8)
@@ -258,7 +258,7 @@ int sqlite3VdbeMemRealify(Mem *pMem){
void sqlite3VdbeMemSetNull(Mem *pMem){ void sqlite3VdbeMemSetNull(Mem *pMem){
releaseMem(pMem); releaseMem(pMem);
pMem->flags = MEM_Null; pMem->flags = MEM_Null;
pMem->type = SQLITE3_NULL; pMem->type = SQLITE_NULL;
} }
/* /*
@@ -269,7 +269,7 @@ void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
releaseMem(pMem); releaseMem(pMem);
pMem->i = val; pMem->i = val;
pMem->flags = MEM_Int; pMem->flags = MEM_Int;
pMem->type = SQLITE3_INTEGER; pMem->type = SQLITE_INTEGER;
} }
/* /*
@@ -280,7 +280,7 @@ void sqlite3VdbeMemSetDouble(Mem *pMem, double val){
releaseMem(pMem); releaseMem(pMem);
pMem->r = val; pMem->r = val;
pMem->flags = MEM_Real; pMem->flags = MEM_Real;
pMem->type = SQLITE3_FLOAT; pMem->type = SQLITE_FLOAT;
} }
/* /*
@@ -310,7 +310,7 @@ int sqlite3VdbeMemSetStr(
releaseMem(pMem); releaseMem(pMem);
if( !z ){ if( !z ){
pMem->flags = MEM_Null; pMem->flags = MEM_Null;
pMem->type = SQLITE3_NULL; pMem->type = SQLITE_NULL;
return SQLITE_OK; return SQLITE_OK;
} }
@@ -321,7 +321,7 @@ int sqlite3VdbeMemSetStr(
pMem->flags = MEM_Static; pMem->flags = MEM_Static;
} }
pMem->enc = enc; pMem->enc = enc;
pMem->type = enc==0 ? SQLITE3_BLOB : SQLITE3_TEXT; pMem->type = enc==0 ? SQLITE_BLOB : SQLITE_TEXT;
pMem->n = n; pMem->n = n;
switch( enc ){ switch( enc ){
case 0: case 0:
@@ -491,7 +491,7 @@ int sqlite3VdbeMemFromBtree(
} }
pMem->z = zData; pMem->z = zData;
pMem->enc = 0; pMem->enc = 0;
pMem->type = SQLITE3_BLOB; pMem->type = SQLITE_BLOB;
if( key ){ if( key ){
rc = sqlite3BtreeKey(pCur, offset, amt, zData); rc = sqlite3BtreeKey(pCur, offset, amt, zData);

View File

@@ -1,4 +1,4 @@
set rcsid {$Id: capi3.tcl,v 1.1 2004/05/31 18:22:26 drh Exp $} set rcsid {$Id: capi3.tcl,v 1.2 2004/05/31 18:51:59 drh 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 {
@@ -89,6 +89,40 @@ sqlite3_errmsg() except that it returns the error message represented
as UTF-16 in host native byte order. as UTF-16 in host native byte order.
</p> </p>
<p>
The error codes for SQLite version 3 are unchanged from version2.
They are as follows:
</p>
<blockquote><pre>
#define SQLITE_OK 0 /* Successful result */
#define SQLITE_ERROR 1 /* SQL error or missing database */
#define SQLITE_INTERNAL 2 /* An internal logic error in SQLite */
#define SQLITE_PERM 3 /* Access permission denied */
#define SQLITE_ABORT 4 /* Callback routine requested an abort */
#define SQLITE_BUSY 5 /* The database file is locked */
#define SQLITE_LOCKED 6 /* A table in the database is locked */
#define SQLITE_NOMEM 7 /* A malloc() failed */
#define SQLITE_READONLY 8 /* Attempt to write a readonly database */
#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite_interrupt() */
#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
#define SQLITE_NOTFOUND 12 /* (Internal Only) Table or record not found */
#define SQLITE_FULL 13 /* Insertion failed because database is full */
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
#define SQLITE_EMPTY 16 /* (Internal Only) Database table is empty */
#define SQLITE_SCHEMA 17 /* The database schema changed */
#define SQLITE_TOOBIG 18 /* Too much data for one row of a table */
#define SQLITE_CONSTRAINT 19 /* Abort due to contraint violation */
#define SQLITE_MISMATCH 20 /* Data type mismatch */
#define SQLITE_MISUSE 21 /* Library used incorrectly */
#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
#define SQLITE_AUTH 23 /* Authorization denied */
#define SQLITE_ROW 100 /* sqlite_step() has another row ready */
#define SQLITE_DONE 101 /* sqlite_step() has finished executing */
</pre></blockquote>
<h4>2.2 Executing SQL statements</h4> <h4>2.2 Executing SQL statements</h4>
<blockquote><pre> <blockquote><pre>
@@ -193,11 +227,11 @@ of these:
</p> </p>
<blockquote><pre> <blockquote><pre>
#define SQLITE3_INTEGER 1 #define SQLITE_INTEGER 1
#define SQLITE3_FLOAT 2 #define SQLITE_FLOAT 2
#define SQLITE3_TEXT 3 #define SQLITE_TEXT 3
#define SQLITE3_BLOB 4 #define SQLITE_BLOB 4
#define SQLITE3_NULL 5 #define SQLITE_NULL 5
</pre></blockquote> </pre></blockquote>
<p> <p>

View File

@@ -1,4 +1,4 @@
set rcsid {$Id: datatype3.tcl,v 1.1 2004/05/31 18:22:26 drh Exp $} set rcsid {$Id: datatype3.tcl,v 1.2 2004/05/31 18:51:59 drh Exp $}
source common.tcl source common.tcl
header {Datatypes In SQLite Version 3} header {Datatypes In SQLite Version 3}
puts { puts {
@@ -123,8 +123,9 @@ of the column, according to the following rules:</P>
column has TEXT affinity. Notice that the type VARCHAR contains the column has TEXT affinity. Notice that the type VARCHAR contains the
string &quot;CHAR&quot; and is thus assigned TEXT affinity.</P> string &quot;CHAR&quot; and is thus assigned TEXT affinity.</P>
<LI><P>If the datatype contains the string &quot;BLOB&quot; <LI><P>If the datatype for a column
then the column has affinity NONE.</P> contains the string &quot;BLOB&quot; or if
not datatype is specified then the column has affinity NONE.</P>
<LI><P>Otherwise, the affinity is NUMERIC. Notice that a column <LI><P>Otherwise, the affinity is NUMERIC. Notice that a column
where no datatype is specified is given affinity NUMERIC.</P> where no datatype is specified is given affinity NUMERIC.</P>
@@ -138,10 +139,10 @@ and they are given no affinity.</P>
<blockquote> <blockquote>
<PRE>CREATE TABLE t1( <PRE>CREATE TABLE t1(
t AFFINITY TEXT, t TEXT,
nu AFFINITY NUMERIC, nu NUMERIC,
i AFFINITY INTEGER, i INTEGER,
no AFFINITY NONE no BLOB
); );
-- Storage classes for the following row: -- Storage classes for the following row:
@@ -150,7 +151,8 @@ INSERT INTO t1 VALUES('500.0', '500.0', '500.0', '500.0');
-- Storage classes for the following row: -- Storage classes for the following row:
-- TEXT, REAL, INTEGER, REAL -- TEXT, REAL, INTEGER, REAL
INSERT INTO t1 VALUES(500.0, 500.0, 500.0, 500.0);</PRE> INSERT INTO t1 VALUES(500.0, 500.0, 500.0, 500.0);
</PRE>
</blockquote> </blockquote>
<h3>3. Comparison Expressions</h3> <h3>3. Comparison Expressions</h3>
@@ -201,17 +203,18 @@ SQL scalar expression or literal other than a column value.</P>
<h4>3.1 Comparison Example</h4> <h4>3.1 Comparison Example</h4>
<blockquote> <blockquote>
<PRE>CREATE TABLE t1( <PRE>
a AFFINITY TEXT, CREATE TABLE t1(
b AFFINITY NUMERIC, a TEXT,
c AFFINITY NONE b NUMERIC,
c BLOB
); );
-- Storage classes for the following row: -- Storage classes for the following row:
-- TEXT, REAL, TEXT -- TEXT, REAL, TEXT
INSERT INTO t1 VALUES('500', '500', '500'); INSERT INTO t1 VALUES('500', '500', '500');
-- 60 and 40 are converted to 60 and 40 and values are compared as TEXT. -- 60 and 40 are converted to '60' and '40' and values are compared as TEXT.
SELECT a &lt; 60, a &lt; 40 FROM t1; SELECT a &lt; 60, a &lt; 40 FROM t1;
1|0 1|0
@@ -219,9 +222,11 @@ SELECT a &lt; 60, a &lt; 40 FROM t1;
SELECT b &lt; 60, b &lt; 600 FROM t1; SELECT b &lt; 60, b &lt; 600 FROM t1;
0|1 0|1
-- Both 60 and 600 (storage class NUMERIC) are less than '500' (storage class TEXT). -- Both 60 and 600 (storage class NUMERIC) are less than '500'
-- (storage class TEXT).
SELECT c &lt; 60, c &lt; 600 FROM t1; SELECT c &lt; 60, c &lt; 600 FROM t1;
0|0</PRE> 0|0
</PRE>
</blockquote> </blockquote>
<P> <P>