diff --git a/cpp/src/db/db_connection.cpp b/cpp/src/db/db_connection.cpp index 4b02bd212c2b3e487e108a6ec2641b6ebfeea37e..2c97268ac9372935462abe325b8b2e38da6222b1 100644 --- a/cpp/src/db/db_connection.cpp +++ b/cpp/src/db/db_connection.cpp @@ -6,22 +6,18 @@ #include "db_connection.h" -#include -#include -#include namespace zilliz { namespace vecwise { namespace engine { -using std::cout; -using std::endl; using std::string; +using namespace sqlite_orm; -string storage_file_name = "default.sqlite" +string storage_file_name = "default.sqlite"; -DbPtr connect() { - DbPtr temp = std::make_shared(initStorage(storage_file_name)); +SqliteDBPtr connect() { + SqliteDBPtr temp = std::make_shared(initStorage(storage_file_name)); temp->sync_schema(); temp->open_forever(); // thread safe option temp->pragma.journal_mode(journal_mode::WAL); // WAL => write ahead log diff --git a/cpp/src/db/db_connection.h b/cpp/src/db/db_connection.h index b6870ec5ea13b38ecd83839a8c4cc20fa3fe9e0b..ecc55790f3fc38bf6cc7d52aa53ef84c88592314 100644 --- a/cpp/src/db/db_connection.h +++ b/cpp/src/db/db_connection.h @@ -6,6 +6,11 @@ #pragma once +#include +#include + +#include + namespace zilliz { namespace vecwise { @@ -36,8 +41,9 @@ struct GroupFileSchema { }; // GroupFileSchema inline auto initStorage(const std::string &path) { + using namespace sqlite_orm; return make_storage(path, - // Add table below + // Add table below make_table("Groups", make_column("id", &GroupSchema::id, primary_key()), make_column("group_id", &GroupSchema::group_id, unique()), @@ -46,7 +52,7 @@ inline auto initStorage(const std::string &path) { } using SqliteDB = decltype(initStorage("")); -using SqliteDBPtr= std::shared_ptr; +using SqliteDBPtr= std::shared_ptr; class Connection { protected: