SQLite

Check-in [d65f63531c]
Login

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

Overview
Comment:Fix the virtual table rename logic so that it works even if the database encoding is something other than UTF8. Ticket [8290242b2a9a81683]
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d65f63531c3f8e3e55e656f049240714a3d7433f
User & Date: drh 2011-10-18 22:07:47.722
Context
2011-10-19
16:20
Merge the fts4-content branch with the trunk. (check-in: 8a4077057d user: dan tags: trunk)
2011-10-18
22:07
Fix the virtual table rename logic so that it works even if the database encoding is something other than UTF8. Ticket [8290242b2a9a81683] (check-in: d65f63531c user: drh tags: trunk)
19:14
Fix an uninitialized variable in OR-clause processing. (check-in: 54aecd9298 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbe.c.
5884
5885
5886
5887
5888
5889
5890





5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901

  pVtab = pOp->p4.pVtab->pVtab;
  pName = &aMem[pOp->p1];
  assert( pVtab->pModule->xRename );
  assert( memIsValid(pName) );
  REGISTER_TRACE(pOp->p1, pName);
  assert( pName->flags & MEM_Str );





  rc = pVtab->pModule->xRename(pVtab, pName->z);
  importVtabErrMsg(p, pVtab);
  p->expired = 0;

  break;
}
#endif

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VUpdate P1 P2 P3 P4 *
**







>
>
>
>
>
|
|
|
|







5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906

  pVtab = pOp->p4.pVtab->pVtab;
  pName = &aMem[pOp->p1];
  assert( pVtab->pModule->xRename );
  assert( memIsValid(pName) );
  REGISTER_TRACE(pOp->p1, pName);
  assert( pName->flags & MEM_Str );
  testcase( pName->enc==SQLITE_UTF8 );
  testcase( pName->enc==SQLITE_UTF16BE );
  testcase( pName->enc==SQLITE_UTF16LE );
  rc = sqlite3VdbeChangeEncoding(pName, SQLITE_UTF8);
  if( rc==SQLITE_OK ){
    rc = pVtab->pModule->xRename(pVtab, pName->z);
    importVtabErrMsg(p, pVtab);
    p->expired = 0;
  }
  break;
}
#endif

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VUpdate P1 P2 P3 P4 *
**
Changes to test/fts3d.test.
300
301
302
303
304
305
306





















































307
  execsql {
    UPDATE t1_segdir SET level = 2 WHERE level = 1 AND idx = 0;
    SELECT OPTIMIZE(t1) FROM t1 LIMIT 1;
    SELECT level, idx FROM t1_segdir ORDER BY level, idx;
  }
} {{Index already optimal} 2 0}






















































finish_test







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

300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
  execsql {
    UPDATE t1_segdir SET level = 2 WHERE level = 1 AND idx = 0;
    SELECT OPTIMIZE(t1) FROM t1 LIMIT 1;
    SELECT level, idx FROM t1_segdir ORDER BY level, idx;
  }
} {{Index already optimal} 2 0}


# ALTER TABLE RENAME should work regardless of the database encoding.
#
do_test fts3d-6.0 {
  db close
  forcedelete test.db
  sqlite3 db test.db
  db eval {
    PRAGMA encoding=UTF8;
    CREATE VIRTUAL TABLE fts USING fts3(a,b,c);
    SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1;
  }
} {fts_content fts_segdir fts_segments}
do_test fts3d-6.1 {
  db eval {
    ALTER TABLE fts RENAME TO xyz;
    SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1;
  }
} {xyz_content xyz_segdir xyz_segments}
do_test fts3d-6.2 {
  db close
  forcedelete test.db
  sqlite3 db test.db
  db eval {
    PRAGMA encoding=UTF16le;
    CREATE VIRTUAL TABLE fts USING fts3(a,b,c);
    SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1;
  }
} {fts_content fts_segdir fts_segments}
do_test fts3d-6.3 {
  db eval {
    ALTER TABLE fts RENAME TO xyz;
    SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1;
  }
} {xyz_content xyz_segdir xyz_segments}
do_test fts3d-6.4 {
  db close
  forcedelete test.db
  sqlite3 db test.db
  db eval {
    PRAGMA encoding=UTF16be;
    CREATE VIRTUAL TABLE fts USING fts3(a,b,c);
    SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1;
  }
} {fts_content fts_segdir fts_segments}
do_test fts3d-6.5 {
  db eval {
    ALTER TABLE fts RENAME TO xyz;
    SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1;
  }
} {xyz_content xyz_segdir xyz_segments}
 

finish_test