-C Fixes\sto\stest\scode\sso\sthat\sthe\stest\ssuite\spasses\swithout\sSQLITE_MEMDEBUG\sdefined.\s(CVS\s4370)
-D 2007-09-03T07:31:10
+C Handle\stransient\smalloc()\sfailures\sin\ssqlite3CreateFunc().\s(CVS\s4371)
+D 2007-09-03T11:04:22
F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/delete.c 849846d06d29851dde0d9f424a5de5817eb140d1
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
F src/expr.c 7853a8161ec0b0fce62fc8da921db557899f1ec1
-F src/func.c 7c59882c72b2a2b7bf5a2e121f0727e7527bf7cd
+F src/func.c 9d88141c4cffb3a04719e5a0fda65cde34bfa1e5
F src/hash.c 8fe2fa52bd17869c87748e42cff5b1e7fbf90822
F src/hash.h 3ad3da76bfb954978d227bf495568b0e6da2c19e
F src/insert.c b11e5ca0d68bf2a7a56f47a052a0ee67dd4e2f89
F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
F src/loadext.c 6894dbbf1666577d957922811620375d6c2f058d
-F src/main.c c271d9104b6bff13d2ddd9a72fcf0926e635a9fd
+F src/main.c 04191005169375a45a8ef2afe9596d3bda8194b2
F src/malloc.c de4e77fe70a9a0ac47a1c3a874422b107231bf31
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F src/mem1.c 1f85902b98b38bd8a8b0c24012933957256db13e
F src/sqliteLimit.h 1bcbbdfa856f8b71b561abb31edb864b0eca1d12
F src/table.c 1aeb9eab57b4235db86fe15a35dec76fb445a9c4
F src/tclsqlite.c 8db035768623779c97d0509eb88ecbb49c51abca
-F src/test1.c f43580b00e3f764015acd52892690ee4f28ce775
+F src/test1.c 6103787d839c2056a42b88082b53d0b79f62285d
F src/test2.c 4ab230fbdc0decfa7422f6a052b609ba54f4dfac
F src/test3.c 199a440ba2b38b26251393b609451a3484a15907
F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
F test/fts3ao.test 0aa29dd4fc1c8d46b1f7cfe5926f7ac97551bea9
F test/fts3atoken.test 25c2070e1e8755d414bf9c8200427b277a9f99fa
F test/fts3b.test 94cd8a2fb709c99c1617df01f6908de77892d8bc
-F test/func.test 605989453d1b42cec1d05c17aa232dc98e3e04e6
+F test/func.test 71b39d44a0dffe123145b7c2973e8c4fb8a67ffd
F test/fuzz.test 62fc19dd36a427777fd671b569df07166548628a
F test/fuzz2.test ea38692ce2da99ad79fe0be5eb1a452c1c4d37bb
F test/fuzz_common.tcl ff4bc2dfc465f6878f8e2d819620914365382731
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
F test/lock4.test 49e22396b9be6e047b3d35469f233be79153c9d5
F test/main.test 913427b847c6cfba055c9d0629f7479f51ba1a48
-F test/malloc.test 52306f056e7359e68ed2e204f37f47a0e2020c57
+F test/malloc.test bb1c95fb536cfefd3a5b4ce8ca1d4c99e73b1e33
F test/malloc2.test c1a74f46a3581b56df29ff46a4e1c99b41c44ad9
F test/malloc3.test 39b72b04436a81e0c3d548d195f8bdbf1ebf4b52
F test/malloc4.test 2691bdd25fc764449051b2098692e739555246a7
-F test/malloc5.test 9db9205a5d444e23043368f961f92641c7770199
+F test/malloc5.test 4ff75206deb43120a6fc686220db13b45b9f76c7
F test/malloc6.test 3733b9bd4e039c3239f869c40edbb88172025e2e
F test/malloc7.test dd66d8f82916becf1d29b6640e4f4855485570f8
F test/malloc8.test 5ff95278bc73e815e295971afcdd175f6ba19258
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 4a9999a36d01a8c6490792605a6f7e233cc4402c
-R 7d21bfe5332f51fbfd47107d9eb37c68
+P ed2a2e0102c4fd2221096028d55a6f1d54f97274
+R a8071f6051ea0c2f23cdc36ae305ef4b
U danielk1977
-Z 34ef56b14cc4c07e252ab613eb7ad3cf
+Z fb15b228bac149e738b86ec4993bbe7d
-ed2a2e0102c4fd2221096028d55a6f1d54f97274
\ No newline at end of file
+c0ce63196458c81e0859fc8a38f2dd2145a580bc
\ No newline at end of file
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.173 2007/09/01 17:00:13 danielk1977 Exp $
+** $Id: func.c,v 1.174 2007/09/03 11:04:22 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
if( zAux ){
zRet[i*2] = '1';
if( strcmp(zAux, z) ){
- free_test_auxdata((void *)zRet);
sqlite3_result_error(pCtx, "Auxilary data corruption", -1);
return;
}
- }else{
+ }else {
zRet[i*2] = '0';
- zAux = contextMalloc(pCtx, strlen(z)+1);
- if( zAux ){
- strcpy(zAux, z);
- sqlite3_set_auxdata(pCtx, i, zAux, free_test_auxdata);
- }
+ }
+
+ zAux = contextMalloc(pCtx, strlen(z)+1);
+ if( zAux ){
+ strcpy(zAux, z);
+ sqlite3_set_auxdata(pCtx, i, zAux, free_test_auxdata);
}
zRet[i*2+1] = ' ';
}
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.402 2007/09/01 06:51:28 danielk1977 Exp $
+** $Id: main.c,v 1.403 2007/09/03 11:04:22 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
}
p = sqlite3FindFunction(db, zFunctionName, nName, nArg, enc, 1);
- if( p ){
- p->flags = 0;
- p->xFunc = xFunc;
- p->xStep = xStep;
- p->xFinalize = xFinal;
- p->pUserData = pUserData;
- p->nArg = nArg;
+ assert(p || db->mallocFailed);
+ if( !p ){
+ return SQLITE_NOMEM;
}
+ p->flags = 0;
+ p->xFunc = xFunc;
+ p->xStep = xStep;
+ p->xFinalize = xFinal;
+ p->pUserData = pUserData;
+ p->nArg = nArg;
return SQLITE_OK;
}
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.274 2007/09/01 11:04:26 danielk1977 Exp $
+** $Id: test1.c,v 1.275 2007/09/03 11:04:22 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
}
}
+static void legacyCountStep(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ /* no-op */
+}
+static void legacyCountFinalize(sqlite3_context *context){
+ sqlite3_result_int(context, sqlite3_aggregate_count(context));
+}
+
/*
-** Usage: sqlite_test_create_aggregate DB
+** Usage: sqlite3_create_aggregate DB
**
** Call the sqlite3_create_function API on the given database in order
-** to create a function named "x_count". This function does the same thing
-** as the "md5sum" function.
+** to create a function named "x_count". This function is similar
+** to the built-in count() function, with a few special quirks
+** for testing the sqlite3_result_error() APIs.
**
** The original motivation for this routine was to be able to call the
** sqlite3_create_aggregate function while a query is in progress in order
**
** This routine was later extended to test the use of sqlite3_result_error()
** within aggregate functions.
+**
+** Later: It is now also extended to register the aggregate function
+** "legacy_count()" with the supplied database handle. This is used
+** to test the deprecated sqlite3_aggregate_count() API.
*/
static int test_create_aggregate(
void *NotUsed,
rc = sqlite3_create_function(db, "x_count", 0, SQLITE_UTF8, 0, 0,
t1CountStep,t1CountFinalize);
if( rc==SQLITE_OK ){
- sqlite3_create_function(db, "x_count", 1, SQLITE_UTF8, 0, 0,
+ rc = sqlite3_create_function(db, "x_count", 1, SQLITE_UTF8, 0, 0,
t1CountStep,t1CountFinalize);
}
+ if( rc==SQLITE_OK ){
+ rc = sqlite3_create_function(db, "legacy_count", 0, SQLITE_ANY, 0, 0,
+ legacyCountStep, legacyCountFinalize
+ );
+ }
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
+ Tcl_SetResult(interp, (char *)t1ErrorName(rc), 0);
return TCL_OK;
}
# This file implements regression tests for SQLite library. The
# focus of this file is testing built-in functions.
#
-# $Id: func.test,v 1.67 2007/05/15 18:35:21 drh Exp $
+# $Id: func.test,v 1.68 2007/09/03 11:04:22 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
execsql {SELECT typeof(trim('hello',NULL));}
} {null}
+# This is to test the deprecated sqlite3_aggregate_count() API.
+#
+do_test func-23.1 {
+ sqlite3_create_aggregate db
+ execsql {
+ SELECT legacy_count() FROM t6;
+ }
+} {3}
+
finish_test
# to see what happens in the library if a malloc were to really fail
# due to an out-of-memory situation.
#
-# $Id: malloc.test,v 1.45 2007/08/29 12:31:29 danielk1977 Exp $
+# $Id: malloc.test,v 1.46 2007/09/03 11:04:22 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# sqlite3_create_function().
do_malloc_test 11 -tclbody {
set rc [sqlite3_create_function db]
+ if {[string match $rc SQLITE_OK]} {
+ set rc [sqlite3_create_aggregate db]
+ }
if {[string match $rc SQLITE_NOMEM]} {
error "out of memory"
}
# This file contains test cases focused on the two memory-management APIs,
# sqlite3_soft_heap_limit() and sqlite3_release_memory().
#
-# $Id: malloc5.test,v 1.14 2007/08/28 08:00:18 danielk1977 Exp $
+# $Id: malloc5.test,v 1.15 2007/09/03 11:04:22 danielk1977 Exp $
#---------------------------------------------------------------------------
# NOTES ON EXPECTED BEHAVIOUR
}
copy_file test.db test2.db
sqlite3 db2 test2.db
- list [expr [file size test.db]/1024] [expr [file size test2.db]/1024]
-} {23 23}
+ list \
+ [expr ([file size test.db]/1024)>20] [expr ([file size test2.db]/1024)>20]
+} {1 1}
do_test malloc5-6.1.2 {
list [execsql {PRAGMA cache_size}] [execsql {PRAGMA cache_size} db2]
} {10 10}