]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the experimental create_collation_x() api. (CVS 3934)
authordanielk1977 <danielk1977@noemail.net>
Mon, 7 May 2007 09:32:45 +0000 (09:32 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Mon, 7 May 2007 09:32:45 +0000 (09:32 +0000)
FossilOrigin-Name: ff49d48f2f025898a0f4ace1fc227e1d367ea89f

ext/icu/icu.c
manifest
manifest.uuid
src/callback.c
src/main.c
src/sqlite.h.in
src/sqliteInt.h
src/test1.c
test/incrblob.test

index 5bec882a74f40451eb03ca24d2f691a611b2cbf8..2dddc0489d9c4a4749b3dd9fe38dfec9443fc6e9 100644 (file)
@@ -45,6 +45,12 @@ static void xFree(void *p){
   sqlite3_free(p);
 }
 
+/*
+** LIKE operator.
+**
+** http://unicode.org/reports/tr21/tr21-5.html#Caseless_Matching
+*/
+
 /*
 ** Function to delete compiled regexp objects. Registered as
 ** a destructor function with sqlite3_set_auxdata().
@@ -151,6 +157,8 @@ static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){
 **
 **     lower('I', 'en_us') -> 'i'
 **     lower('I', 'tr_tr') -> 'ı' (small dotless i)
+**
+** http://www.icu-project.org/userguide/posix.html#case_mappings
 */
 static void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){
   const UChar *zInput;
@@ -193,13 +201,11 @@ static void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){
 ** Register the ICU extension functions with database db.
 */
 int sqlite3IcuInit(sqlite3 *db){
-  int rc;
-  int ii;
   struct IcuScalar {
-    const char *zName;
-    int nArg;
-    int enc;
-    void *pContext;
+    const char *zName;                        /* Function name */
+    int nArg;                                 /* Number of arguments */
+    int enc;                                  /* Optimal text encoding */
+    void *pContext;                           /* sqlite3_user_data() context */
     void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
   } scalars[] = {
     {"regexp", 2, SQLITE_ANY,          0, icuRegexpFunc},
@@ -209,20 +215,23 @@ int sqlite3IcuInit(sqlite3 *db){
     {"upper",  1, SQLITE_UTF16, (void*)1, icuCaseFunc16},
     {"upper",  2, SQLITE_UTF16, (void*)1, icuCaseFunc16},
 
-    {"lower",  1, SQLITE_UTF8,        0, icuCaseFunc16},
-    {"lower",  2, SQLITE_UTF8,        0, icuCaseFunc16},
-    {"upper",  1, SQLITE_UTF8, (void*)1, icuCaseFunc16},
-    {"upper",  2, SQLITE_UTF8, (void*)1, icuCaseFunc16},
+    {"lower",  1, SQLITE_UTF8,         0, icuCaseFunc16},
+    {"lower",  2, SQLITE_UTF8,         0, icuCaseFunc16},
+    {"upper",  1, SQLITE_UTF8,  (void*)1, icuCaseFunc16},
+    {"upper",  2, SQLITE_UTF8,  (void*)1, icuCaseFunc16},
   };
 
-  for(ii=0; ii<(sizeof(scalars)/sizeof(struct IcuScalar)); ii++){
-    struct IcuScalar *p = &scalars[ii];
+  int rc = SQLITE_OK;
+  int i;
+
+  for(i=0; rc==SQLITE_OK && i<(sizeof(scalars)/sizeof(struct IcuScalar)); i++){
+    struct IcuScalar *p = &scalars[i];
     rc = sqlite3_create_function(
         db, p->zName, p->nArg, p->enc, p->pContext, p->xFunc, 0, 0
     );
   }
 
-  return SQLITE_OK;
+  return rc;
 }
 
 #if !SQLITE_CORE
index e42e731ecc3bfa26280470310a374ff422b5b705..4fe782c25aaf4ab7c097fb1e92ad0613436b4d9d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\smissing\sword\sin\sthe\scopyright.html\sweb\spage.\s(CVS\s3933)
-D 2007-05-06T21:20:43
+C Add\sthe\sexperimental\screate_collation_x()\sapi.\s(CVS\s3934)
+D 2007-05-07T09:32:45
 F Makefile.in ea8888bdcf53313d26576fcabcb6d0a10ecd35cd
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -43,7 +43,7 @@ F ext/fts2/fts2_porter.c 991a45463553c7318063fe7773368a6c0f39e35d
 F ext/fts2/fts2_tokenizer.h 4c5ffe31d63622869eb6eec1503df7f6996fd1bd
 F ext/fts2/fts2_tokenizer1.c 5c979fe8815f95396beb22b627571da895a025af
 F ext/fts2/mkfts2amal.tcl 2a9ec76b0760fe7f3669dca5bc0d60728bc1c977
-F ext/icu/icu.c 17ad2387c27133b5fcf7037687d5ff346f4a1da7
+F ext/icu/icu.c a30999ba467749ed6232d02cc8c4b5a0e62cd727
 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
 F ltmain.sh 56abb507100ed2d4261f6dd1653dec3cf4066387
 F main.mk 6298bd3fcbc590fe05354f7d962c57ac202d7bcd
@@ -65,7 +65,7 @@ F src/btree.c 6d3db6416c71f678a4dd4719ce6d754ad5927c46
 F src/btree.h 845543b5a53d5d8a80ea14aeeb521276602317b7
 F src/btreeInt.h cb3c0e9eb842d06079a62cdf3492c90c5db7ba75
 F src/build.c 0dd6f0d0a5d304be91374f4c7228a3e9b00ff7f1
-F src/callback.c 6414ed32d55859d0f65067aa5b88d2da27b3af9e
+F src/callback.c 9c12535669a638f90a67e10440b99c7b93c0fbf4
 F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
 F src/date.c c34a9c86ffd6da4cb3903ea038d977ec539d07e2
 F src/delete.c 5c0d89b3ef7d48fe1f5124bfe8341f982747fe29
@@ -77,7 +77,7 @@ F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
 F src/insert.c e595ca26805dfb3a9ebaabc28e7947c479f3b14d
 F src/legacy.c 388c71ad7fbcd898ba1bcbfc98a3ac954bfa5d01
 F src/loadext.c afe4f4755dc49c36ef505748bbdddecb9f1d02a2
-F src/main.c 2e11ec21dd11008a339b1d6d61aeb9b51992b2cf
+F src/main.c ada896b9554aa71e717a6ab237ab0eff63a1e1e4
 F src/malloc.c b89e31258a85158d15795bf87ae3ba007e56329b
 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
 F src/os.c 4650e98aadd27abfe1698ff58edf6893c58d4881
@@ -101,12 +101,12 @@ F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
 F src/select.c a306d03fc7d8365055bef70c3563e8fca897460f
 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
 F src/shell.c d07ae326b3815d80f71c69b3c7584382e47f6447
-F src/sqlite.h.in a666300976897eced975b448f722a722b362c6b1
+F src/sqlite.h.in e9b82a9e6e24e279d4e9d239535fbdae464b5594
 F src/sqlite3ext.h 7d0d363ea7327e817ef0dfe1b7eee1f171b72890
-F src/sqliteInt.h 3ffe2f9c801575e315451e7d2831c4a90a165aa8
+F src/sqliteInt.h 5e1cf645ef1bf8b43c5d020adbeed43746df24ed
 F src/table.c a8de75bcedf84d4060d804264b067ab3b1a3561d
 F src/tclsqlite.c f3414b2d6bc37e6760b49c9abd3504ff69f4441b
-F src/test1.c 17e8402b4b567317b4e49923658d1f5874eaee5f
+F src/test1.c a91c84e903e3a59ad3bf6c10bd5b93e74d631ea2
 F src/test2.c 24458b17ab2f3c90cbc1c8446bd7ffe69be62f88
 F src/test3.c 946ea9d1a8c928656e3c70f0a2fcb8e733a15e86
 F src/test4.c 8b784cd82de158a2317cb4ac4bc86f91ad315e25
@@ -247,7 +247,7 @@ F test/fts2n.test a70357e72742681eaebfdbe9007b87ff3b771638
 F test/func.test 6727c7729472ae52b5acd86e802f89aa350ba50f
 F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
 F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
-F test/incrblob.test 9fd59c5f8460d036188b22688f6c20d5b39e78e6
+F test/incrblob.test 7f82ae497364612aa17a37f77f12e01e2bee9f20
 F test/incrblob_err.test 9dae0762ba4d73b516d176d091c6b2b16f625953
 F test/incrvacuum.test f490c8ae86f2ecca622425d02e27d3119058cb21
 F test/incrvacuum2.test a1457ad2441e49e99fbc4d74f9575dd9f7ddbde3
@@ -481,7 +481,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 9600a998043c6dd1d5ecb03d1ee9a9273910243d
-R d5b5efe0e3f18ed8a6801bd7106e316f
-U drh
-Z a53400e87a52148d7645178e850caa33
+P 2d1348dda2cbdf958a15267432063f359550c303
+R cb3c4e9539473867932a2c5f74528890
+U danielk1977
+Z eaa2b3011ed3cbd2140fcff678e040f6
index e926e10ce1bc581efb69c89f7411e2824da4874a..53affad84b2273be6d7090bf72bed6802e07baf1 100644 (file)
@@ -1 +1 @@
-2d1348dda2cbdf958a15267432063f359550c303
\ No newline at end of file
+ff49d48f2f025898a0f4ace1fc227e1d367ea89f
\ No newline at end of file
index 87f5b247212d3150ecf1de6eff0979e587b09c94..f3d418808ad19cb4d5a6d3676e2af00b89ca8c62 100644 (file)
@@ -13,7 +13,7 @@
 ** This file contains functions used to access the internal hash tables
 ** of user defined functions and collation sequences.
 **
-** $Id: callback.c,v 1.17 2007/04/16 15:06:25 danielk1977 Exp $
+** $Id: callback.c,v 1.18 2007/05/07 09:32:45 danielk1977 Exp $
 */
 
 #include "sqliteInt.h"
@@ -63,6 +63,7 @@ static int synthCollSeq(sqlite3 *db, CollSeq *pColl){
     pColl2 = sqlite3FindCollSeq(db, aEnc[i], z, n, 0);
     if( pColl2->xCmp!=0 ){
       memcpy(pColl, pColl2, sizeof(CollSeq));
+      pColl->xDel = 0;         /* Do not copy the destructor */
       return SQLITE_OK;
     }
   }
index 38aa70bb18e56e94b2c5e742598aa80eb59779a6..bd72bdd97ee99ab867b16c13386afc6d3f9bca25 100644 (file)
@@ -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.371 2007/05/06 16:04:12 danielk1977 Exp $
+** $Id: main.c,v 1.372 2007/05/07 09:32:45 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -182,6 +182,12 @@ int sqlite3_close(sqlite3 *db){
 
   for(i=sqliteHashFirst(&db->aCollSeq); i; i=sqliteHashNext(i)){
     CollSeq *pColl = (CollSeq *)sqliteHashData(i);
+    /* Invoke any destructors registered for collation sequence user data. */
+    for(j=0; j<3; j++){
+      if( pColl[j].xDel ){
+        pColl[j].xDel(pColl[j].pUser);
+      }
+    }
     sqliteFree(pColl);
   }
   sqlite3HashClear(&db->aCollSeq);
@@ -825,7 +831,8 @@ static int createCollation(
   const char *zName, 
   int enc, 
   void* pCtx,
-  int(*xCompare)(void*,int,const void*,int,const void*)
+  int(*xCompare)(void*,int,const void*,int,const void*),
+  void(*xDel)(void*)
 ){
   CollSeq *pColl;
   int enc2;
@@ -860,12 +867,33 @@ static int createCollation(
       return SQLITE_BUSY;
     }
     sqlite3ExpirePreparedStatements(db);
+
+    /* If collation sequence pColl was created directly by a call to
+    ** sqlite3_create_collation, and not generated by synthCollSeq(),
+    ** then any copies made by synthCollSeq() need to be invalidated.
+    ** Also, collation destructor - CollSeq.xDel() - function may need
+    ** to be called.
+    */ 
+    if( (pColl->enc & ~SQLITE_UTF16_ALIGNED)==enc2 ){
+      CollSeq *aColl = sqlite3HashFind(&db->aCollSeq, zName, strlen(zName));
+      int j;
+      for(j=0; j<3; j++){
+        CollSeq *p = &aColl[j];
+        if( p->enc==pColl->enc ){
+          if( p->xDel ){
+            p->xDel(p->pUser);
+          }
+          p->xCmp = 0;
+        }
+      }
+    }
   }
 
   pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, strlen(zName), 1);
   if( pColl ){
     pColl->xCmp = xCompare;
     pColl->pUser = pCtx;
+    pColl->xDel = xDel;
     pColl->enc = enc2 | (enc & SQLITE_UTF16_ALIGNED);
   }
   sqlite3Error(db, SQLITE_OK, 0);
@@ -915,9 +943,9 @@ static int openDatabase(
   ** and UTF-16, so add a version for each to avoid any unnecessary
   ** conversions. The only error that can occur here is a malloc() failure.
   */
-  if( createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc) ||
-      createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc) ||
-      createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc) ||
+  if( createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc, 0) ||
+      createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc, 0) ||
+      createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0) ||
       (db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 6, 0))==0 
   ){
     assert( sqlite3MallocFailed() );
@@ -926,7 +954,7 @@ static int openDatabase(
   }
 
   /* Also add a UTF-8 case-insensitive collation sequence. */
-  createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc);
+  createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
 
   /* Set flags on the built-in collating sequences */
   db->pDfltColl->type = SQLITE_COLL_BINARY;
