db_connection.cpp 864 字节
Newer Older
X
xj.lin 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
////////////////////////////////////////////////////////////////////////////////
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
////////////////////////////////////////////////////////////////////////////////

#include "db_connection.h"


namespace zilliz {
namespace vecwise {
namespace engine {

using std::string;
X
fix bug  
xj.lin 已提交
15
using namespace sqlite_orm;
X
xj.lin 已提交
16

X
fix bug  
xj.lin 已提交
17
string storage_file_name = "default.sqlite";
X
xj.lin 已提交
18

X
fix bug  
xj.lin 已提交
19 20
SqliteDBPtr connect() {
    SqliteDBPtr temp = std::make_shared<SqliteDB>(initStorage(storage_file_name));
X
xj.lin 已提交
21 22 23 24 25 26 27 28 29 30 31
    temp->sync_schema();
    temp->open_forever(); // thread safe option
    temp->pragma.journal_mode(journal_mode::WAL); // WAL => write ahead log
    return temp;
}

SqliteDBPtr Connection::connect_ = connect();

}
}
}