SQLite

Check-in [38d23888cf]
Login

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

Overview
Comment:In zonefile, change the "file TEXT" column back to "fileid INTEGER". The fileid can be used as a key with the associated zonefile_files table, which contains more information than just the filename.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | zonefile
Files: files | file ages | folders
SHA3-256: 38d23888cf5a7117c51bd9211bd93ec52a30360f7eb2bc83a13910c5d85fe739
User & Date: dan 2018-02-21 10:43:19.310
Context
2018-02-21
16:36
Have zonefile store encryption keys in a hash-table instead of a linked list. Add extra tests for key management. (check-in: 3a63ea6525 user: dan tags: zonefile)
10:43
In zonefile, change the "file TEXT" column back to "fileid INTEGER". The fileid can be used as a key with the associated zonefile_files table, which contains more information than just the filename. (check-in: 38d23888cf user: dan tags: zonefile)
2018-02-20
20:57
Update README.md in ext/zonefile. (check-in: a13b2b3813 user: dan tags: zonefile)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/zonefile/zonefile.c.
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513



#define ZONEFILE_SCHEMA          \
  "CREATE TABLE z1("             \
  "  k INTEGER PRIMARY KEY,"     \
  "  v BLOB,"                    \
  "  file TEXT,"                 \
  "  sz INTEGER"                 \
  ")"

#define ZONEFILE_FILES_SCHEMA    \
  "CREATE TABLE z2("             \
  "  filename TEXT,"             \
  "  ekey BLOB,"                 \







|







499
500
501
502
503
504
505
506
507
508
509
510
511
512
513



#define ZONEFILE_SCHEMA          \
  "CREATE TABLE z1("             \
  "  k INTEGER PRIMARY KEY,"     \
  "  v BLOB,"                    \
  "  fileid INTEGER,"            \
  "  sz INTEGER"                 \
  ")"

#define ZONEFILE_FILES_SCHEMA    \
  "CREATE TABLE z2("             \
  "  filename TEXT,"             \
  "  ekey BLOB,"                 \
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
  switch( i ){
    case 0: /* k */
      sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pSelect, 0));
      break;
    case 1: /* v */
      rc = zonefileGetValue(pCtx, pCsr);
      break;
    case 2: { /* file */
      const char *zFile = 0;
      rc = zonefileGetFile(pCtx, pCsr, &zFile);
      sqlite3_result_text(pCtx, zFile, -1, SQLITE_TRANSIENT);
      zonefileReleaseFile(pCsr);
      break;
    }
    default: { /* sz */
      int iCol;
      if( sqlite3_column_type(pCsr->pSelect, 5)==SQLITE_NULL ){
        iCol = 3;
      }else{
        iCol = 5;
      }







|
<
<
|
<

<







2308
2309
2310
2311
2312
2313
2314
2315


2316

2317

2318
2319
2320
2321
2322
2323
2324
  switch( i ){
    case 0: /* k */
      sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pSelect, 0));
      break;
    case 1: /* v */
      rc = zonefileGetValue(pCtx, pCsr);
      break;
    case 2: /* fileid */


      sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pSelect, 1));

      break;

    default: { /* sz */
      int iCol;
      if( sqlite3_column_type(pCsr->pSelect, 5)==SQLITE_NULL ){
        iCol = 3;
      }else{
        iCol = 5;
      }
Changes to ext/zonefile/zonefile1.test.
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
         json_extract(header, '$.numKeys')
         FROM z1_files;
} {test.zonefile 1179332920 1 3}

do_execsql_test 1.4 { SELECT count(*) FROM z1_shadow_idx } 3

do_execsql_test 1.5.1 { SELECT k FROM z1 } {1 2 3}
do_execsql_test 1.5.2 { SELECT file FROM z1 } {
  test.zonefile test.zonefile test.zonefile
}
do_execsql_test 1.5.4 { SELECT sz FROM z1 } {100 100 100}

do_execsql_test 1.5.5 {
  SELECT zz.v==z1.v FROM zz, z1 WHERE zz.k=z1.k
} {1 1 1}

do_execsql_test 1.5 {







|
<
<







43
44
45
46
47
48
49
50


51
52
53
54
55
56
57
         json_extract(header, '$.numKeys')
         FROM z1_files;
} {test.zonefile 1179332920 1 3}

do_execsql_test 1.4 { SELECT count(*) FROM z1_shadow_idx } 3

do_execsql_test 1.5.1 { SELECT k FROM z1 } {1 2 3}
do_execsql_test 1.5.2 { SELECT fileid FROM z1 } {1 1 1}


do_execsql_test 1.5.4 { SELECT sz FROM z1 } {100 100 100}

do_execsql_test 1.5.5 {
  SELECT zz.v==z1.v FROM zz, z1 WHERE zz.k=z1.k
} {1 1 1}

do_execsql_test 1.5 {