#include <optional>
#include <stdexcept>
#include <string>
+#include <string_view>
#include <tuple>
#include <utility>
#include <variant>
bool is_done_ = false;
};
- Database(std::string db_path, int flags) {
+ Database(std::string_view db_path, int flags) {
sqlite3* raw_db = nullptr;
- int r = sqlite3_open_v2(db_path.c_str(), &raw_db, flags, nullptr);
+ int r = sqlite3_open_v2(db_path.data(), &raw_db, flags, nullptr);
if (r != SQLITE_OK)
throw DbException("open failed", r);
db_.reset(raw_db, sqlite3_close_v2);
}
- Database(std::string db_path, int flags,
+ Database(std::string_view db_path, int flags,
std::function<bool(int)> busy_handler) {
sqlite3* raw_db = nullptr;
- int r = sqlite3_open_v2(db_path.c_str(), &raw_db, flags, nullptr);
+ int r = sqlite3_open_v2(db_path.data(), &raw_db, flags, nullptr);
if (r != SQLITE_OK)
throw DbException("sqlite3_open_v2() failed", r);