diff --git a/manifest b/manifest index cfdaa13898..77d7123095 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\srecord\sformat\sto\sinclude\san\sextra\svarint\sat\sthe\sbeginning\sto\srecord\sthe\snumber\sof\sbytes\sin\sthe\sheader.\s(CVS\s1478) -D 2004-05-27T19:59:32 +C Add\sAPI\sfunctions\ssqlite3_open_varargs(),\ssqlite3_open16_varargs()\sand\nsqlite3_complete16().\s(CVS\s1479) +D 2004-05-27T23:56:16 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -36,7 +36,7 @@ F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb F src/insert.c dd117e8b3f50e943e6cf5fbcf4bbdc0b907b0b4c F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f -F src/main.c 488ec788a06019521e53ffd25c4af97943937fb5 +F src/main.c a6f3739a30d378128d424bb9add01103845ba6a5 F src/md5.c d2c738fedfb27f73cefcf2b0ac1f9f21894b073e F src/os.h ab42f4a7c4c716f26b988e759b6e12085a3bfc67 F src/os_common.h 744286a27de55c52f1b18921e8d17abbf7fafc0f @@ -52,9 +52,9 @@ F src/parse.y 63d39b6fe17d0c2c2c1f691e75a119a71d25439a F src/pragma.c f2b05b087a5764802296a28d7abdd75728beedee F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 -F src/select.c 2ba142a490ab2777b6a086e7c0d078a952331109 +F src/select.c 26f726b398af8708c81178acc9c68d64e78e6f5e F src/shell.c ed4d237b3e52a0a42512bfcc53530e46de20c28f -F src/sqlite.h.in cda883efb11c6f767eaf3fea06b3e3419d9cfe7f +F src/sqlite.h.in edc6408c7f53c2104f781a76b926036e17018ec9 F src/sqliteInt.h 7978f406b41819f37fb6fb1be64115a2e7a28ab5 F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2 F src/tclsqlite.c 877d0b96013a25b03ed6bd2d32917c42e84403bc @@ -63,7 +63,7 @@ F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872 F src/test3.c 5e4a6d596f982f6f47a5f9f75ede9b4a3b739968 F src/test4.c 34848a9fd31aa65857b20a8bfc03aff77d8c3426 F src/test5.c 9a1f15133f6955f067c5246e564723b5f23ff221 -F src/tokenize.c 76eebcab0fad3e983935f833de757818a866a64f +F src/tokenize.c 50a87c7414de54a008427c9fed22e4e86efb6844 F src/trigger.c 11afe9abfba13a2ba142944c797c952e162d117f F src/update.c 96461bcf4e946697e83c09c77c7e61b545a2f66e F src/utf.c 59b5c8f06a4384a9f64933d6c57a2de02ce3673b @@ -73,7 +73,7 @@ F src/vdbe.c c068f9ab3d82906de297c1f20e50d601981328fb F src/vdbe.h e73f890e0f2a6c42b183d7d6937947930fe4fdeb F src/vdbeInt.h 0c30699ea21371980bc278e4e3d17d80ced722df F src/vdbeapi.c b0bb1f98c899ba00c8a5cbca612c2a28a1bb79de -F src/vdbeaux.c c1beed304947bcfe49bd7c2abe45a58c2db0c67b +F src/vdbeaux.c 408a8949e895d2bf491dbe5e7847f17a7071b185 F src/vdbemem.c b487e8a903012de1c0b7f603e8efeede2b51b21d F src/where.c efe5d25fe18cd7381722457898cd863e84097a0c F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 @@ -203,7 +203,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 287f86731c71401dbac098e08357367b4f8e5a43 -R ae5f0056bb6540c5d0436f9717bf751b -U drh -Z 6b3a034bd2c2b8589e4d067a67b642dc +P 0c4d138807f367d75b3fb5b2dadf206df725659f +R c4417647d8e1e01a4408e7060f25760a +U danielk1977 +Z c4d7bdcd4bae75cf8bc8d11709178bcb diff --git a/manifest.uuid b/manifest.uuid index 50be98f33e..390f1d9cb5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0c4d138807f367d75b3fb5b2dadf206df725659f \ No newline at end of file +203af2b2e3a25f4fe0e128e350c21834cad0bd7f \ No newline at end of file diff --git a/src/main.c b/src/main.c index e9c87aab2b..580b308884 100644 --- a/src/main.c +++ b/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.194 2004/05/26 16:54:43 drh Exp $ +** $Id: main.c,v 1.195 2004/05/27 23:56:16 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -1101,6 +1101,88 @@ int sqlite3_open16( return rc; } +/* +** Open a new database handle. +*/ +int sqlite3_open_vararg( + const char *filename, /* Database filename (UTF-8) */ + sqlite3 **ppDb, /* OUT: SQLite db handle */ + ... /* Option strings */ +){ + va_list ap; + const char **aOpts = 0; + int nOpts = 0; + int rc; + + /* Count the arguments */ + va_start(ap, ppDb); + while( va_arg(ap, const char *) ) nOpts++; + va_end(ap); + + /* If there are more than zero arguments, construct an array */ + if( nOpts ){ + aOpts = (const char **)sqliteMalloc(sizeof(const char *)*nOpts+1); + if( !aOpts ){ + *ppDb = 0; + return SQLITE_NOMEM; + } + va_start(ap, ppDb); + nOpts = 0; + while( va_arg(ap, const char *) ){ + aOpts[nOpts] = va_arg(ap, const char *); + nOpts++; + } + aOpts[nOpts] = 0; + va_end(ap); + } + + /* Call the regular sqlite3_open() */ + rc = sqlite3_open(filename, ppDb, aOpts); + if( aOpts ) sqliteFree(aOpts); + return rc; +} + +/* +** Open a new database handle. +*/ +int sqlite3_open16_vararg( + const void *filename, /* Database filename (UTF-16) */ + sqlite3 **ppDb, /* OUT: SQLite db handle */ + ... /* Option strings */ +){ + va_list ap; + const char **aOpts = 0; + int nOpts = 0; + int rc; + + /* Count the arguments */ + va_start(ap, ppDb); + while( va_arg(ap, const char *) ) nOpts++; + va_end(ap); + + /* If there are more than zero arguments, construct an array */ + if( nOpts ){ + aOpts = (const char **)sqliteMalloc(sizeof(const char *)*nOpts+1); + if( !aOpts ){ + *ppDb = 0; + return SQLITE_NOMEM; + } + va_start(ap, ppDb); + nOpts = 0; + while( va_arg(ap, const char *) ){ + aOpts[nOpts] = va_arg(ap, const char *); + nOpts++; + } + aOpts[nOpts] = 0; + va_end(ap); + } + + /* Call the regular sqlite3_open16() */ + rc = sqlite3_open16(filename, ppDb, aOpts); + if( aOpts ) sqliteFree(aOpts); + return rc; +} + /* ** The following routine destroys a virtual machine that is created by ** the sqlite3_compile() routine. The integer returned is an SQLITE_ diff --git a/src/select.c b/src/select.c index 1a8d46176e..03fd4c4d74 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.179 2004/05/27 10:30:53 danielk1977 Exp $ +** $Id: select.c,v 1.180 2004/05/27 23:56:16 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -684,7 +684,7 @@ static void generateColumnNames( /* If this is an EXPLAIN, skip this step */ if( pParse->explain ){ - return SQLITE_OK; + return; } assert( v!=0 ); @@ -695,7 +695,6 @@ static void generateColumnNames( sqlite3VdbeSetNumCols(v, pEList->nExpr); for(i=0; inExpr; i++){ Expr *p; - int p2 = i==pEList->nExpr-1; p = pEList->a[i].pExpr; if( p==0 ) continue; if( pEList->a[i].zName ){ diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 72b2b3d5ad..1131e4cfbb 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -12,7 +12,7 @@ ** This header file defines the interface that the SQLite library ** presents to client programs. ** -** @(#) $Id: sqlite.h.in,v 1.84 2004/05/27 09:28:43 danielk1977 Exp $ +** @(#) $Id: sqlite.h.in,v 1.85 2004/05/27 23:56:16 danielk1977 Exp $ */ #ifndef _SQLITE_H_ #define _SQLITE_H_ @@ -229,14 +229,18 @@ const char *sqlite3_error_string(int); void sqlite3_interrupt(sqlite*); -/* This function returns true if the given input string comprises -** one or more complete SQL statements. +/* These functions return true if the given input string comprises +** one or more complete SQL statements. For the sqlite3_complete() call, +** the parameter must be a nul-terminated UTF-8 string. For +** sqlite3_complete16(), a nul-terminated machine byte order UTF-16 string +** is required. ** ** The algorithm is simple. If the last token other than spaces ** and comments is a semicolon, then return true. otherwise return ** false. */ int sqlite3_complete(const char *sql); +int sqlite3_complete16(const void *sql); /* ** This routine identifies a callback function that is invoked @@ -523,6 +527,23 @@ int sqlite3_open16( const char **args /* Null terminated array of option strings */ ); +/* +** The following two functions are identical to sqlite3_open() and +** sqlite3_open16(), except that any option strings are specified as the +** third and subsequent arguments, instead of as an array. The final +** argument to either of the following two functions must be a NULL. +*/ +int sqlite3_open_vararg( + const char *filename, /* Database filename (UTF-8) */ + sqlite3 **ppDb, /* OUT: SQLite db handle */ + ... /* Option strings */ +); +int sqlite3_open16_vararg( + const void *filename, /* Database filename (UTF-16) */ + sqlite3 **ppDb, /* OUT: SQLite db handle */ + ... /* Option strings */ +); + /* ** Return the error code for the most recent sqlite3_* API call associated ** with sqlite3 handle 'db'. SQLITE_OK is returned if the most recent diff --git a/src/tokenize.c b/src/tokenize.c index 08860b4cee..35ee9251f8 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -15,7 +15,7 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.73 2004/05/27 17:22:56 drh Exp $ +** $Id: tokenize.c,v 1.74 2004/05/27 23:56:16 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -694,3 +694,18 @@ int sqlite3_complete(const char *zSql){ } return state==0; } + +/* +** This routine is the same as the sqlite3_complete() routine described +** above, except that the parameter is required to be UTF-16 encoded, not +** UTF-8. +*/ +int sqlite3_complete16(const void *zSql){ + int rc; + char *zSql8 = sqlite3utf16to8(zSql, -1, SQLITE3_BIGENDIAN); + if( !zSql8 ) return 0; + rc = sqlite3_complete(zSql8); + sqliteFree(zSql8); + return rc; +} + diff --git a/src/vdbeaux.c b/src/vdbeaux.c index e6c3606bfb..2fd31b7374 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1300,7 +1300,7 @@ int sqlite3VdbeSerialGet( /* String or blob */ assert( serial_type>=12 ); len = sqlite3VdbeSerialTypeLen(serial_type); - pMem->z = buf; + pMem->z = (char *)buf; pMem->n = len; if( serial_type&0x01 ){ pMem->flags = MEM_Str | MEM_Ephem;