| 296 | } |
| 297 | |
| 298 | Error Connection::Close(bool force) noexcept |
| 299 | { |
| 300 | // If there is a transaction in progress, |
| 301 | // rollback it. |
| 302 | std::vector<Transaction*> pendingTransactions; |
| 303 | |
| 304 | for (auto* transaction : pendingTransactions) |
| 305 | if (auto err = transaction->Abort(); !force && err.IsError()) |
| 306 | return err; |
| 307 | |
| 308 | if (mConnection != nullptr && mIsOwned) |
| 309 | if(auto err = Error(sqlite3_close(mConnection)); err.IsError()) |
| 310 | return err; |
| 311 | |
| 312 | mConnection = nullptr; |
| 313 | |
| 314 | return {}; |
| 315 | } |
| 316 | |
| 317 | std::string_view Connection::GetPath(const char* dbName) const noexcept |
| 318 | { |