Skip to content

Commit

Permalink
[core] Refactor xi_search to use new db API
Browse files Browse the repository at this point in the history
  • Loading branch information
zach2good committed Dec 17, 2023
1 parent 26ebbbf commit a422f08
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 142 deletions.
4 changes: 3 additions & 1 deletion src/common/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

std::unique_ptr<sql::Connection> db::getConnection()
{
// NOTE: Driver is static, so it will only be initialized once.
sql::Driver* driver = sql::mariadb::get_driver_instance();

try
Expand All @@ -53,7 +54,8 @@ std::unique_ptr<sql::Connection> db::getConnection()

std::unique_ptr<sql::ResultSet> db::query(std::string_view query)
{
auto conn = getConnection();
// TODO: Check this is pooled. If not; make it pooled.
static thread_local auto conn = getConnection();
auto stmt = conn->createStatement();
try
{
Expand Down
Loading

0 comments on commit a422f08

Please sign in to comment.