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

Overview
Comment:Fix a problem with reading utf-8 encoded text values from the database when the first byte of the text is 0x02.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2711bdb5fd147e8a20a049689396d50a599a8292
User & Date: dan 2013-07-04 17:17:34.152
Context
2013-07-04
18:44
Copy the new version of script "like.test" from sqlite3 to this project. Then tweak it to work. check-in: 1468464069 user: dan tags: trunk
17:17
Fix a problem with reading utf-8 encoded text values from the database when the first byte of the text is 0x02. check-in: 2711bdb5fd user: dan tags: trunk
2013-06-29
20:12
Also run legacy scripts index.test and laststmtchanges.test. check-in: de90289df1 user: dan tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbecodec.c.
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
      n = sqlite4PutVarint64(aAux[i].z, (sqlite4_uint64)e);
      n += sqlite4PutVarint64(aAux[i].z+n, p->m);
      aAux[i].n = n;
      aOut[nOut++] = n+9;
      nPayload += n;
    }else if( flags & MEM_Str ){
      n = aIn[i].n;
      if( n && (encoding!=SQLITE4_UTF8 || aIn[i].z[0]<2) ) n++;
      nPayload += n;
      nOut += sqlite4PutVarint64(aOut+nOut, 22+3*(sqlite4_int64)n);
    }else{
      n = aIn[i].n;
      assert( flags & MEM_Blob );
      nPayload += n;
      nOut += sqlite4PutVarint64(aOut+nOut, 23+3*(sqlite4_int64)n);







|







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
      n = sqlite4PutVarint64(aAux[i].z, (sqlite4_uint64)e);
      n += sqlite4PutVarint64(aAux[i].z+n, p->m);
      aAux[i].n = n;
      aOut[nOut++] = n+9;
      nPayload += n;
    }else if( flags & MEM_Str ){
      n = aIn[i].n;
      if( n && (encoding!=SQLITE4_UTF8 || aIn[i].z[0]<3) ) n++;
      nPayload += n;
      nOut += sqlite4PutVarint64(aOut+nOut, 22+3*(sqlite4_int64)n);
    }else{
      n = aIn[i].n;
      assert( flags & MEM_Blob );
      nPayload += n;
      nOut += sqlite4PutVarint64(aOut+nOut, 23+3*(sqlite4_int64)n);
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
      memcpy(aOut+nOut, aAux[i].z, aAux[i].n);
      nOut += aAux[i].n;
    }else if( flags & MEM_Str ){
      n = aIn[i].n;
      if( n ){
        if( encoding==SQLITE4_UTF16LE ) aOut[nOut++] = 1;
        else if( encoding==SQLITE4_UTF16BE ) aOut[nOut++] = 2;
        else if( aIn[i].z[0]<2 ) aOut[nOut++] = 0;
        memcpy(aOut+nOut, aIn[i].z, n);
        nOut += n;
      }
    }else{
      assert( flags & MEM_Blob );
      memcpy(aOut+nOut, aIn[i].z, aIn[i].n);
      nOut += aIn[i].n;







|







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
      memcpy(aOut+nOut, aAux[i].z, aAux[i].n);
      nOut += aAux[i].n;
    }else if( flags & MEM_Str ){
      n = aIn[i].n;
      if( n ){
        if( encoding==SQLITE4_UTF16LE ) aOut[nOut++] = 1;
        else if( encoding==SQLITE4_UTF16BE ) aOut[nOut++] = 2;
        else if( aIn[i].z[0]<3 ) aOut[nOut++] = 0;
        memcpy(aOut+nOut, aIn[i].z, n);
        nOut += n;
      }
    }else{
      assert( flags & MEM_Blob );
      memcpy(aOut+nOut, aIn[i].z, aIn[i].n);
      nOut += aIn[i].n;
Changes to test/permutations.test.
186
187
188
189
190
191
192

193
194
195
196
197
198
199
  in.test in2.test in3.test in4.test
  index.test index2.test index3.test index4.test 
  insert.test insert2.test insert3.test insert5.test
  join.test join2.test join3.test join4.test join5.test join6.test
  keyword1.test
  laststmtchanges.test
  limit.test

  main.test
  manydb.test
  misc5.test misc6.test
  misuse.test
  notnull.test
  null.test
  num.test num2.test







>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
  in.test in2.test in3.test in4.test
  index.test index2.test index3.test index4.test 
  insert.test insert2.test insert3.test insert5.test
  join.test join2.test join3.test join4.test join5.test join6.test
  keyword1.test
  laststmtchanges.test
  limit.test
  like2.test
  main.test
  manydb.test
  misc5.test misc6.test
  misuse.test
  notnull.test
  null.test
  num.test num2.test
Changes to test/simple.test.
1599
1600
1601
1602
1603
1604
1605












1606
1607
1608
1609
} {0.0}

#-------------------------------------------------------------------------
reset_db
do_execsql_test 84.1 {
  SELECT 1e600 * 1e600 * 0.0;
} {{}}














finish_test








>
>
>
>
>
>
>
>
>
>
>
>




1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
} {0.0}

#-------------------------------------------------------------------------
reset_db
do_execsql_test 84.1 {
  SELECT 1e600 * 1e600 * 0.0;
} {{}}

#-------------------------------------------------------------------------
reset_db
do_execsql_test 85.1 {
  CREATE TABLE t1(x INT, y COLLATE NOCASE);
  INSERT INTO t1(x,y) VALUES(2,CAST(x'02' AS TEXT));
  CREATE TABLE t3(x INT, y COLLATE NOCASE);
  INSERT INTO t3 SELECT x, 'abc' || y || 'xyz' FROM t1;
  CREATE INDEX i3 ON t3(y);
  SELECT x FROM t3 WHERE y LIKE 'abcX%';
} {}



finish_test