/ Check-in [b53640ed]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove the sqlite3_libencoding() api and the ISO8859 encoding option. (CVS 1523)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b53640ed2232aaf173a71636073477d80407d11f
User & Date: drh 2004-06-02 00:41:09
Context
2004-06-02
01:22
Work toward combining the OP_MakeKey, OP_MakeIdxKey, and OP_MakeRecord opcodes into one. The work is incomplete. (CVS 1524) check-in: 165d69a0 user: drh tags: trunk
00:41
Remove the sqlite3_libencoding() api and the ISO8859 encoding option. (CVS 1523) check-in: b53640ed user: drh tags: trunk
00:29
Fix a bug with UTF-16 byte-order-marks on big-endian hosts. (CVS 1522) check-in: c17b8641 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Main file for the SQLite library.  The routines in this file
    13     13   ** implement the programmer interface to the library.  Routines in
    14     14   ** other files are for internal use by SQLite and should not be
    15     15   ** accessed by users of the library.
    16     16   **
    17         -** $Id: main.c,v 1.202 2004/06/01 00:03:53 danielk1977 Exp $
           17  +** $Id: main.c,v 1.203 2004/06/02 00:41:09 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** A pointer to this structure is used to communicate information
................................................................................
   384    384   
   385    385   /*
   386    386   ** The version of the library
   387    387   */
   388    388   const char rcsid[] = "@(#) \044Id: SQLite version " SQLITE_VERSION " $";
   389    389   const char sqlite3_version[] = SQLITE_VERSION;
   390    390   
   391         -/*
   392         -** Does the library expect data to be encoded as UTF-8 or iso8859?  The
   393         -** following global constant always lets us know.
   394         -*/
   395         -#ifdef SQLITE_UTF8
   396         -const char sqlite3_encoding[] = "UTF-8";
   397         -#else
   398         -const char sqlite3_encoding[] = "iso8859";
   399         -#endif
   400         -
   401    391   /*
   402    392   ** This is the default collating function named "BINARY" which is always
   403    393   ** available.
   404    394   */
   405    395   static int binaryCollatingFunc(
   406    396     void *NotUsed,
   407    397     int nKey1, const void *pKey1,
................................................................................
   637    627   ** Note that we need to call free() not sqliteFree() here, since every
   638    628   ** string that is exported from SQLite should have already passed through
   639    629   ** sqlite3StrRealloc().
   640    630   */
   641    631   void sqlite3_free(char *p){ free(p); }
   642    632   
   643    633   /*
   644         -** Windows systems need functions to call to return the sqlite3_version
   645         -** and sqlite3_encoding strings since they are unable to access constants
   646         -** within DLLs.
          634  +** Create new user functions.
   647    635   */
   648         -const char *sqlite3_libversion(void){ return sqlite3_version; }
   649         -const char *sqlite3_libencoding(void){ return sqlite3_encoding; }
   650         -
   651    636   int sqlite3_create_function(
   652    637     sqlite3 *db,
   653    638     const char *zFunctionName,
   654    639     int nArg,
   655    640     int eTextRep,
   656    641     int iCollateArg,
   657    642     void *pUserData,

Changes to src/sqlite.h.in.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This header file defines the interface that the SQLite library
    13     13   ** presents to client programs.
    14     14   **
    15         -** @(#) $Id: sqlite.h.in,v 1.89 2004/06/01 00:03:53 danielk1977 Exp $
           15  +** @(#) $Id: sqlite.h.in,v 1.90 2004/06/02 00:41:09 drh Exp $
    16     16   */
    17     17   #ifndef _SQLITE_H_
    18     18   #define _SQLITE_H_
    19     19   #include <stdarg.h>     /* Needed for the definition of va_list */
    20     20   
    21     21   /*
    22     22   ** Make sure we can call this stuff from C++.
................................................................................
   366    366   ** should always use %q instead of %s when inserting text into a string 
   367    367   ** literal.
   368    368   */
   369    369   char *sqlite3_mprintf(const char*,...);
   370    370   char *sqlite3_vmprintf(const char*, va_list);
   371    371   void sqlite3_free(char *z);
   372    372   
   373         -/*
   374         -** Windows systems need functions to call to return the sqlite3_version
   375         -** and sqlite3_encoding strings.
   376         -*/
   377         -const char *sqlite3_libversion(void);
   378         -const char *sqlite3_libencoding(void);
   379         -
   380    373   /*
   381    374   ** This routine registers a callback with the SQLite library.  The
   382    375   ** callback is invoked (at compile-time, not at run-time) for each
   383    376   ** attempt to access a column of a table in the database.  The callback
   384    377   ** returns SQLITE_OK if access is allowed, SQLITE_DENY if the entire
   385    378   ** SQL statement should be aborted with an error and SQLITE_IGNORE
   386    379   ** if the column should be treated as a NULL value.

Changes to src/sqliteInt.h.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.266 2004/05/31 23:56:43 danielk1977 Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.267 2004/06/02 00:41:09 drh Exp $
    15     15   */
    16     16   #include "config.h"
    17     17   #include "sqlite3.h"
    18     18   #include "hash.h"
    19     19   #include "parse.h"
    20     20   #include <stdio.h>
    21     21   #include <stdlib.h>
................................................................................
   444    444   ** structure.  A pointer to this structure is stored in the sqlite.aFunc
   445    445   ** hash table.  When multiple functions have the same name, the hash table
   446    446   ** points to a linked list of these structures.
   447    447   */
   448    448   struct FuncDef {
   449    449     char *zName;         /* SQL name of the function */
   450    450     int nArg;            /* Number of arguments.  -1 means unlimited */
          451  +  int iPrefEnc;        /* Preferred text encoding */
   451    452     void *pUserData;     /* User data parameter */
   452    453     FuncDef *pNext;      /* Next function with same name */
   453    454     void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */
   454    455     void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */
   455    456     void (*xFinalize)(sqlite3_context*);                /* Aggregate finializer */
   456    457   };
   457    458   

Changes to src/tclsqlite.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** A TCL Interface to SQLite
    13     13   **
    14         -** $Id: tclsqlite.c,v 1.78 2004/05/31 23:56:43 danielk1977 Exp $
           14  +** $Id: tclsqlite.c,v 1.79 2004/06/02 00:41:09 drh Exp $
    15     15   */
    16     16   #ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */
    17     17   
    18     18   #include "sqliteInt.h"
    19     19   #include "tcl.h"
    20     20   #include <stdlib.h>
    21     21   #include <string.h>
................................................................................
   896    896     const char *zArg;
   897    897     char *zErrMsg;
   898    898     const char *zFile;
   899    899     const char *zOpts[2] = {0, 0};
   900    900     char zBuf[80];
   901    901     if( objc==2 ){
   902    902       zArg = Tcl_GetStringFromObj(objv[1], 0);
   903         -    if( strcmp(zArg,"-encoding")==0 ){
   904         -      Tcl_AppendResult(interp,sqlite3_encoding,0);
   905         -      return TCL_OK;
   906         -    }
   907    903       if( strcmp(zArg,"-version")==0 ){
   908    904         Tcl_AppendResult(interp,sqlite3_version,0);
   909    905         return TCL_OK;
   910    906       }
   911    907       if( strcmp(zArg,"-has-codec")==0 ){
   912    908   #ifdef SQLITE_HAS_CODEC
   913    909         Tcl_AppendResult(interp,"1",0);

Changes to src/test5.c.

    11     11   *************************************************************************
    12     12   ** Code for testing the utf.c module in SQLite.  This code
    13     13   ** is not included in the SQLite library.  It is used for automated
    14     14   ** testing of the SQLite library. Specifically, the code in this file
    15     15   ** is used for testing the SQLite routines for converting between
    16     16   ** the various supported unicode encodings.
    17     17   **
    18         -** $Id: test5.c,v 1.6 2004/05/31 18:51:58 drh Exp $
           18  +** $Id: test5.c,v 1.7 2004/06/02 00:41:10 drh Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   #include "os.h"         /* to get SQLITE_BIGENDIAN */
    22     22   #include "tcl.h"
    23     23   #include <stdlib.h>
    24     24   #include <string.h>
    25     25   
................................................................................
    33     33     while( *pC1 || *pC2 ){
    34     34       pC1 += 2;
    35     35       pC2 += 2;
    36     36     }
    37     37     return (pC1-pZ)+2;
    38     38   }
    39     39   
           40  +/*
           41  +** tclcmd:   sqlite_utf8to16le  STRING
           42  +** title:    Convert STRING from utf-8 to utf-16le
           43  +**
           44  +** Return the utf-16le encoded string
           45  +*/
    40     46   static int sqlite_utf8to16le(
    41     47     void * clientData,
    42     48     Tcl_Interp *interp,
    43     49     int objc,
    44     50     Tcl_Obj *CONST objv[]
    45     51   ){
    46     52     unsigned char *out;
................................................................................
    59     65     sqliteFree(out); 
    60     66   
    61     67     Tcl_SetObjResult(interp, res);
    62     68   
    63     69     return TCL_OK;
    64     70   }
    65     71   
           72  +/*
           73  +** tclcmd:   sqlite_utf8to16be  STRING
           74  +** title:    Convert STRING from utf-8 to utf-16be
           75  +**
           76  +** Return the utf-16be encoded string
           77  +*/
    66     78   static int sqlite_utf8to16be(
    67     79     void * clientData,
    68     80     Tcl_Interp *interp,
    69     81     int objc,
    70     82     Tcl_Obj *CONST objv[]
    71     83   ){
    72     84     unsigned char *out;
................................................................................
    86     98     sqliteFree(out);
    87     99   
    88    100     Tcl_SetObjResult(interp, res);
    89    101   
    90    102     return TCL_OK;
    91    103   }
    92    104   
          105  +/*
          106  +** tclcmd:   sqlite_utf16to16le  STRING
          107  +** title:    Convert STRING from utf-16 in native byte order to utf-16le
          108  +**
          109  +** Return the utf-16le encoded string.  If the input string contains
          110  +** a byte-order mark, then the byte order mark should override the
          111  +** native byte order.
          112  +*/
    93    113   static int sqlite_utf16to16le(
    94    114     void * clientData,
    95    115     Tcl_Interp *interp,
    96    116     int objc,
    97    117     Tcl_Obj *CONST objv[]
    98    118   ){
    99    119     unsigned char *out;
................................................................................
   116    136     sqliteFree(out);
   117    137   
   118    138     Tcl_SetObjResult(interp, res);
   119    139   
   120    140     return TCL_OK;
   121    141   }
   122    142   
          143  +/*
          144  +** tclcmd:   sqlite_utf16to16be  STRING
          145  +** title:    Convert STRING from utf-16 in native byte order to utf-16be
          146  +**
          147  +** Return the utf-16be encoded string.  If the input string contains
          148  +** a byte-order mark, then the byte order mark should override the
          149  +** native byte order.
          150  +*/
   123    151   static int sqlite_utf16to16be(
   124    152     void * clientData,
   125    153     Tcl_Interp *interp,
   126    154     int objc,
   127    155     Tcl_Obj *CONST objv[]
   128    156   ){
   129    157     unsigned char *out;
................................................................................
   146    174     sqliteFree(out);
   147    175   
   148    176     Tcl_SetObjResult(interp, res);
   149    177   
   150    178     return TCL_OK;
   151    179   }
   152    180   
          181  +/*
          182  +** tclcmd:   sqlite_utf16to8  STRING
          183  +** title:    Convert STRING from utf-16 in native byte order to utf-8
          184  +**
          185  +** Return the utf-8 encoded string.  If the input string contains
          186  +** a byte-order mark, then the byte order mark should override the
          187  +** native byte order.
          188  +*/
   153    189   static int sqlite_utf16to8(
   154    190     void * clientData,
   155    191     Tcl_Interp *interp,
   156    192     int objc,
   157    193     Tcl_Obj *CONST objv[]
   158    194   ){
   159    195     unsigned char *out;

Changes to src/util.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Utility functions used throughout sqlite.
    13     13   **
    14     14   ** This file contains functions for allocating memory, comparing
    15     15   ** strings, and stuff like that.
    16     16   **
    17         -** $Id: util.c,v 1.95 2004/05/30 20:46:09 drh Exp $
           17  +** $Id: util.c,v 1.96 2004/06/02 00:41:10 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <stdarg.h>
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** If malloc() ever fails, this global variable gets set to 1.
................................................................................
   888    888       a += strlen(&a[1]) + 2;
   889    889       b += strlen(&b[1]) + 2;
   890    890     }
   891    891     if( dir=='-' || dir=='D' ) res = -res;
   892    892     return res;
   893    893   }
   894    894   
   895         -#ifdef SQLITE_UTF8
          895  +#if 1  /* We are now always UTF-8 */
   896    896   /*
   897    897   ** X is a pointer to the first byte of a UTF-8 character.  Increment
   898    898   ** X so that it points to the next character.  This only works right
   899    899   ** if X points to a well-formed UTF-8 string.
   900    900   */
   901    901   #define sqliteNextChar(X)  while( (0xc0&*++(X))==0x80 ){}
   902         -#define sqliteCharVal(X)   sqlite_utf8_to_int(X)
          902  +#define sqliteCharVal(X)   sqlite3ReadUtf8(X)
   903    903   
   904    904   #else /* !defined(SQLITE_UTF8) */
   905    905   /*
   906    906   ** For iso8859 encoding, the next character is just the next byte.
   907    907   */
   908    908   #define sqliteNextChar(X)  (++(X));
   909    909   #define sqliteCharVal(X)   ((int)*(X))
   910    910   
   911    911   #endif /* defined(SQLITE_UTF8) */
   912    912   
   913    913   
   914         -#ifdef SQLITE_UTF8
          914  +#if 1  /* We are now always UTF-8 */
   915    915   /*
   916    916   ** Convert the UTF-8 character to which z points into a 31-bit
   917    917   ** UCS character.  This only works right if z points to a well-formed
   918    918   ** UTF-8 string.
   919    919   */
   920         -static int sqlite_utf8_to_int(const unsigned char *z){
          920  +static int sqlite3ReadUtf8(const unsigned char *z){
   921    921     int c;
   922    922     static const int initVal[] = {
   923    923         0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,
   924    924        15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
   925    925        30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
   926    926        45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
   927    927        60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,

Changes to test/expr.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing expressions.
    13     13   #
    14         -# $Id: expr.test,v 1.32 2004/05/13 11:34:17 danielk1977 Exp $
           14  +# $Id: expr.test,v 1.33 2004/06/02 00:41:10 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Create a table to work with.
    20     20   #
    21     21   execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)}
................................................................................
   239    239   test_expr expr-5.8b {t1='abxyzzycy', t2='A%CX'} {t1 LIKE t2} 0
   240    240   test_expr expr-5.9 {t1='abc', t2='A%_C'} {t1 LIKE t2} 1
   241    241   test_expr expr-5.9b {t1='ac', t2='A%_C'} {t1 LIKE t2} 0
   242    242   test_expr expr-5.10 {t1='abxyzzyc', t2='A%_C'} {t1 LIKE t2} 1
   243    243   test_expr expr-5.11 {t1='abc', t2='xyz'} {t1 NOT LIKE t2} 1
   244    244   test_expr expr-5.12 {t1='abc', t2='ABC'} {t1 NOT LIKE t2} 0
   245    245   
   246         -# The following tests only work on versions of TCL that support
   247         -# Unicode and SQLite configured for UTF-8 support.
          246  +# The following tests only work on versions of TCL that support Unicode
   248    247   #
   249         -if {"\u1234"!="u1234" && [sqlite -encoding]=="UTF-8"} {
          248  +if {"\u1234"!="u1234"} {
   250    249     test_expr expr-5.13 "t1='a\u0080c', t2='A_C'" {t1 LIKE t2} 1
   251    250     test_expr expr-5.14 "t1='a\u07FFc', t2='A_C'" {t1 LIKE t2} 1
   252    251     test_expr expr-5.15 "t1='a\u0800c', t2='A_C'" {t1 LIKE t2} 1
   253    252     test_expr expr-5.16 "t1='a\uFFFFc', t2='A_C'" {t1 LIKE t2} 1
   254    253     test_expr expr-5.17 "t1='a\u0080', t2='A__'" {t1 LIKE t2} 0
   255    254     test_expr expr-5.18 "t1='a\u07FF', t2='A__'" {t1 LIKE t2} 0
   256    255     test_expr expr-5.19 "t1='a\u0800', t2='A__'" {t1 LIKE t2} 0
................................................................................
   257    256     test_expr expr-5.20 "t1='a\uFFFF', t2='A__'" {t1 LIKE t2} 0
   258    257     test_expr expr-5.21 "t1='ax\uABCD', t2='A_\uABCD'" {t1 LIKE t2} 1
   259    258     test_expr expr-5.22 "t1='ax\u1234', t2='A%\u1234'" {t1 LIKE t2} 1
   260    259     test_expr expr-5.23 "t1='ax\uFEDC', t2='A_%'" {t1 LIKE t2} 1
   261    260     test_expr expr-5.24 "t1='ax\uFEDCy\uFEDC', t2='A%\uFEDC'" {t1 LIKE t2} 1
   262    261   }
   263    262   
   264         -# Theses tests are for when SQLite assumes iso8859 characters.
   265         -#
   266         -if {[sqlite -encoding]=="iso8859"} {
   267         -  set go 1
   268         -  if {[info command encoding]!=""} {
   269         -    if {[catch {encoding system iso8859-1} msg]} {
   270         -      puts "skipping tests of LIKE operator: $msg"
   271         -      set go 0
   272         -    }
   273         -  }
   274         -  if {$go} {
   275         -    test_expr expr-5.50 "t1='a\266c', t2='A_C'"  {t1 LIKE t2} 1
   276         -    test_expr expr-5.51 "t1='a\347', t2='A_'"  {t1 LIKE t2} 1
   277         -    test_expr expr-5.52 "t1='ax\351', t2='A_\351'"  {t1 LIKE t2} 1
   278         -    test_expr expr-5.53 "t1='ax\241', t2='A_%'"  {t1 LIKE t2} 1
   279         -  }
   280         -}
   281    263   test_expr expr-5.54 {t1='abc', t2=NULL} {t1 LIKE t2} {{}}
   282    264   test_expr expr-5.55 {t1='abc', t2=NULL} {t1 NOT LIKE t2} {{}}
   283    265   test_expr expr-5.56 {t1='abc', t2=NULL} {t2 LIKE t1} {{}}
   284    266   test_expr expr-5.57 {t1='abc', t2=NULL} {t2 NOT LIKE t1} {{}}
   285    267   
   286    268   
   287    269   test_expr expr-6.1 {t1='abc', t2='xyz'} {t1 GLOB t2} 0
................................................................................
   313    295   test_expr expr-6.23 {t1='abcdefg', t2='a*?g'} {t1 GLOB t2} 1
   314    296   test_expr expr-6.24 {t1='ac', t2='a*c'} {t1 GLOB t2} 1
   315    297   test_expr expr-6.25 {t1='ac', t2='a*?c'} {t1 GLOB t2} 0
   316    298   
   317    299   
   318    300   # These tests only work on versions of TCL that support Unicode
   319    301   #
   320         -if {"\u1234"!="u1234" && [sqlite -encoding]=="UTF-8"} {
          302  +if {"\u1234"!="u1234"} {
   321    303     test_expr expr-6.26 "t1='a\u0080c', t2='a?c'" {t1 GLOB t2} 1
   322    304     test_expr expr-6.27 "t1='a\u07ffc', t2='a?c'" {t1 GLOB t2} 1
   323    305     test_expr expr-6.28 "t1='a\u0800c', t2='a?c'" {t1 GLOB t2} 1
   324    306     test_expr expr-6.29 "t1='a\uffffc', t2='a?c'" {t1 GLOB t2} 1
   325    307     test_expr expr-6.30 "t1='a\u1234', t2='a?'" {t1 GLOB t2} 1
   326    308     test_expr expr-6.31 "t1='a\u1234', t2='a??'" {t1 GLOB t2} 0
   327    309     test_expr expr-6.32 "t1='ax\u1234', t2='a?\u1234'" {t1 GLOB t2} 1
................................................................................
   361    343   test_expr expr-6.70c {t1='A]C', t2='A[^]B]C'} {t1 GLOB t2} 0
   362    344   test_expr expr-6.71 {t1='ABCDEFG', t2='A*[DE]G'} {t1 GLOB t2} 0
   363    345   test_expr expr-6.72 {t1='ABCDEFG', t2='A*[^DE]G'} {t1 GLOB t2} 1
   364    346   test_expr expr-6.73 {t1='ABCDEFG', t2='A*?G'} {t1 GLOB t2} 1
   365    347   test_expr expr-6.74 {t1='AC', t2='A*C'} {t1 GLOB t2} 1
   366    348   test_expr expr-6.75 {t1='AC', t2='A*?C'} {t1 GLOB t2} 0
   367    349   
   368         -# Theses tests are for when SQLite assumes iso8859 characters.
   369         -#
   370         -if {[sqlite -encoding]=="iso8859"} {
   371         -  set go 1
   372         -  if {[info command encoding]!=""} {
   373         -    if {[catch {encoding system iso8859-1} msg]} {
   374         -      puts "skipping tests of GLOB operator: $msg"
   375         -      set go 0
   376         -    }
   377         -  }
   378         -  if {$go} {
   379         -    test_expr expr-6.50 "t1='a\266c', t2='a?c'" {t1 GLOB t2} 1
   380         -    test_expr expr-6.51 "t1='a\266', t2='a?'" {t1 GLOB t2} 1
   381         -    test_expr expr-6.52 "t1='a\266', t2='a??'" {t1 GLOB t2} 0
   382         -    test_expr expr-6.53 "t1='ax\266', t2='a??'" {t1 GLOB t2} 1
   383         -    test_expr expr-6.54 "t1='ax\266', t2='a?\266'" {t1 GLOB t2} 1
   384         -    test_expr expr-6.55 "t1='ax\266y\266', t2='a*\266'" {t1 GLOB t2} 1
   385         -    test_expr expr-6.56 "t1='a\266b', t2='a\[x\266y\]b'" {t1 GLOB t2} 1
   386         -    test_expr expr-6.57 "t1='a\266b', t2='a\[\260-\270\]b'" {t1 GLOB t2} 1
   387         -    test_expr expr-6.58 "t1='a\266b', t2='a\[\266-\270\]b'" {t1 GLOB t2} 1
   388         -    test_expr expr-6.59 "t1='a\266b', t2='a\[\267-\270\]b'" {t1 GLOB t2} 0
   389         -    test_expr expr-6.60 "t1='a\266b', t2='a\[x-\267\]b'" {t1 GLOB t2} 1
   390         -    test_expr expr-6.61 "t1='a\266b', t2='a\[x-\266\]b'" {t1 GLOB t2} 1
   391         -    test_expr expr-6.62 "t1='a\266b', t2='a\[x-\265\]b'" {t1 GLOB t2} 0
   392         -  }
   393         -}
   394    350   test_expr expr-6.63 {t1=NULL, t2='a*?c'} {t1 GLOB t2} {{}}
   395    351   test_expr expr-6.64 {t1='ac', t2=NULL} {t1 GLOB t2} {{}}
   396    352   test_expr expr-6.65 {t1=NULL, t2='a*?c'} {t1 NOT GLOB t2} {{}}
   397    353   test_expr expr-6.66 {t1='ac', t2=NULL} {t1 NOT GLOB t2} {{}}
   398    354   
   399    355   test_expr expr-case.1 {i1=1, i2=2} \
   400    356   	{CASE WHEN i1 = i2 THEN 'eq' ELSE 'ne' END} ne

Changes to test/func.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing built-in functions.
    13     13   #
    14         -# $Id: func.test,v 1.19 2004/05/27 14:23:36 danielk1977 Exp $
           14  +# $Id: func.test,v 1.20 2004/06/02 00:41:10 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Create a table to work with.
    20     20   #
    21     21   do_test func-0.0 {
................................................................................
    90     90   do_test func-2.9 {
    91     91     execsql {SELECT substr(a,1,1) FROM t2}
    92     92   } {1 {} 3 {} 6}
    93     93   do_test func-2.10 {
    94     94     execsql {SELECT substr(a,2,2) FROM t2}
    95     95   } {{} {} 45 {} 78}
    96     96   
    97         -# Only do the following tests if TCL has UTF-8 capabilities and
    98         -# the UTF-8 encoding is turned on in the SQLite library.
           97  +# Only do the following tests if TCL has UTF-8 capabilities
    99     98   #
   100         -if {[sqlite -encoding]=="UTF-8" && "\u1234"!="u1234"} {
           99  +if {"\u1234"!="u1234"} {
   101    100   
   102    101   # Put some UTF-8 characters in the database
   103    102   #
   104    103   do_test func-3.0 {
   105    104     execsql {DELETE FROM tbl1}
   106    105     foreach word "contains UTF-8 characters hi\u1234ho" {
   107    106       execsql "INSERT INTO tbl1 VALUES('$word')"
................................................................................
   142    141     execsql {DELETE FROM tbl1}
   143    142     foreach word {this program is free software} {
   144    143       execsql "INSERT INTO tbl1 VALUES('$word')"
   145    144     }
   146    145     execsql {SELECT t1 FROM tbl1}
   147    146   } {this program is free software}
   148    147   
   149         -} ;# End [sqlite -encoding]==UTF-8 and \u1234!=u1234
          148  +} ;# End \u1234!=u1234
   150    149   
   151    150   # Test the abs() and round() functions.
   152    151   #
   153    152   do_test func-4.1 {
   154    153     execsql {
   155    154       CREATE TABLE t1(a,b,c);
   156    155       INSERT INTO t1 VALUES(1,2,3);

Changes to test/tclsqlite.test.

    11     11   # This file implements regression tests for TCL interface to the
    12     12   # SQLite library. 
    13     13   #
    14     14   # Actually, all tests are based on the TCL interface, so the main
    15     15   # interface is pretty well tested.  This file contains some addition
    16     16   # tests for fringe issues that the main test suite does not cover.
    17     17   #
    18         -# $Id: tclsqlite.test,v 1.20 2004/02/25 22:51:06 rdc Exp $
           18  +# $Id: tclsqlite.test,v 1.21 2004/06/02 00:41:10 drh Exp $
    19     19   
    20     20   set testdir [file dirname $argv0]
    21     21   source $testdir/tester.tcl
    22     22   
    23     23   # Check the error messages generated by tclsqlite
    24     24   #
    25     25   if {[sqlite -has-codec]} {
................................................................................
    67     67         expr x*
    68     68       }
    69     69     } msg]
    70     70     regsub {:.*$} $msg {} msg
    71     71     lappend v $msg
    72     72   } {1 {syntax error in expression "x*"}}
    73     73   
    74         -if {[sqlite -encoding]=="UTF-8" && [sqlite -tcl-uses-utf]} {
           74  +if {[sqlite -tcl-uses-utf]} {
    75     75     do_test tcl-2.1 {
    76     76       execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)"
    77     77       execsql "PRAGMA table_info(t\u0123x)"
    78     78     } "0 a int 0 {} 0 1 b\u1235 float 0 {} 0"
    79     79     do_test tcl-2.2 {
    80     80       execsql "INSERT INTO t\u0123x VALUES(1,2.3)"
    81     81       db eval "SELECT * FROM t\u0123x" result break
    82     82       set result(*)
    83     83     } "a b\u1235"
    84     84   }
    85     85   
    86         -if {[sqlite -encoding]=="iso8859" && [sqlite -tcl-uses-utf]} {
    87         -  do_test tcl-2.1 {
    88         -    execsql "CREATE TABLE t\251x(a int, b\306 float)"
    89         -    execsql "PRAGMA table_info(t\251x)"
    90         -  } "0 a int 0 {} 0 1 b\306 float 0 {} 0"
    91         -  do_test tcl-2.2 {
    92         -    execsql "INSERT INTO t\251x VALUES(1,2.3)"
    93         -    db eval "SELECT * FROM t\251x" result break
    94         -    set result(*)
    95         -  } "a b\306"
    96         -}
    97     86   
    98     87   # Test the onecolumn method
    99     88   #
   100     89   do_test tcl-3.1 {
   101     90     execsql {
   102     91       INSERT INTO t1 SELECT a*2, b*2 FROM t1;
   103     92       INSERT INTO t1 SELECT a*2+1, b*2+1 FROM t1;