]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
When converting literal BLOBs to text using the encoding of the main
authordrh <drh@noemail.net>
Thu, 10 May 2007 21:14:03 +0000 (21:14 +0000)
committerdrh <drh@noemail.net>
Thu, 10 May 2007 21:14:03 +0000 (21:14 +0000)
database.  Ticket #2349. (CVS 3975)

FossilOrigin-Name: a57afaff424448ffed8f2344e5eb461f503bfb6e

manifest
manifest.uuid
src/vdbe.c
test/enc3.test

index 281d7d88aeccb82dc4b7a8df1b27f6207ee8a53d..ae9ced0e3a903496f98e42f4d9d6a4b494b9b5e3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplify\sfailing\scase\sin\sfuzz.test.\s(CVS\s3974)
-D 2007-05-10T17:38:57
+C When\sconverting\sliteral\sBLOBs\sto\stext\susing\sthe\sencoding\sof\sthe\smain\ndatabase.\s\sTicket\s#2349.\s(CVS\s3975)
+D 2007-05-10T21:14:03
 F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -132,7 +132,7 @@ F src/update.c 3359041db390a8f856d67272f299600e2104f350
 F src/utf.c be7c64eed83fa3c01e0c42905e1c311dcd1be704
 F src/util.c 4f6bbcec2b2b1884d652b82c9f8949ede4618d68
 F src/vacuum.c 8bd895d29e7074e78d4e80f948e35ddc9cf2beef
-F src/vdbe.c c0b1cd6c7dc40f836184af1cf041cfcadd61c9a5
+F src/vdbe.c 308c698ad96a43249e12cb5067a4a823a6dea307
 F src/vdbe.h 001c5b257567c1d3de7feb2203aac71d0d7b16a3
 F src/vdbeInt.h bddb7931fc1216fda6f6720e18d2a9b1e0f8fc96
 F src/vdbeapi.c 3ca7808c67a10b5c20150108b431d520d141e93e
@@ -214,7 +214,7 @@ F test/diskfull.test a91fa95a8729b71fdac4738a49755f70b48c61f3
 F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b
 F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52
 F test/enc2.test 45710bacfa9df29720bc84c067dfdf8c8ddfb797
-F test/enc3.test 890508efff6677345e93bf2a8adb0489b30df030
+F test/enc3.test 9331988b9d72decec96995c90637e87b00d747a5
 F test/exclusive.test 5bc520ba366ae3d242420af025ab64d465b04706
 F test/exclusive2.test f9738964b01e0bc4d4e5e270e347ca162da51799
 F test/exclusive3.test 0e49c35b7e7cb8e7280b4ce3f0359d30b207d2ff
@@ -487,7 +487,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 1e8fcb3fbed7beb8bb1370953ecf3d4b9db01ede
-R 3407008af1a21abc526283fbb54db2fc
-U danielk1977
-Z fd4f103656f235fc374f0f6ff3013b5f
+P a54c74990caf22c0008a7029e24594e83048ffbc
+R c84e4f74a574fa506734b720c23aad6b
+U drh
+Z b06d89c3202832d761b85c19e8382942
index db28a05a378e742bad1bad7eb9027c9aa217d902..af4e6699d3bbaabdb70f902af56157678f1e65cc 100644 (file)
@@ -1 +1 @@
-a54c74990caf22c0008a7029e24594e83048ffbc
\ No newline at end of file
+a57afaff424448ffed8f2344e5eb461f503bfb6e
\ No newline at end of file
index 07eea5f15f01b7e19b6558e3b56078320c6a102e..243f8974e15ae7cf64900fd6908df04f709f2658 100644 (file)
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** commenting and indentation practices when changing or adding code.
 **
-** $Id: vdbe.c,v 1.614 2007/05/10 17:32:48 danielk1977 Exp $
+** $Id: vdbe.c,v 1.615 2007/05/10 21:14:03 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -334,7 +334,7 @@ void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
       else *zCsr++ = z;
     }
 
-    sqlite3_snprintf(100, zCsr, "]");
+    sqlite3_snprintf(100, zCsr, "]%s", encnames[pMem->enc]);
     zCsr += strlen(zCsr);
     if( f & MEM_Zero ){
       sqlite3_snprintf(100, zCsr,"+%lldz",pMem->u.i);
@@ -835,6 +835,7 @@ case OP_Blob: {
   pTos++;
   assert( pOp->p1 < SQLITE_MAX_LENGTH ); /* Due to SQLITE_MAX_SQL_LENGTH */
   sqlite3VdbeMemSetStr(pTos, pOp->p3, pOp->p1, 0, 0);
+  pTos->enc = encoding;
   break;
 }
 #endif /* SQLITE_OMIT_BLOB_LITERAL */
@@ -918,7 +919,7 @@ case OP_Pull: {            /* no-push */
   Deephemeralize(pTos);
   for(i=0; i<pOp->p1; i++, pFrom++){
     Deephemeralize(&pFrom[1]);
-    assert( (pFrom[1].flags & MEM_Ephem)==0 );
+    assert( (pFrom->flags & MEM_Ephem)==0 );
     *pFrom = pFrom[1];
     if( pFrom->flags & MEM_Short ){
       assert( pFrom->flags & (MEM_Str|MEM_Blob) );
@@ -2275,9 +2276,6 @@ case OP_MakeRecord: {
     if( pRec->flags&MEM_Null ){
       containsNull = 1;
     }
-    if( pRec->flags&MEM_Zero && pRec->n>0 ){
-      sqlite3VdbeMemExpandBlob(pRec);
-    }
     serial_type = sqlite3VdbeSerialType(pRec, file_format);
     len = sqlite3VdbeSerialTypeLen(serial_type);
     nData += len;
@@ -2285,6 +2283,7 @@ case OP_MakeRecord: {
     if( pRec->flags & MEM_Zero ){
       /* Only pure zero-filled BLOBs can be input to this Opcode.
       ** We do not allow blobs with a prefix and a zero-filled tail. */
+      assert( pRec->n==0 );
       nZero += pRec->u.i;
     }else if( len ){
       nZero = 0;
index 1df2fb85d9708a55410d9b2d8a4f2c1f725423d8..64f580786c742dd6f4e2135ea9f546e3c6b7b561 100644 (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.5 2006/01/12 19:42:41 drh Exp $
+# $Id: enc3.test,v 1.6 2007/05/10 21:14:03 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -65,6 +65,16 @@ ifcapable {bloblit && utf16} {
       SELECT CAST(a AS text) FROM t2 WHERE a LIKE 'abc%';
     }
   } {abcde}
+  do_test enc3-2.3 {
+    execsql {
+      SELECT CAST(x'61006200630064006500' AS text);
+    }
+  } {abcde}
+  do_test enc3-2.4 {
+    execsql {
+      SELECT rowid FROM t2 WHERE a LIKE x'610062002500';
+    }
+  } {1}
 }