SQLite

Check-in [4caa5fc86e]
Login

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

Overview
Comment:When ATTACH-ing a new database to an existing database with a codec, do not enable the codec in the attached database if it is not enabled in the existing database and it is not requested by the USING clause.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4caa5fc86e7fe404cd188713277f2801cd02dbc9
User & Date: drh 2011-04-09 02:34:33.149
Context
2011-04-09
03:04
Back out the SQLITE_OMIT_UNIQUE_ENFORCEMENT compile-option. It is an unneeded complication. (check-in: 927e955b93 user: drh tags: trunk)
02:34
When ATTACH-ing a new database to an existing database with a codec, do not enable the codec in the attached database if it is not enabled in the existing database and it is not requested by the USING clause. (check-in: 4caa5fc86e user: drh tags: trunk)
02:09
Do not do a backup if the number of reserved bytes in the source and destination do not match. Try to make the match, but if unable fail. (check-in: 0ca8a2332b user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/attach.c.
172
173
174
175
176
177
178

179

180
181
182
183
184
185
186
        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);

        rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);

        break;
    }
  }
#endif

  /* If the file was opened successfully, read the schema for the new database.
  ** If this fails, or if opening the file failed, then close the file and 







>
|
>







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
        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 || sqlite3BtreeGetReserve(db->aDb[0].pBt)>0 ){
          rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
        }
        break;
    }
  }
#endif

  /* If the file was opened successfully, read the schema for the new database.
  ** If this fails, or if opening the file failed, then close the file and