From 465bd19948e46f2157e403f2bb5f303aa076b602 Mon Sep 17 00:00:00 2001 From: "xj.lin" Date: Thu, 18 Apr 2019 11:21:49 +0800 Subject: [PATCH] fix bug Former-commit-id: 1c21d81875ec000c6f26ef8f2c367df8992fde59 --- cpp/src/db/db_connection.cpp | 12 ++++-------- cpp/src/db/db_connection.h | 10 ++++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cpp/src/db/db_connection.cpp b/cpp/src/db/db_connection.cpp index 4b02bd212c..2c97268ac9 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 b6870ec5ea..ecc55790f3 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: