From ede7da0c94cc51263ff6fd98bd910052f9974f2b Mon Sep 17 00:00:00 2001 From: Stefan Pranger Date: Tue, 29 Jun 2021 16:35:01 +0200 Subject: [PATCH] add db_safe util method --- CMakeLists.txt | 2 +- db/db.cpp | 7 +++++++ db/db.h | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 db/db.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a3262e..f297fe3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ add_executable(notification-daemon db/create.h db/update.h db/Schema.cpp - db/db.h + db/db.cpp db/migrations/Migration.cpp db/migrations/builder/Table.cpp db/statements/builder/Statement.cpp diff --git a/db/db.cpp b/db/db.cpp new file mode 100644 index 0000000..b6c6304 --- /dev/null +++ b/db/db.cpp @@ -0,0 +1,7 @@ +#include + +std::string db_safe(std::string str) { + str.insert(0, "\""); + str += "\""; + return str; +} diff --git a/db/db.h b/db/db.h index 40b4fb0..8e8346d 100644 --- a/db/db.h +++ b/db/db.h @@ -1,5 +1,7 @@ #pragma once +#include + #include #include @@ -16,3 +18,5 @@ namespace sql = SQLite; namespace db_builder = db::migrations::builder; namespace stmt = db::statements::builder; + +std::string db_safe(std::string str);