@@ -986,7 +1014,7 @@ static int openDatabase(
 #endif
 
 #ifdef SQLITE_ENABLE_ICU
-  {
+  if( !sqlite3MallocFailed() ){
     extern int sqlite3IcuInit(sqlite3*);
     sqlite3IcuInit(db);
   }
@@ -1106,7 +1134,24 @@ int sqlite3_create_collation(
 ){
   int rc;
   assert( !sqlite3MallocFailed() );
-  rc = createCollation(db, zName, enc, pCtx, xCompare);
+  rc = createCollation(db, zName, enc, pCtx, xCompare, 0);
+  return sqlite3ApiExit(db, rc);
+}
+
+/*
+** Register a new collation sequence with the database handle db.
+*/
+int sqlite3_create_collation_x(
+  sqlite3* db, 
+  const char *zName, 
+  int enc, 
+  void* pCtx,
+  int(*xCompare)(void*,int,const void*,int,const void*),
+  void(*xDel)(void*)
+){
+  int rc;
+  assert( !sqlite3MallocFailed() );
+  rc = createCollation(db, zName, enc, pCtx, xCompare, xDel);
   return sqlite3ApiExit(db, rc);
 }
 
@@ -1126,7 +1171,7 @@ int sqlite3_create_collation16(
   assert( !sqlite3MallocFailed() );
   zName8 = sqlite3utf16to8(zName, -1);
   if( zName8 ){
-    rc = createCollation(db, zName8, enc, pCtx, xCompare);
+    rc = createCollation(db, zName8, enc, pCtx, xCompare, 0);
     sqliteFree(zName8);
   }
   return sqlite3ApiExit(db, rc);
index 4af11e26ca5c843419e28fe07d512137674737cd..f84128c55a01cb40c7d88400653e4fac238a40da 100644 (file)
@@ -12,7 +12,7 @@
 ** This header file defines the interface that the SQLite library
 ** presents to client programs.
 **
-** @(#) $Id: sqlite.h.in,v 1.204 2007/05/03 16:31:26 danielk1977 Exp $
+** @(#) $Id: sqlite.h.in,v 1.205 2007/05/07 09:32:45 danielk1977 Exp $
 */
 #ifndef _SQLITE3_H_
 #define _SQLITE3_H_
@@ -1279,6 +1279,18 @@ int sqlite3_create_collation16(
   int(*xCompare)(void*,int,const void*,int,const void*)
 );
 
+/*
+****** EXPERIMENTAL - subject to change without notice **************
+*/
+int sqlite3_create_collation_x(
+  sqlite3*, 
+  const char *zName, 
+  int eTextRep, 
+  void*,
+  int(*xCompare)(void*,int,const void*,int,const void*),
+  void(*xDel)(void*)
+);
+
 /*
 ** To avoid having to register all collation sequences before a database
 ** can be used, a single callback function may be registered with the
index c5917c643be935509601ac71ecbaf785ac3d72d1..374f1ebe1f22fffcb979515f26067075f6293539 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.557 2007/05/05 11:48:54 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.558 2007/05/07 09:32:45 danielk1977 Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -646,11 +646,12 @@ struct Column {
 ** collating sequence may not be read or written.
 */
 struct CollSeq {
-  char *zName;         /* Name of the collating sequence, UTF-8 encoded */
-  u8 enc;              /* Text encoding handled by xCmp() */
-  u8 type;             /* One of the SQLITE_COLL_... values below */
-  void *pUser;         /* First argument to xCmp() */
+  char *zName;          /* Name of the collating sequence, UTF-8 encoded */
+  u8 enc;               /* Text encoding handled by xCmp() */
+  u8 type;              /* One of the SQLITE_COLL_... values below */
+  void *pUser;          /* First argument to xCmp() */
   int (*xCmp)(void*,int, const void*, int, const void*);
+  void (*xDel)(void*);  /* Destructor for pUser */
 };
 
 /*
index e4221b110f7b6bf10d5d82866f2a3fafd5af0906..479390dead194e13d72609a9de1b883a4f284626 100644 (file)
@@ -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.247 2007/05/06 16:04:12 danielk1977 Exp $
+** $Id: test1.c,v 1.248 2007/05/07 09:32:45 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -1508,6 +1508,18 @@ static int test_table_column_metadata(
 
 /*
 ** sqlite3_blob_read  CHANNEL OFFSET N
+**
+**   This command is used to test the sqlite3_blob_read() in ways that
+**   the Tcl channel interface does not. The first argument should
+**   be the name of a valid channel created by the [incrblob] method
+**   of a database handle. This function calls sqlite3_blob_read()
+**   to read N bytes from offset OFFSET from the underlying SQLite
+**   blob handle.
+**
+**   On success, a byte-array object containing the read data is 
+**   returned. On failure, the interpreter result is set to the
+**   text representation of the returned error code (i.e. "SQLITE_NOMEM")
+**   and a Tcl exception is thrown.
 */
 static int test_blob_read(
   ClientData clientData, /* Not used */
@@ -1555,6 +1567,17 @@ static int test_blob_read(
 
 /*
 ** sqlite3_blob_write CHANNEL OFFSET DATA
+**
+**   This command is used to test the sqlite3_blob_write() in ways that
+**   the Tcl channel interface does not. The first argument should
+**   be the name of a valid channel created by the [incrblob] method
+**   of a database handle. This function calls sqlite3_blob_write()
+**   to write the DATA byte-array to the underlying SQLite blob handle.
+**   at offset OFFSET.
+**
+**   On success, an empty string is returned. On failure, the interpreter
+**   result is set to the text representation of the returned error code 
+**   (i.e. "SQLITE_NOMEM") and a Tcl exception is thrown.
 */
 static int test_blob_write(
   ClientData clientData, /* Not used */
@@ -1598,6 +1621,82 @@ static int test_blob_write(
 }
 #endif
 
+/*
+** Usage: sqlite3_create_collation_x DB-HANDLE NAME CMP-PROC DEL-PROC
+**
+**   This Tcl proc is used for testing the experimental
+**   sqlite3_create_collation_x() interface.
+*/
+struct TestCollationX {
+  Tcl_Interp *interp;
+  Tcl_Obj *pCmp;
+  Tcl_Obj *pDel;
+};
+typedef struct TestCollationX TestCollationX;
+static void testCreateCollationDel(void *pCtx){
+  TestCollationX *p = (TestCollationX *)pCtx;
+
+  int rc = Tcl_EvalObjEx(p->interp, p->pDel, TCL_EVAL_DIRECT|TCL_EVAL_GLOBAL);
+  if( rc!=TCL_OK ){
+    Tcl_BackgroundError(p->interp);
+  }
+
+  Tcl_DecrRefCount(p->pCmp);
+  Tcl_DecrRefCount(p->pDel);
+  sqlite3_free((void *)p);
+}
+static int testCreateCollationCmp(
+  void *pCtx,
+  int nLeft,
+  const void *zLeft,
+  int nRight,
+  const void *zRight
+){
+  TestCollationX *p = (TestCollationX *)pCtx;
+  Tcl_Obj *pScript = Tcl_DuplicateObj(p->pCmp);
+  int iRes = 0;
+
+  Tcl_IncrRefCount(pScript);
+  Tcl_ListObjAppendElement(0, pScript, Tcl_NewStringObj((char *)zLeft, nLeft));
+  Tcl_ListObjAppendElement(0, pScript, Tcl_NewStringObj((char *)zRight,nRight));
+
+  if( TCL_OK!=Tcl_EvalObjEx(p->interp, pScript, TCL_EVAL_DIRECT|TCL_EVAL_GLOBAL)
+   || TCL_OK!=Tcl_GetIntFromObj(p->interp, Tcl_GetObjResult(p->interp), &iRes)
+  ){
+    Tcl_BackgroundError(p->interp);
+  }
+  Tcl_DecrRefCount(pScript);
+
+  return iRes;
+}
+static int test_create_collation_x(
+  ClientData clientData, /* Not used */
+  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
+  int objc,              /* Number of arguments */
+  Tcl_Obj *CONST objv[]  /* Command arguments */
+){
+  TestCollationX *p;
+  sqlite3 *db;
+
+  if( objc!=5 ){
+    Tcl_WrongNumArgs(interp, 1, objv, "DB-HANDLE NAME CMP-PROC DEL-PROC");
+    return TCL_ERROR;
+  }
+  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
+
+  p = (TestCollationX *)sqlite3_malloc(sizeof(TestCollationX));
+  p->pCmp = objv[3];
+  p->pDel = objv[4];
+  p->interp = interp;
+  Tcl_IncrRefCount(p->pCmp);
+  Tcl_IncrRefCount(p->pDel);
+
+  sqlite3_create_collation_x(db, Tcl_GetString(objv[2]), SQLITE_UTF8, 
+      (void *)p, testCreateCollationCmp, testCreateCollationDel
+  );
+  return TCL_OK;
+}
+
 /*
 ** Usage: sqlite3_load_extension DB-HANDLE FILE ?PROC?
 */
@@ -4617,8 +4716,9 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
 {"sqlite3_column_origin_name16", test_stmt_utf16, sqlite3_column_origin_name16},
 #endif
 #endif
-     { "sqlite3_global_recover",    test_global_recover, 0   },
-     { "working_64bit_int",         working_64bit_int,   0   },
+     { "sqlite3_create_collation_x", test_create_collation_x, 0 },
+     { "sqlite3_global_recover",     test_global_recover, 0   },
+     { "working_64bit_int",          working_64bit_int,   0   },
 
      /* Functions from os.h */
 #ifndef SQLITE_OMIT_DISKIO
index 49c404b62aa0084b3fad20f51a73a0f497a0b076..0673b95f4d19f14b645a04cf9206e43811d693a9 100644 (file)
@@ -9,7 +9,7 @@
 #
 #***********************************************************************
 #
-# $Id: incrblob.test,v 1.9 2007/05/04 19:03:03 danielk1977 Exp $
+# $Id: incrblob.test,v 1.10 2007/05/07 09:32:45 danielk1977 Exp $
 #
 
 set testdir [file dirname $argv0]
@@ -551,7 +551,7 @@ do_test incrblob-7.3.2 {
 do_test incrblob-7.3.3 {
   execsql {
     DELETE FROM t1 WHERE a = 123;
-    INCREMENTAL VACUUM;
+    PRAGMA INCREMENTAL_VACUUM(0);
   }
   seek $::b 0
   read $::b