Browse Source

[2877] Comments and documentation

For the previous commit, adding the reverse name to the list of
parameters for delete.
Michal 'vorner' Vaner 12 years ago
parent
commit
8662231f00
2 changed files with 6 additions and 1 deletions
  1. 2 1
      src/lib/datasrc/database.h
  2. 4 0
      src/lib/datasrc/sqlite3_accessor.cc

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

@@ -127,7 +127,8 @@ public:
                       ///< or the hash label for deleteNSEC3RecordInZone()
         DEL_TYPE = 1, ///< The RRType of the record (A/NS/TXT etc.)
         DEL_RDATA = 2, ///< Full text representation of the record's RDATA
-        DEL_RNAME = 3,
+        DEL_RNAME = 3, ///< As DEL_NAME, but with the labels of domain name
+                       ///< in reverse order (eg. org.example.).
         DEL_PARAM_COUNT = 4 ///< Number of parameters
     };
 

+ 4 - 0
src/lib/datasrc/sqlite3_accessor.cc

@@ -104,6 +104,8 @@ const char* const text_statements[NUM_STATEMENTS] = {
     "INSERT INTO records "      // ADD_RECORD
         "(zone_id, name, rname, ttl, rdtype, sigtype, rdata) "
         "VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)",
+    // DEL_RECORD:
+    // Delete based on the reverse name, as that one has an index.
     "DELETE FROM records WHERE zone_id=?1 AND rname=?2 " // DEL_RECORD
         "AND rdtype=?3 AND rdata=?4",
 
@@ -1295,6 +1297,8 @@ SQLite3Accessor::deleteRecordInZone(const string (&params)[DEL_PARAM_COUNT]) {
         isc_throw(DataSourceError, "deleting record in SQLite3 "
                   "data source without transaction");
     }
+    // We don't pass all the parameters to the query, one name (reserve one
+    // in this case) is sufficient. Pass only the needed ones.
     const size_t SQLITE3_DEL_PARAM_COUNT = DEL_PARAM_COUNT - 1;
     const string sqlite3_params[SQLITE3_DEL_PARAM_COUNT] = {
         params[DEL_RNAME],