Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/duckdb/src/common/path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,20 @@ size_t Path::ParseUNCScheme(const string &input, Path &parsed) {
}
#endif

string Path::AddSuffixToPath(const string &path, const string &suffix) {
// we append the ".wal" **before** a question mark in case of GET parameters
// but only if we are not in a windows long path (which starts with \\?\)
std::size_t question_mark_pos = std::string::npos;
if (!StringUtil::StartsWith(path, "\\\\?\\")) {
question_mark_pos = path.find('?');
}
auto result = path;
if (question_mark_pos != std::string::npos) {
result.insert(question_mark_pos, suffix);
} else {
result += suffix;
}
return result;
}

} // namespace duckdb
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "1-dev399"
#define DUCKDB_PATCH_VERSION "1-dev401"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 5
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.5.1-dev399"
#define DUCKDB_VERSION "v1.5.1-dev401"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "222ea44eb4"
#define DUCKDB_SOURCE_ID "710adf3d05"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
2 changes: 2 additions & 0 deletions src/duckdb/src/include/duckdb/common/path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class Path {
return FromString(input).ToString();
}

static string AddSuffixToPath(const string &path, const string &suffix);

private:
string scheme;
string authority;
Expand Down
5 changes: 2 additions & 3 deletions src/duckdb/src/main/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "duckdb/storage/storage_extension.hpp"
#include "duckdb/common/serializer/serializer.hpp"
#include "duckdb/common/exception/parser_exception.hpp"
#include "duckdb/common/path.hpp"

#ifndef DUCKDB_NO_THREADS
#include "duckdb/common/thread.hpp"
Expand Down Expand Up @@ -547,10 +548,8 @@ void DBConfig::SetDefaultTempDirectory() {
options.temporary_directory = string();
} else if (DBConfig::IsInMemoryDatabase(options.database_path.c_str())) {
options.temporary_directory = ".tmp";
} else if (StringUtil::Contains(options.database_path, "?")) {
options.temporary_directory = StringUtil::Split(options.database_path, "?")[0] + ".tmp";
} else {
options.temporary_directory = options.database_path + ".tmp";
options.temporary_directory = Path::AddSuffixToPath(options.database_path, ".tmp");
}
}

Expand Down
15 changes: 2 additions & 13 deletions src/duckdb/src/storage/storage_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "duckdb/catalog/catalog_entry/duck_table_entry.hpp"
#include "duckdb/transaction/duck_transaction_manager.hpp"
#include "mbedtls_wrapper.hpp"
#include "duckdb/common/path.hpp"

namespace duckdb {
using SHA256State = duckdb_mbedtls::MbedTlsWrapper::SHA256State;
Expand Down Expand Up @@ -285,19 +286,7 @@ unique_ptr<lock_guard<mutex>> StorageManager::GetWALLock() {
}

string StorageManager::GetWALPath(const string &suffix) {
// we append the ".wal" **before** a question mark in case of GET parameters
// but only if we are not in a windows long path (which starts with \\?\)
std::size_t question_mark_pos = std::string::npos;
if (!StringUtil::StartsWith(path, "\\\\?\\")) {
question_mark_pos = path.find('?');
}
auto result = path;
if (question_mark_pos != std::string::npos) {
result.insert(question_mark_pos, suffix);
} else {
result += suffix;
}
return result;
return Path::AddSuffixToPath(path, suffix);
}

string StorageManager::GetCheckpointWALPath() {
Expand Down
Loading