Commit c600aab4 authored by JINMEI Tatuya's avatar JINMEI Tatuya

provided the strong exception guarantee in DB initialization.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1388 e5f2f494-b856-4b98-b285-d166d9295462
parent c54a03be
This diff is collapsed.
......@@ -21,8 +21,6 @@
#include <exceptions/exceptions.h>
#include <sqlite3.h>
#include "data_source.h"
namespace isc {
......@@ -37,6 +35,7 @@ class RRsetList;
namespace auth {
class Query;
struct Sqlite3Parameters;
class Sqlite3Error : public Exception {
public:
......@@ -108,34 +107,15 @@ private:
};
void open(const std::string& name);
sqlite3_stmt* prepare(const char *statement);
void release(sqlite3_stmt* prepared);
int getVersion(void);
int hasExactZone(const char *name) const;
int findRecords(const isc::dns::Name& name, const isc::dns::RRType& rdtype,
isc::dns::RRsetList& target, const isc::dns::Name* zonename,
const Mode mode, uint32_t& flags) const;
int findClosest(const isc::dns::Name& name, unsigned int* position) const;
void loadVersion(void);
void setupPreparedStatements(void);
void execSetupQuery(const char *query);
void checkAndSetupSchema(void);
sqlite3 *db;
int database_version;
//
// Prepared statements
//
sqlite3_stmt *q_zone;
sqlite3_stmt *q_record;
sqlite3_stmt *q_addrs;
sqlite3_stmt *q_referral;
sqlite3_stmt *q_any;
sqlite3_stmt *q_count;
sqlite3_stmt *q_previous;
sqlite3_stmt *q_nsec3;
sqlite3_stmt *q_prevnsec3;
private:
Sqlite3Parameters* dbparameters;
};
}
......
......@@ -382,7 +382,6 @@ TEST_F(Sqlite3DataSourceTest, doubleClose) {
EXPECT_THROW(data_source.close(), DataSourceError);
}
#if 0 // currently fails
TEST_F(Sqlite3DataSourceTest, openBrokenDB) {
EXPECT_EQ(DataSrc::SUCCESS, data_source.close());
// The database exists but is broken. An exception will be thrown
......@@ -392,7 +391,6 @@ TEST_F(Sqlite3DataSourceTest, openBrokenDB) {
// in the closed state.
EXPECT_EQ(DataSrc::SUCCESS, data_source.init(SQLITE_DBFILE_EXAMPLE));
}
#endif
// This test only confirms that on-the-fly schema creation works.
TEST_F(Sqlite3DataSourceTest, memoryDB) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment