/ Check-in [03573887]
Login

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

Overview
Comment:If no KEY is specified on ATTACH, copy the main schema key if the key size is non-zero. In other words, allow for -1 as a valid key size in support of the --textkey to SEE.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 03573887dbf357f8aa54e4a1cd03b82b0ded8139
User & Date: drh 2016-09-16 19:42:47
Context
2016-09-16
20:39
Fix typo in the name of a Win32 string conversion routine. Replace several uses of raw_printf() with utf8_printf() in the shell. check-in: 6fc95dd7 user: mistachkin tags: trunk
19:42
If no KEY is specified on ATTACH, copy the main schema key if the key size is non-zero. In other words, allow for -1 as a valid key size in support of the --textkey to SEE. check-in: 03573887 user: drh tags: trunk
19:11
Fix problems with the fileRead() function in the command-line shell. Fix a harmless memory leak in the command-line shell, to make validation testing easier. check-in: e660402e user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/attach.c.

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
        zKey = (char *)sqlite3_value_blob(argv[2]);
        rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
        break;

      case SQLITE_NULL:
        /* No key specified.  Use the key from the main database */
        sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
        if( nKey>0 || sqlite3BtreeGetOptimalReserve(db->aDb[0].pBt)>0 ){
          rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
        }
        break;
    }
  }
#endif








|







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
        zKey = (char *)sqlite3_value_blob(argv[2]);
        rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
        break;

      case SQLITE_NULL:
        /* No key specified.  Use the key from the main database */
        sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
        if( nKey || sqlite3BtreeGetOptimalReserve(db->aDb[0].pBt)>0 ){
          rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
        }
        break;
    }
  }
#endif