Commit 1b421982 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[1183] getAllRecords already takes zone_id, does not need name

parent 45630ca9
......@@ -497,7 +497,7 @@ DatabaseClient::getIterator(const isc::dns::Name& name) const {
}
// Request the context
DatabaseAccessor::IteratorContextPtr
context(database_->getAllRecords(name, zone.second));
context(database_->getAllRecords(zone.second));
// It must not return NULL, that's a bug of the implementation
if (context == DatabaseAccessor::IteratorContextPtr()) {
isc_throw(isc::Unexpected, "Iterator context null at " +
......
......@@ -173,15 +173,13 @@ public:
* \param id The ID of the zone, returned from getZone().
* \return Newly created iterator context. Must not be NULL.
*/
virtual IteratorContextPtr getAllRecords(const isc::dns::Name& name,
int id) const
virtual IteratorContextPtr getAllRecords(int id) const
{
/*
* This is a compromise. We need to document the parameters in doxygen,
* so they need a name, but then it complains about unused parameter.
* This is a NOP that "uses" the parameters.
*/
static_cast<void>(name);
static_cast<void>(id);
isc_throw(isc::NotImplemented,
......
......@@ -468,7 +468,7 @@ SQLite3Database::getRecords(const isc::dns::Name& name, int id) const {
}
DatabaseAccessor::IteratorContextPtr
SQLite3Database::getAllRecords(const isc::dns::Name&, int id) const {
SQLite3Database::getAllRecords(int id) const {
return (IteratorContextPtr(new Context(shared_from_this(), id)));
}
......
......@@ -96,8 +96,7 @@ public:
int id) const;
/// \brief Implementation of DatabaseAbstraction::getAllRecords
virtual IteratorContextPtr getAllRecords(const isc::dns::Name&,
int id) const;
virtual IteratorContextPtr getAllRecords(int id) const;
/// The SQLite3 implementation of this method returns a string starting
/// with a fixed prefix of "sqlite3_" followed by the DB file name
......
......@@ -233,7 +233,7 @@ private:
}
};
public:
virtual IteratorContextPtr getAllRecords(const Name&, int id) const {
virtual IteratorContextPtr getAllRecords(int id) const {
if (id == 42) {
return (IteratorContextPtr(new MockIteratorContext()));
} else if (id == 13) {
......@@ -440,12 +440,16 @@ private:
}
};
// This tests the default getRecords behaviour, throwing NotImplemented
TEST(DatabaseConnectionTest, getRecords) {
EXPECT_THROW(NopAccessor().getRecords(Name("."), 1),
isc::NotImplemented);
}
// This tests the default getAllRecords behaviour, throwing NotImplemented
TEST(DatabaseConnectionTest, getAllRecords) {
// The parameters don't matter
EXPECT_THROW(NopAccessor().getRecords(Name("."), 1),
isc::NotImplemented);
EXPECT_THROW(NopAccessor().getAllRecords(Name("."), 1),
EXPECT_THROW(NopAccessor().getAllRecords(1),
isc::NotImplemented);
}
......
......@@ -110,7 +110,7 @@ TEST_F(SQLite3Access, iterator) {
// Get the iterator context
DatabaseAccessor::IteratorContextPtr
context(db->getAllRecords(Name("example2.com"), 1));
context(db->getAllRecords(1));
ASSERT_NE(DatabaseAccessor::IteratorContextPtr(),
context);
......@@ -133,7 +133,7 @@ TEST_F(SQLite3Access, iteratorColumnCount) {
// Get the iterator context
DatabaseAccessor::IteratorContextPtr
context(db->getAllRecords(Name("example2.com"), 1));
context(db->getAllRecords(1));
ASSERT_NE(DatabaseAccessor::IteratorContextPtr(),
context);
......
Supports Markdown
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