]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/driver/dbstore/sqlite/connection.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
5 * Ceph - scalable distributed file system
7 * Copyright (C) 2022 Red Hat, Inc.
9 * This is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License version 2.1, as published by the Free Software
12 * Foundation. See file COPYING.
16 #include "common/dout.h"
17 #include "connection.h"
20 namespace rgw::dbstore::sqlite
{
22 db_ptr
open_database(const char* filename
, int flags
)
24 sqlite3
* db
= nullptr;
25 const int result
= ::sqlite3_open_v2(filename
, &db
, flags
, nullptr);
26 if (result
!= SQLITE_OK
) {
27 throw std::system_error(result
, sqlite::error_category());
29 // request extended result codes
30 (void) ::sqlite3_extended_result_codes(db
, 1);
34 } // namespace rgw::dbstore::sqlite