// database is read only for the current user.
conn_.prepareStatements(tagged_statements.begin(),
tagged_statements.end());
+// @todo As part of enabling read-only CB access, statements need to
+// be limited:
// tagged_statements.begin() + WRITE_STMTS_BEGIN);
// Create unique timer name per instance.
-// Copyright (C) 2018-2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
};
/// @brief Test fixture class for @c MySqlConfigBackendDHCPv4.
-///
-/// @todo The tests we're providing here only test cases when the
-/// server selector is set to 'ALL' (configuration elements belong to
-/// all servers). Currently we have no API to insert servers into
-/// the database, and therefore we can't test the case when
-/// configuration elements are assigned to particular servers by
-/// server tags. We will have to expand existing tests when
-/// the API is extended allowing for inserting servers to the
-/// database.
class MySqlConfigBackendDHCPv4Test : public MySqlGenericBackendTest {
public:
}
}
+/// @brief Test fixture for verifying database connection loss-recovery
+/// behavior.
class MySqlConfigBackendDHCPv4DbLostCallbackTest : public ::testing::Test {
public:
MySqlConfigBackendDHCPv4DbLostCallbackTest()
void
PgSqlConnection::createSavepoint(const std::string& name) {
if (transaction_ref_count_ <= 0) {
- isc_throw(Unexpected, "no transaction, cannot create savepoint: " << name);
+ isc_throw(InvalidOperation, "no transaction, cannot create savepoint: " << name);
}
DB_LOG_DEBUG(DB_DBG_TRACE_DETAIL, PGSQL_CREATE_SAVEPOINT).arg(name);
void
PgSqlConnection::rollbackToSavepoint(const std::string& name) {
if (transaction_ref_count_ <= 0) {
- isc_throw(Unexpected, "no transaction, cannot rollback to savepoint: " << name);
+ isc_throw(InvalidOperation, "no transaction, cannot rollback to savepoint: " << name);
}
std::string sql("ROLLBACK TO SAVEPOINT " + name);
///
/// Creates a named savepoint within the current transaction.
///
- /// @param name name of the savepoint to create. This name
- /// must be unique within the transaction?
+ /// @param name name of the savepoint to create.
///
- /// @throw Unexpected if called outside a transaction.
+ /// @throw InvalidOperation if called outside a transaction.
/// @throw DbOperationError If the savepoint cannot be created.
void createSavepoint(const std::string& name);
///
/// @param name name of the savepoint to which to rollback.
///
- /// @throw Unexpected if called outside a transaction.
+ /// @throw InvalidOperation if called outside a transaction.
/// @throw DbOperationError if the rollback failed.
void rollbackToSavepoint(const std::string& name);
// Creating or rollback to savepoints outside of transactions
// should throw.
- ASSERT_THROW_MSG(conn_->createSavepoint("rubbish"), Unexpected,
+ ASSERT_THROW_MSG(conn_->createSavepoint("rubbish"), InvalidOperation,
"no transaction, cannot create savepoint: rubbish");
- ASSERT_THROW_MSG(conn_->rollbackToSavepoint("rubbish"), Unexpected,
+ ASSERT_THROW_MSG(conn_->rollbackToSavepoint("rubbish"), InvalidOperation,
"no transaction, cannot rollback to savepoint: rubbish");
// Test that we can create and rollback to a savepoint, then