Browse Source

[1177] Pass reversed name to the Accessor

Michal 'vorner' Vaner 13 years ago
parent
commit
3f2864bf12

+ 2 - 1
src/lib/datasrc/database.cc

@@ -566,7 +566,8 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
 
 Name
 DatabaseClient::Finder::findPreviousName(const Name& name) const {
-    return (Name(accessor_->findPreviousName(zone_id_, name.toText())));
+    return (Name(accessor_->findPreviousName(zone_id_,
+                                             name.reverse().toText())));
 }
 
 Name

+ 1 - 1
src/lib/datasrc/sqlite3_accessor.h

@@ -171,7 +171,7 @@ public:
     virtual const std::string& getDBName() const { return (database_name_); }
 
     /// \brief Concrete implementation of the pure virtual method
-    virtual std::string findPreviousName(int zone_id, const std::string& name)
+    virtual std::string findPreviousName(int zone_id, const std::string& rname)
         const;
 
 private:

+ 3 - 3
src/lib/datasrc/tests/database_unittest.cc

@@ -539,7 +539,7 @@ public:
         return (latest_clone_);
     }
 
-    virtual std::string findPreviousName(int id, const std::string& name)
+    virtual std::string findPreviousName(int id, const std::string& rname)
         const
     {
         // Hardcoded for now, but we could compute it from the data
@@ -547,9 +547,9 @@ public:
         if (id == -1) {
             isc_throw(isc::NotImplemented, "Test not implemented behaviour");
         } else if (id == 42) {
-            if (name == "example.org.") {
+            if (rname == "org.example.") {
                 return ("zzz.example.org.");
-            } else if (name == "www2.example.org.") {
+            } else if (rname == "org.example.www2.") {
                 return ("www.example.org.");
             } else {
                 isc_throw(isc::Unexpected, "Unexpected name");