Remove the alternative UTF-16 implementation of SUBSTR(). It does not

work anymore and the UTF-8 version can do everything that the UTF-16
version does. (CVS 4009)

FossilOrigin-Name: 9b91502ef0ea9c0bfb8362c4b70314dc8449eb9e
This commit is contained in:
drh 2007-05-15 14:40:11 +00:00
parent 9a087a99e5
commit f076504b1c
4 changed files with 10 additions and 61 deletions

View File

@ -1,5 +1,5 @@
C Relax\sthe\srestriction\son\susing\sbytes\s0x80\sthrough\s0xbf\sas\sthe\sfirst\ncharacter\sof\san\sidentifier.\s\sEnhancements\sto\sALTER\sTABLE\stests\sfor\ntables\swith\sstrange\snames\sor\sstange\scolumn\snames.\s(CVS\s4008)
D 2007-05-15T14:34:32
C Remove\sthe\salternative\sUTF-16\simplementation\sof\sSUBSTR().\s\sIt\sdoes\snot\nwork\sanymore\sand\sthe\sUTF-8\sversion\scan\sdo\severything\sthat\sthe\sUTF-16\nversion\sdoes.\s(CVS\s4009)
D 2007-05-15T14:40:11
F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -71,7 +71,7 @@ F src/date.c 6049db7d5a8fdf2c677ff7d58fa31d4f6593c988
F src/delete.c 5c0d89b3ef7d48fe1f5124bfe8341f982747fe29
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
F src/expr.c 436f1d3e5addf95c195016b518cd2f44a6f5f081
F src/func.c 047c974d530ceca010293f4ae145e4ebc762e9d2
F src/func.c dfd0dd496dac46c2b14a88292cd9e141aae3ba63
F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
F src/insert.c e595ca26805dfb3a9ebaabc28e7947c479f3b14d
@ -129,7 +129,7 @@ F src/test_tclvar.c 315e77c17f128ff8c06b38c08617fd07c825a95b
F src/tokenize.c 6cef9e6fc454d789a32c5b509ccb193a2b01977b
F src/trigger.c 420192efe3e6f03addf7897c60c3c8bf913d3493
F src/update.c 3359041db390a8f856d67272f299600e2104f350
F src/utf.c 3fe21361e83cfcf5c18764d8d5c59fffdf9144db
F src/utf.c b881fe54498f6a35de424a62f8e071b621111728
F src/util.c 4f6bbcec2b2b1884d652b82c9f8949ede4618d68
F src/vacuum.c 8bd895d29e7074e78d4e80f948e35ddc9cf2beef
F src/vdbe.c 5deb4cdccd57065ccf8a2e5c704e8473c90d204b
@ -491,7 +491,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 960be575e2b062a34c96d006e411ad34ded58063
R f0d56e6c9e184f0b4efe24d6555a4f23
P 262a3e6339b31f269f8f07e43d295b90827e2779
R 861e479ebd5242df0f56a6c2828d2bb6
U drh
Z 85b2f0c86d0a527b2d32d29007854e33
Z d93c42daa9b80cea36e628dd56d378c8

View File

@ -1 +1 @@
262a3e6339b31f269f8f07e43d295b90827e2779
9b91502ef0ea9c0bfb8362c4b70314dc8449eb9e

View File

@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: func.c,v 1.158 2007/05/15 13:27:07 drh Exp $
** $Id: func.c,v 1.159 2007/05/15 14:40:11 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -1310,9 +1310,6 @@ void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
{ "typeof", 1, 0, SQLITE_UTF8, 0, typeofFunc },
{ "length", 1, 0, SQLITE_UTF8, 0, lengthFunc },
{ "substr", 3, 0, SQLITE_UTF8, 0, substrFunc },
#ifndef SQLITE_OMIT_UTF16
{ "substr", 3, 0, SQLITE_UTF16LE, 0, sqlite3Utf16Substr },
#endif
{ "abs", 1, 0, SQLITE_UTF8, 0, absFunc },
{ "round", 1, 0, SQLITE_UTF8, 0, roundFunc },
{ "round", 2, 0, SQLITE_UTF8, 0, roundFunc },

View File

@ -12,7 +12,7 @@
** This file contains routines used to translate between UTF-8,
** UTF-16, UTF-16BE, and UTF-16LE.
**
** $Id: utf.c,v 1.47 2007/05/15 11:55:09 drh Exp $
** $Id: utf.c,v 1.48 2007/05/15 14:40:11 drh Exp $
**
** Notes on UTF-8:
**
@ -434,54 +434,6 @@ int sqlite3Utf16ByteLen(const void *zIn, int nChar){
return (z-(char const *)zIn)-((c==0)?2:0);
}
/*
** UTF-16 implementation of the substr()
*/
void sqlite3Utf16Substr(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
int y, z;
unsigned char const *zStr;
unsigned char const *zStrEnd;
unsigned char const *zStart;
unsigned char const *zEnd;
int i;
zStr = (unsigned char const *)sqlite3_value_text16(argv[0]);
zStrEnd = &zStr[sqlite3_value_bytes16(argv[0])];
y = sqlite3_value_int(argv[1]);
z = sqlite3_value_int(argv[2]);
if( y>0 ){
y = y-1;
zStart = zStr;
if( SQLITE_UTF16BE==SQLITE_UTF16NATIVE ){
for(i=0; i<y && zStart<zStrEnd; i++) SKIP_UTF16BE(zStart);
}else{
for(i=0; i<y && zStart<zStrEnd; i++) SKIP_UTF16LE(zStart);
}
}else{
zStart = zStrEnd;
if( SQLITE_UTF16BE==SQLITE_UTF16NATIVE ){
for(i=y; i<0 && zStart>zStr; i++) RSKIP_UTF16BE(zStart);
}else{
for(i=y; i<0 && zStart>zStr; i++) RSKIP_UTF16LE(zStart);
}
for(; i<0; i++) z -= 1;
}
zEnd = zStart;
if( SQLITE_UTF16BE==SQLITE_UTF16NATIVE ){
for(i=0; i<z && zEnd<zStrEnd; i++) SKIP_UTF16BE(zEnd);
}else{
for(i=0; i<z && zEnd<zStrEnd; i++) SKIP_UTF16LE(zEnd);
}
sqlite3_result_text16(context, zStart, zEnd-zStart, SQLITE_TRANSIENT);
}
#if defined(SQLITE_TEST)
/*
** Translate UTF-8 to UTF-8.