SQLite Forum

[PATCH] Drop SQLITE_ENABLE_ICU_COLLATIONS
Login

[PATCH] Drop SQLITE_ENABLE_ICU_COLLATIONS

(1) By Arfrever Frehtes Taifersar Arahesis (Arfrever) on 2020-06-29 20:58:35 [source]

I noticed that number of tests run by whole test suite is
smaller when SQLite is compiled with merely -DSQLITE_ENABLE_ICU than
with -DSQLITE_ENABLE_ICU -DSQLITE_ENABLE_ICU_COLLATIONS.

src/test_config.c sets icu_collations setting based on
SQLITE_ENABLE_ICU_COLLATIONS macro.
ext/rbu/rbucollate.test has "ifcapable !icu_collations", while other tests usually check icu, not icu_collations.

SQLITE_ENABLE_ICU_COLLATIONS macro is undocumented and has no other effect.
All other places, which check SQLITE_ENABLE_ICU_COLLATIONS macro, also
check SQLITE_ENABLE_ICU macro.
I suggest to drop SQLITE_ENABLE_ICU_COLLATIONS macro and
icu_collations setting in test suite.

There is also unrelated typo "idu-6.0" in test/icu.test.

Patch:

Index: ext/icu/icu.c
==================================================================
--- ext/icu/icu.c
+++ ext/icu/icu.c
@@ -26,13 +26,11 @@
 **
 **   * An implementation of the LIKE operator that uses ICU to 
 **     provide case-independent matching.
 */
 
-#if !defined(SQLITE_CORE)                  \
- || defined(SQLITE_ENABLE_ICU)             \
- || defined(SQLITE_ENABLE_ICU_COLLATIONS)
+#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU)
 
 /* Include ICU headers */
 #include <unicode/utypes.h>
 #include <unicode/uregex.h>
 #include <unicode/ustring.h>

Index: ext/rbu/rbucollate.test
==================================================================
--- ext/rbu/rbucollate.test
+++ ext/rbu/rbucollate.test
@@ -11,11 +11,11 @@
 #
 
 source [file join [file dirname [info script]] rbu_common.tcl]
 set ::testprefix rbucollate
 
-ifcapable !icu_collations {
+ifcapable !icu {
   finish_test
   return
 }
 
 db close

Index: src/main.c
==================================================================
--- src/main.c
+++ src/main.c
@@ -20,11 +20,11 @@
 # include "fts3.h"
 #endif
 #ifdef SQLITE_ENABLE_RTREE
 # include "rtree.h"
 #endif
-#if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
+#ifdef SQLITE_ENABLE_ICU
 # include "sqliteicu.h"
 #endif
 
 /*
 ** This is an extension initializer that is a no-op and always
@@ -72,11 +72,11 @@
   sqlite3Fts3Init,
 #endif
 #ifdef SQLITE_ENABLE_FTS5
   sqlite3Fts5Init,
 #endif
-#if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
+#ifdef SQLITE_ENABLE_ICU
   sqlite3IcuInit,
 #endif
 #ifdef SQLITE_ENABLE_RTREE
   sqlite3RtreeInit,
 #endif

Index: src/test_config.c
==================================================================
--- src/test_config.c
+++ src/test_config.c
@@ -435,16 +435,10 @@
   Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY);
 #else
   Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY);
 #endif
 
-#ifdef SQLITE_ENABLE_ICU_COLLATIONS
-  Tcl_SetVar2(interp, "sqlite_options", "icu_collations", "1", TCL_GLOBAL_ONLY);
-#else
-  Tcl_SetVar2(interp, "sqlite_options", "icu_collations", "0", TCL_GLOBAL_ONLY);
-#endif
-
 #ifdef SQLITE_OMIT_INCRBLOB
   Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY);
 #else
   Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY);
 #endif /* SQLITE_OMIT_AUTOVACUUM */

Index: test/icu.test
==================================================================
--- test/icu.test
+++ test/icu.test
@@ -13,11 +13,11 @@
 #
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
-ifcapable !icu&&!icu_collations {
+ifcapable !icu {
   finish_test
   return
 }
 
 # Create a table to work with.
@@ -147,11 +147,11 @@
 }
 
 # 2020-03-19
 # The ESCAPE clause on LIKE takes precedence over wildcards
 #
-do_execsql_test idu-6.0 {
+do_execsql_test icu-6.0 {
   DROP TABLE IF EXISTS t1;
   CREATE TABLE t1(id INTEGER PRIMARY KEY, x TEXT);
   INSERT INTO t1 VALUES
     (1,'abcde'),
     (2,'abc_'),