#
tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
$(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
- $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL)
+ $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
testfixture$(EXE): $(TOP)/src/tclsqlite.c libsqlite3.a $(TESTSRC)
$(TCCX) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1 -o testfixture$(EXE) \
-C Add\ssome\stests\sfor\soverlapping\sSELECT,\sCOMMIT\sand\sROLLBACK\scommands.\s(CVS\s1774)
-D 2004-06-30T06:30:26
+C Fixes\sfor\scompiler\swarnings.\sAlso\smore\scoverage.\s(CVS\s1775)
+D 2004-06-30T08:20:16
F Makefile.in cb7a9889c38723f72b2506c4236ff30a05ff172b
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
F ltmain.sh f6b283068efa69f06eb8aa1fe4bddfdbdeb35826
-F main.mk 5d21c17c2bf56915658f65e5d395c40f78e2ea6f
+F main.mk 1fabb57eba6c25d98ec8a2127850673f2425c458
F mkdll.sh 68d34a961a1fdfa15ef27fc4f4740be583112124
F publish.sh 4193d9022fb7cf9beecd313bed3d1d68b8386fbe
F spec.template a38492f1c1dd349fc24cb0565e08afc53045304b
F sqlite3.def 26f4e7b0a3fbaa55701e020fdec429f1594e2866
F src/attach.c 678ded370e4b4d5bf03e9566404a42a8dcf5eef9
F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
-F src/btree.c a241b25bfc536e5f3ca66954292156973f6e8a66
+F src/btree.c 3ed3c19e43bb243f502ee614f6ad0a52e53362a7
F src/btree.h 934d0ad30b5b419e9291a11da878be349df2277e
F src/build.c ecc10d4e5232a49f55304dd9b90739f2771e34ef
F src/date.c b3e8b2bef1e3f2ce24e5b057203036defb18c3f1
F src/os_win.c 84549f6cc815237533c5d0eb3697352b03478d96
F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44
F src/pager.c c1d5212e7cac86bc1a29d01a30d9dbbdb545dfd8
-F src/pager.h fe818866f6d1adcffeed88705e8df7e588cbaf13
+F src/pager.h 269b6cfc114dba0148203446e41dd19f9647dd53
F src/parse.y e19e066e726a31d7b2d3e6475bdf55f7e339f8a3
F src/pragma.c 0ecbe7ccf78ad893f5011516845c9e2f74faa21a
F src/printf.c 3090c8ff397d549bc0de09b16d8ab7fd37a0c3f7
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c f02a65af34231031896e8442161cb5251e191e75
-F src/shell.c 24b641700c9d90f361fcfa4f432c5b4aff704e6d
+F src/shell.c ebec5da57ea401f4886eefc790917b939d94d595
F src/sqlite.h.in b70fded2bdfeaddfb06adea3888118b722975136
F src/sqliteInt.h 9dcfcc67fc995b9079074d6b9619a1d4335583d0
F src/table.c 4521c278892f60e4d630788c0ea5cf4db1e75c49
F src/tclsqlite.c f72288553ca3cdaf686baab4b1797dd98140c501
-F src/test1.c ad2ae36959d6ac480f54b7e07d4baad8ee3b2e88
+F src/test1.c 470430e194e43abb7d05b993fb360344f3d58834
F src/test2.c dafd8bd314a554bf376c6d3a8c83fd69219f5a40
F src/test3.c d0c56667e89f79ad0f060fdf010d1c34a4bc2988
F src/test4.c a921a69821fd30209589228e64f94e9f715b6fe2
F src/vdbeaux.c f9b1b3d4d2f1c31f6db1ae1536e17e4eb5454205
F src/vdbemem.c 053f8adcb644bca1c1e4ad08f4016cb7ee6bf1b8
F src/where.c 6507074d8ce3f78e7a4cd33f667f11e62020553e
-F test/all.test d591e074013248176402a16a0fb6fc82d241bad5
+F test/all.test 3b692eb43583b52c99c344b2fa8934512d179016
F test/attach.test 3acdffccbf5f78b07746771b9490758718e28856
F test/attach2.test 3cd1d4a69e0ec307d0b68a44a96c9c8e1e253d65
F test/attach3.test c4cc0b806783ce3d860af6b80c947f93ffb14270
F test/date.test aed5030482ebc02bd8d386c6c86a29f694ab068d
F test/delete.test 4f0c86e2bebdc822d179c80697b1ceabe6bbcd07
F test/enc.test 2f5463af488d50aef60c6110bec6b21b5efba961
-F test/enc2.test d0d9b8591d6c7779c5c6707ac6cb3a4aad3fa13b
+F test/enc2.test 7a60971a62748be6b607b4b4380eb4c5e151a6ec
F test/enc3.test 2ae80b11adf5b2c171d2e17214dabd356b9672c1
F test/expr.test b4e945265c4c697bf5213b72558914ba10a989cc
F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl 563ba3ac02f64da27ab17f3edbe8e56bfd0293fb
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 68ac32213766c5e83de54373b90030a458538017
-R 744bf93dd2f36513077a290ed8b8aa9f
+P d256c14943968e7adf4b73988cac6af941c9b12d
+R 4f61ce2de075aff0c8e8c9f0f47fa953
U danielk1977
-Z aa9871afb1977e06c76a2d6bc3030445
+Z eeffb6cff58a960d2f9806fbf7046f4d
-d256c14943968e7adf4b73988cac6af941c9b12d
\ No newline at end of file
+fa19c77bf045787faa4cdc40bcfbd9eeae8594ae
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.175 2004/06/30 01:07:02 drh Exp $
+** $Id: btree.c,v 1.176 2004/06/30 08:20:16 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
** data header and the local payload, but not any overflow page or
** the space used by the cell pointer.
*/
+#ifndef NDEBUG
static int cellSize(MemPage *pPage, int iCell){
CellInfo info;
parseCell(pPage, iCell, &info);
return info.nSize;
}
+#endif
static int cellSizePtr(MemPage *pPage, u8 *pCell){
CellInfo info;
parseCellPtr(pPage, pCell, &info);
** free blocks into a single big free block.
*/
static void freeSpace(MemPage *pPage, int start, int size){
- int end = start + size; /* End of the segment being freed */
int addr, pbegin, hdr;
unsigned char *data = pPage->aData;
assert( pPage->pBt!=0 );
assert( sqlite3pager_iswriteable(data) );
assert( start>=pPage->hdrOffset+6+(pPage->leaf?0:4) );
- assert( end<=pPage->pBt->usableSize );
+ assert( (start + size)<=pPage->pBt->usableSize );
if( size<4 ) size = 4;
/* Add the space back into the linked list of freeblocks */
** subsystem. The page cache subsystem reads and writes a file a page
** at a time and provides a journal for rollback.
**
-** @(#) $Id: pager.h,v 1.35 2004/06/26 08:38:25 danielk1977 Exp $
+** @(#) $Id: pager.h,v 1.36 2004/06/30 08:20:16 danielk1977 Exp $
*/
/*
int sqlite3pager_rename(Pager*, const char *zNewName);
void sqlite3pager_set_codec(Pager*,void(*)(void*,void*,Pgno,int),void*);
-#ifdef SQLITE_DEBUG
+#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
int sqlite3pager_lockstate(Pager*);
#endif
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
-** $Id: shell.c,v 1.105 2004/06/19 09:08:16 danielk1977 Exp $
+** $Id: shell.c,v 1.106 2004/06/30 08:20:16 danielk1977 Exp $
*/
#include <stdlib.h>
#include <string.h>
*/
extern int sqlite3IsNumber(const char*, int*, unsigned char);
+/*
+** A global char* and an SQL function to access its current value
+** from within an SQL statement. This program used to use the
+** sqlite_exec_printf() API to substitue a string into an SQL statement.
+** The correct way to do this with sqlite3 is to use the bind API, but
+** since the shell is built around the callback paradigm it would be a lot
+** of work. Instead just use this hack, which is quite harmless.
+*/
+static const char *zShellStatic = 0;
+static void shellstaticFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ assert( 0==argc );
+ assert( zShellStatic );
+ sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC);
+}
+
+
/*
** This routine reads a line of text from standard input, stores
** the text in memory obtained from malloc() and returns a pointer
sqlite3_open(p->zDbFilename, &p->db);
db = p->db;
#endif
+ sqlite3_create_function(db, "shellstatic", 0, SQLITE_UTF8, 0,
+ shellstaticFunc, 0, 0);
if( SQLITE_OK!=sqlite3_errcode(db) ){
fprintf(stderr,"Unable to open database \"%s\": %s\n",
p->zDbFilename, sqlite3_errmsg(db));
}else{
int i;
for(i=1; i<nArg && zErrMsg==0; i++){
- sqlite3_exec_printf(p->db,
+ zShellStatic = azArg[i];
+ sqlite3_exec(p->db,
"SELECT name, type, sql FROM sqlite_master "
- "WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOT NULL "
+ "WHERE tbl_name LIKE shellstatic() AND type!='meta' AND sql NOT NULL "
"ORDER BY substr(type,2,1), name",
- dump_callback, p, &zErrMsg, azArg[i]
+ dump_callback, p, &zErrMsg
);
+ zShellStatic = 0;
}
}
if( zErrMsg ){
memcpy(&data, p, sizeof(data));
data.showHeader = 0;
data.mode = MODE_List;
- sqlite3_exec_printf(p->db,
+ zShellStatic = azArg[1];
+ sqlite3_exec(p->db,
"SELECT name FROM sqlite_master "
- "WHERE type='index' AND tbl_name LIKE '%q' "
+ "WHERE type='index' AND tbl_name LIKE shellstatic() "
"UNION ALL "
"SELECT name FROM sqlite_temp_master "
- "WHERE type='index' AND tbl_name LIKE '%q' "
+ "WHERE type='index' AND tbl_name LIKE shellstatic() "
"ORDER BY 1",
- callback, &data, &zErrMsg, azArg[1], azArg[1]
+ callback, &data, &zErrMsg
);
+ zShellStatic = 0;
if( zErrMsg ){
fprintf(stderr,"Error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
new_colv[1] = 0;
callback(&data, 1, new_argv, new_colv);
}else{
- sqlite3_exec_printf(p->db,
+ zShellStatic = azArg[1];
+ sqlite3_exec(p->db,
"SELECT sql FROM "
" (SELECT * FROM sqlite_master UNION ALL"
" SELECT * FROM sqlite_temp_master) "
- "WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOTNULL "
+ "WHERE tbl_name LIKE shellstatic() AND type!='meta' AND sql NOTNULL "
"ORDER BY substr(type,2,1), name",
- callback, &data, &zErrMsg, azArg[1]);
+ callback, &data, &zErrMsg);
+ zShellStatic = 0;
}
}else{
sqlite3_exec(p->db,
&azResult, &nRow, 0, &zErrMsg
);
}else{
- rc = sqlite3_get_table_printf(p->db,
+ zShellStatic = azArg[1];
+ rc = sqlite3_get_table(p->db,
"SELECT name FROM sqlite_master "
- "WHERE type IN ('table','view') AND name LIKE '%%%q%%' "
+ "WHERE type IN ('table','view') AND name LIKE '%'||shellstatic()||'%' "
"UNION ALL "
"SELECT name FROM sqlite_temp_master "
- "WHERE type IN ('table','view') AND name LIKE '%%%q%%' "
+ "WHERE type IN ('table','view') AND name LIKE '%'||shellstatic()||'%' "
"ORDER BY 1",
- &azResult, &nRow, 0, &zErrMsg, azArg[1], azArg[1]
+ &azResult, &nRow, 0, &zErrMsg
);
+ zShellStatic = 0;
}
if( zErrMsg ){
fprintf(stderr,"Error: %s\n", zErrMsg);
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.91 2004/06/30 04:02:12 drh Exp $
+** $Id: test1.c,v 1.92 2004/06/30 08:20:16 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
return TCL_OK;
}
+/*
+** Usage: sqlite3_complete16 <UTF-16 string>
+**
+** Return 1 if the supplied argument is a complete SQL statement, or zero
+** otherwise.
+*/
+static int test_complete16(
+ void * clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[]
+){
+ char *zBuf;
+
+ if( objc!=2 ){
+ Tcl_WrongNumArgs(interp, 1, objv, "<utf-16 sql>");
+ return TCL_ERROR;
+ }
+
+ zBuf = Tcl_GetByteArrayFromObj(objv[1], 0);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_complete16(zBuf)));
+ return TCL_OK;
+}
+
/*
** Usage: sqlite3_step STMT
**
{ "sqlite3_errmsg16", test_errmsg16 ,0 },
{ "sqlite3_open", test_open ,0 },
{ "sqlite3_open16", test_open16 ,0 },
+ { "sqlite3_complete16", test_complete16 ,0 },
{ "sqlite3_prepare", test_prepare ,0 },
{ "sqlite3_prepare16", test_prepare16 ,0 },
#***********************************************************************
# This file runs all tests.
#
-# $Id: all.test,v 1.20 2004/06/26 19:35:30 drh Exp $
+# $Id: all.test,v 1.21 2004/06/30 08:20:16 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
# Run the malloc tests and the misuse test after memory leak detection.
-# Both tests leak memory.
+# Both tests leak memory. Currently, misuse.test also leaks a handful of
+# file descriptors. This is not considered a problem, but can cause tests
+# in malloc.test to fail. So set the open-file count to zero before running
+# malloc.test to get around this.
#
catch {source $testdir/misuse.test}
+set sqlite_open_file_count 0
catch {source $testdir/malloc.test}
catch {db close}
# various suported unicode encodings (UTF-8, UTF-16, UTF-16le and
# UTF-16be).
#
-# $Id: enc2.test,v 1.16 2004/06/29 13:18:24 danielk1977 Exp $
+# $Id: enc2.test,v 1.17 2004/06/30 08:20:16 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# as the main database.
# enc2.5.*: Test the behaviour of the library when a collation sequence is
# not available for the most desirable text encoding.
-# enc2.6.*: Test that the VerifyCookie opcode protects against assuming the
+# enc2.6.*: Similar test for user functions.
+# enc2.7.*: Test that the VerifyCookie opcode protects against assuming the
# wrong text encoding for the database.
+# enc2.8.*: Test sqlite3_complete16()
+#
db close
} {one two three four five UTF-8}
# Also test that a UTF-16 collation factory works.
-do_test enc2-6-12 {
+do_test enc2-5-12 {
add_test_collate $DB 0 0 0
catchsql {
SELECT * FROM t5 ORDER BY 1 COLLATE test_collate
db close
file delete -force test.db
-# The following tests - enc2-5.* - test that SQLite selects the correct
-# collation sequence when more than one is available.
+# The following tests - enc2-6.* - test that SQLite selects the correct
+# user function when more than one is available.
proc test_function {enc arg} {
return "$enc $arg"
db close
file delete -force test.db
-# The following tests - enc2-6.* - function as follows:
+# The following tests - enc2-7.* - function as follows:
#
# 1: Open an empty database file assuming UTF-16 encoding.
# 2: Open the same database with a different handle assuming UTF-8. Create
db close
db2 close
+proc utf16 {utf8} {
+ set utf16 [encoding convertto unicode $utf8]
+ append utf16 "\x00\x00"
+ return $utf16
+}
+do_test enc2-8.1 {
+ sqlite3_complete16 [utf16 "SELECT * FROM t1;"]
+} {1}
+do_test enc2-8.2 {
+ sqlite3_complete16 [utf16 "SELECT * FROM"]
+} {0}
finish_test