SQLite

Check-in [e782096a]
Login

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

Overview
Comment:Handle blobs that are the return values of functions being cast to text in utf16 databases in the same way as blobs read directly from the database. Fix for [771fe617].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e782096aa06fcf410c3a0a6ee26a9e4f44333da39b28b2efe675814a8652911a
User & Date: dan 2020-01-02 16:24:22
Context
2020-01-02
17:46
Have the OP_ReleaseReg opcode also invalidate the registers if P5 is non-zero. (check-in: 937be221 user: drh tags: trunk)
16:24
Handle blobs that are the return values of functions being cast to text in utf16 databases in the same way as blobs read directly from the database. Fix for [771fe617]. (check-in: e782096a user: dan tags: trunk)
15:02
Fix the OP_Move opcode so that it correctly manages dependency tracking. This change impacts debugging builds only. (check-in: 5377add4 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/fts5/test/fts5integrity.test.

250
251
252
253
254
255
256



























257
258
do_execsql_test 8.2 {
  INSERT INTO vt0(vt0) VALUES('integrity-check');
  PRAGMA data_version;
} {1}
do_execsql_test 8.1 {
  INSERT INTO vt0(vt0, rank) VALUES('usermerge', 2);
}




























finish_test







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


250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
do_execsql_test 8.2 {
  INSERT INTO vt0(vt0) VALUES('integrity-check');
  PRAGMA data_version;
} {1}
do_execsql_test 8.1 {
  INSERT INTO vt0(vt0, rank) VALUES('usermerge', 2);
}

#-------------------------------------------------------------------------
# Ticket [771fe617]
#
reset_db
do_execsql_test 9.0 {
  PRAGMA encoding = 'UTF16';
  CREATE VIRTUAL TABLE vt0 USING fts5(c0);
}

#explain_i { SELECT quote(SUBSTR(x'37', 0)); }
#execsql { PRAGMA vdbe_trace = 1 }
do_execsql_test 9.1.1 {
  SELECT quote(SUBSTR(x'37', 0));
} {X'37'}
do_execsql_test 9.1.2 {
  SELECT quote(x'37');
} {X'37'}

breakpoint
do_execsql_test 9.2 {
  INSERT INTO vt0 VALUES (SUBSTR(x'37', 0));
--  INSERT INTO vt0 VALUES (x'37');
}
do_execsql_test 9.3 {
  INSERT INTO vt0(vt0) VALUES('integrity-check');
}

finish_test

Changes to src/vdbemem.c.

1125
1126
1127
1128
1129
1130
1131

1132




1133


1134
1135
1136
1137
1138
1139
1140
1141
1142
      pMem->xDel = xDel;
      flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
    }
  }

  pMem->n = nByte;
  pMem->flags = flags;

  pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);







#ifndef SQLITE_OMIT_UTF16
  if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
    return SQLITE_NOMEM_BKPT;
  }
#endif

  if( nByte>iLimit ){
    return SQLITE_TOOBIG;
  }







>
|
>
>
>
>
|
>
>

|







1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
      pMem->xDel = xDel;
      flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
    }
  }

  pMem->n = nByte;
  pMem->flags = flags;
  if( enc ){
    pMem->enc = enc;
  }else if( pMem->db ){
    pMem->enc = ENC(pMem->db);
  }else{
    pMem->enc = SQLITE_UTF8;
  }


#ifndef SQLITE_OMIT_UTF16
  if( enc>SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
    return SQLITE_NOMEM_BKPT;
  }
#endif

  if( nByte>iLimit ){
    return SQLITE_TOOBIG;
  }

Changes to test/cast.test.

457
458
459
460
461
462
463












464
465
466
do_execsql_test cast-7.42 {
  SELECT CAST('+0.0' AS numeric);
} 0
do_execsql_test cast-7.43 {
  SELECT CAST('-1.0' AS numeric);
} -1















finish_test







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



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
do_execsql_test cast-7.42 {
  SELECT CAST('+0.0' AS numeric);
} 0
do_execsql_test cast-7.43 {
  SELECT CAST('-1.0' AS numeric);
} -1

ifcapable utf16 {
  reset_db
  execsql { PRAGMA encoding='utf16' }

  do_execsql_test cast-8.1 {
    SELECT quote(X'310032003300')==quote(substr(X'310032003300', 1))
  } 1
  do_execsql_test cast-8.2 {
    SELECT CAST(X'310032003300' AS TEXT)
         ==CAST(substr(X'310032003300', 1) AS TEXT)
  } 1
}


finish_test