426267 {
426268 string storage_version_user_provided = "";
426269 for (auto &entry : options) {
426270 if (entry.first == "block_size") {
426271
426272
426274 } else if (entry.first == "encryption_key") {
426275
426276 auto type = entry.second.type();
426277 if (type.id() != LogicalTypeId::VARCHAR) {
426278 throw BinderException("\"%s\" is not a valid key. A key must be of type VARCHAR",
426279 entry.second.ToString());
426280 } else if (entry.second.GetValue<string>().empty()) {
426281 throw BinderException("Not a valid key. A key cannot be empty");
426282 }
426283 user_key = make_shared_ptr<string>(StringValue::Get(entry.second.DefaultCastAs(LogicalType::BLOB)));
426286 } else if (entry.first == "encryption_cipher") {
426287 auto parsed_cipher = EncryptionTypes::StringToCipher(entry.second.ToString());
426288 if (parsed_cipher != EncryptionTypes::CipherType::GCM &&
426289 parsed_cipher != EncryptionTypes::CipherType::CTR) {
426290 throw BinderException("\"%s\" is not a valid cipher. Try 'GCM' or 'CTR'.", entry.second.ToString());
426291 }
426293 } else if (entry.first == "row_group_size") {
426295 } else if (entry.first == "storage_version") {
426296 storage_version_user_provided = entry.second.ToString();
426298 SerializationCompatibility::FromString(storage_version_user_provided).serialization_version;
426299 } else if (entry.first == "compress") {
426300 if (entry.second.DefaultCastAs(LogicalType::BOOLEAN).GetValue<bool>()) {
426301 compress_in_memory = CompressInMemory::COMPRESS;
426302 } else {
426303 compress_in_memory = CompressInMemory::DO_NOT_COMPRESS;
426304 }
426305 } else if (entry.first == "debug_encryption_version") {
426307 } else {
426308 throw BinderException("Unrecognized option for attach \"%s\"", entry.first);
426309 }
426310 }
426311
426312 options.erase("encryption_key");
426313 options.erase("encryption_cipher");
426315 SetEncryptionVersion(storage_version_user_provided);
426316 }
426317}
shared_ptr< string > user_key
Definition duckdb.cpp:11060
optional_idx block_header_size
Block header size (only used for encryption).
Definition duckdb.cpp:11050
bool encryption
Whether the database is encrypted.
Definition duckdb.cpp:11055
optional_idx row_group_size
The row group size for this attached database (if any).
Definition duckdb.cpp:11046
EncryptionTypes::CipherType encryption_cipher
Encryption algorithm.
Definition duckdb.cpp:11057
optional_idx block_alloc_size
The allocation size of blocks for this attached database file (if any).
Definition duckdb.cpp:11044