414237 {
414238 if (path.empty() || path == IN_MEMORY_PATH) {
414239 return DataFileType::DUCKDB_FILE;
414240 }
414242 if (!handle) {
414243 return DataFileType::FILE_DOES_NOT_EXIST;
414244 }
414245
414246 constexpr const idx_t MAGIC_BYTES_READ_SIZE = 16;
414247 char buffer[MAGIC_BYTES_READ_SIZE] = {};
414248
414249 handle->Read(context, buffer, MAGIC_BYTES_READ_SIZE);
414250 if (memcmp(buffer, "SQLite format 3\0", 16) == 0) {
414251 return DataFileType::SQLITE_FILE;
414252 }
414253 if (memcmp(buffer, "PAR1", 4) == 0) {
414254 return DataFileType::PARQUET_FILE;
414255 }
414256 if (memcmp(buffer + MainHeader::MAGIC_BYTE_OFFSET,
MainHeader::MAGIC_BYTES, MainHeader::MAGIC_BYTE_SIZE) == 0) {
414257 return DataFileType::DUCKDB_FILE;
414258 }
414259 return DataFileType::UNKNOWN_FILE;
414260}
static constexpr FileOpenFlags FILE_FLAGS_NULL_IF_NOT_EXISTS
Return NULL if the file does not exist instead of throwing an error.
Definition duckdb.hpp:7865
static constexpr FileOpenFlags FILE_FLAGS_READ
Open file with read access.
Definition duckdb.hpp:7850
static const char MAGIC_BYTES[]
The magic bytes in front of the file should be "DUCK".
Definition duckdb.hpp:9751
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237