Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When converting literal BLOBs to text using the encoding of the main database. Ticket #2349. (CVS 3975) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a57afaff424448ffed8f2344e5eb461f |
User & Date: | drh 2007-05-10 21:14:03.000 |
Context
2007-05-11
| ||
00:20 | Make sure that the REGISTER token generates a valid Expr. REGISTER will cause the tokenizer to abort, but the parser might do several reduce actions prior to that abort and those reduce actions sometimes need a valid Expr. (CVS 3980) (check-in: d146f01a02 user: drh tags: trunk) | |
2007-05-10
| ||
21:14 | When converting literal BLOBs to text using the encoding of the main database. Ticket #2349. (CVS 3975) (check-in: a57afaff42 user: drh tags: trunk) | |
17:38 | Simplify failing case in fuzz.test. (CVS 3974) (check-in: a54c74990c user: danielk1977 tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** 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.615 2007/05/10 21:14:03 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include <math.h> #include "vdbeInt.h" |
︙ | ︙ | |||
330 331 332 333 334 335 336 | } for(i=0; i<16 && i<pMem->n; i++){ char z = pMem->z[i]; if( z<32 || z>126 ) *zCsr++ = '.'; else *zCsr++ = z; } | | | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | } for(i=0; i<16 && i<pMem->n; i++){ char z = pMem->z[i]; if( z<32 || z>126 ) *zCsr++ = '.'; else *zCsr++ = z; } sqlite3_snprintf(100, zCsr, "]%s", encnames[pMem->enc]); zCsr += strlen(zCsr); if( f & MEM_Zero ){ sqlite3_snprintf(100, zCsr,"+%lldz",pMem->u.i); zCsr += strlen(zCsr); } *zCsr = '\0'; }else if( f & MEM_Str ){ |
︙ | ︙ | |||
831 832 833 834 835 836 837 838 839 840 841 842 843 844 | ** the blob as P3. This opcode is transformed to an OP_Blob ** the first time it is executed. */ case OP_Blob: { pTos++; assert( pOp->p1 < SQLITE_MAX_LENGTH ); /* Due to SQLITE_MAX_SQL_LENGTH */ sqlite3VdbeMemSetStr(pTos, pOp->p3, pOp->p1, 0, 0); break; } #endif /* SQLITE_OMIT_BLOB_LITERAL */ /* Opcode: Variable P1 * * ** ** Push the value of variable P1 onto the stack. A variable is | > | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | ** the blob as P3. This opcode is transformed to an OP_Blob ** the first time it is executed. */ 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 */ /* Opcode: Variable P1 * * ** ** Push the value of variable P1 onto the stack. A variable is |
︙ | ︙ | |||
914 915 916 917 918 919 920 | int i; Mem ts; ts = *pFrom; Deephemeralize(pTos); for(i=0; i<pOp->p1; i++, pFrom++){ Deephemeralize(&pFrom[1]); | | | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | int i; Mem ts; ts = *pFrom; Deephemeralize(pTos); for(i=0; i<pOp->p1; i++, pFrom++){ Deephemeralize(&pFrom[1]); assert( (pFrom->flags & MEM_Ephem)==0 ); *pFrom = pFrom[1]; if( pFrom->flags & MEM_Short ){ assert( pFrom->flags & (MEM_Str|MEM_Blob) ); assert( pFrom->z==pFrom[1].zShort ); pFrom->z = pFrom->zShort; } } |
︙ | ︙ | |||
2271 2272 2273 2274 2275 2276 2277 | int len; if( zAffinity ){ applyAffinity(pRec, zAffinity[pRec-pData0], encoding); } if( pRec->flags&MEM_Null ){ containsNull = 1; } | < < < > | 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 | int len; if( zAffinity ){ applyAffinity(pRec, zAffinity[pRec-pData0], encoding); } if( pRec->flags&MEM_Null ){ containsNull = 1; } serial_type = sqlite3VdbeSerialType(pRec, file_format); len = sqlite3VdbeSerialTypeLen(serial_type); nData += len; nHdr += sqlite3VarintLen(serial_type); 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; } } /* If we have to append a varint rowid to this record, set pRowid |
︙ | ︙ |
Changes to test/enc3.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # The focus of this file is testing of the proper handling of conversions # to the native text representation. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # The focus of this file is testing of the proper handling of conversions # to the native text representation. # # $Id: enc3.test,v 1.6 2007/05/10 21:14:03 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {utf16} { do_test enc3-1.1 { execsql { |
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 | 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 | > > > > > > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 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} 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} } finish_test |