aboutsummaryrefslogtreecommitdiff
path: root/src/test1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test1.c')
-rw-r--r--src/test1.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/test1.c b/src/test1.c
index c250d2b36..11ffb1e23 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.269 2007/08/22 02:56:44 drh Exp $
+** $Id: test1.c,v 1.270 2007/08/22 20:18:22 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -955,12 +955,18 @@ static int test_create_function(
** because it is not tested anywhere else. */
if( rc==SQLITE_OK ){
sqlite3_value *pVal;
- pVal = sqlite3ValueNew(0);
+ sqlite3_mutex_enter(db->mutex);
+ pVal = sqlite3ValueNew(db);
sqlite3ValueSetStr(pVal, -1, "x_sqlite_exec", SQLITE_UTF8, SQLITE_STATIC);
- rc = sqlite3_create_function16(db,
+ if( db->mallocFailed ){
+ rc = SQLITE_NOMEM;
+ }else{
+ rc = sqlite3_create_function16(db,
sqlite3ValueText(pVal, SQLITE_UTF16NATIVE),
1, SQLITE_UTF16, db, sqlite3ExecFunc, 0, 0);
+ }
sqlite3ValueFree(pVal);
+ sqlite3_mutex_leave(db->mutex);
}
#endif
@@ -2134,12 +2140,18 @@ static int test_collate(
sqlite3_iMallocFail++;
}
#endif
- pVal = sqlite3ValueNew(0);
+ sqlite3_mutex_enter(db->mutex);
+ pVal = sqlite3ValueNew(db);
sqlite3ValueSetStr(pVal, -1, "test_collate", SQLITE_UTF8, SQLITE_STATIC);
- rc = sqlite3_create_collation16(db,
+ if( db->mallocFailed ){
+ rc = SQLITE_NOMEM;
+ }else{
+ rc = sqlite3_create_collation16(db,
sqlite3ValueText(pVal, SQLITE_UTF16NATIVE), SQLITE_UTF16BE,
(void *)SQLITE_UTF16BE, val?test_collate_func:0);
+ }
sqlite3ValueFree(pVal);
+ sqlite3_mutex_leave(db->mutex);
}
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;