Automatically cast BLOBs to strings prior to handing them over to

functions like LIKE that want strings.  Ticket #1605. (CVS 2928)

FossilOrigin-Name: 730ddb0b74ed23c916dabd7ce893bd6bc55f3549
This commit is contained in:
drh 2006-01-12 19:42:41 +00:00
parent 8079a0d3f5
commit f1f6c587eb
4 changed files with 25 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Cache\sthe\sencoding\svalue\sinside\sVdbeExec.\s(CVS\s2927)
D 2006-01-12T17:20:51
C Automatically\scast\sBLOBs\sto\sstrings\sprior\sto\shanding\sthem\sover\sto\nfunctions\slike\sLIKE\sthat\swant\sstrings.\s\sTicket\s#1605.\s(CVS\s2928)
D 2006-01-12T19:42:41
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -93,7 +93,7 @@ F src/vdbeInt.h 5451cf71f229e366ac543607c0a17f36e5737ea9
F src/vdbeapi.c afd3837cea0dec93dcb4724d073c84fa0da68e23
F src/vdbeaux.c b3ac00584f18df9b4ca703ed30f3a378d7a975f7
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 66e05857c3bd52436161d6bf96a95725f03225a5
F src/vdbemem.c dd08a0eea4868ac4a2d91fdec32424308b1db772
F src/where.c a8ba7f4aa2f38166e9f89ecc5dafbdbf41942031
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/all.test a23fcbbf1f53515bde840d78732a6d94c673b327
@ -156,7 +156,7 @@ F test/diskfull.test d828d72adfc9e2d1a194d25996718c1989152cf9
F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b
F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52
F test/enc2.test 0c8d3142c032c4f907b546d99e00b787f9700bb7
F test/enc3.test f6a5f0b7b7f3a88f030d3143729b87cd5c86d837
F test/enc3.test 890508efff6677345e93bf2a8adb0489b30df030
F test/expr.test a513aceb5d89042232e0d07ac5a1591965cf3963
F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce
F test/format4.test 9f31d41d4f926cab97b2ebe6be00a6ab12dece87
@ -340,7 +340,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 52b3be96b6e96994ec6fbcc67bf355cd05f61730
R 8bdfbd15a8d8938ee4f80c68a38b1586
P 6d2a816ede8d17b993a21e418cf25edd103334de
R 971a03416cb2a532e33c04d063ff3d43
U drh
Z 3f3ad41a9cf994a2b1925bbc43878693
Z f5d21c5f0dab7a424c492c72d03de3db

View File

@ -1 +1 @@
6d2a816ede8d17b993a21e418cf25edd103334de
730ddb0b74ed23c916dabd7ce893bd6bc55f3549

View File

@ -751,6 +751,8 @@ const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){
if( pVal->flags&MEM_Null ){
return 0;
}
assert( (MEM_Blob>>3) == MEM_Str );
pVal->flags |= (pVal->flags & MEM_Blob)>>3;
if( pVal->flags&MEM_Str ){
sqlite3VdbeChangeEncoding(pVal, enc);
}else if( !(pVal->flags&MEM_Blob) ){

View File

@ -13,7 +13,7 @@
# The focus of this file is testing of the proper handling of conversions
# to the native text representation.
#
# $Id: enc3.test,v 1.4 2004/11/14 21:56:31 drh Exp $
# $Id: enc3.test,v 1.5 2006/01/12 19:42:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -52,6 +52,20 @@ ifcapable {bloblit} {
}
} {{X'616263646566' NULL}}
}
ifcapable {bloblit && utf16} {
do_test enc3-2.1 {
execsql {
PRAGMA encoding
}
} {UTF-16le}
do_test enc3-2.2 {
execsql {
CREATE TABLE t2(a);
INSERT INTO t2 VALUES(x'61006200630064006500');
SELECT CAST(a AS text) FROM t2 WHERE a LIKE 'abc%';
}
} {abcde}
}
finish_test