BIND 10 trac1330, updated. 92794c72752a77005c2f9c7683fd2c65d7d802e9 [1330] Tidy up sqlite3_accessor unit tests

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Nov 8 18:25:54 UTC 2011


The branch, trac1330 has been updated
       via  92794c72752a77005c2f9c7683fd2c65d7d802e9 (commit)
       via  3000256b60ee6a2c19a7188be4d17eca833ce869 (commit)
       via  edf044e9e2f1572b618ec2438cea1cad46432276 (commit)
      from  2f51afcbc57c6d58e7d90f37962f3b93bc768e1b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 92794c72752a77005c2f9c7683fd2c65d7d802e9
Author: Stephen Morris <stephen at isc.org>
Date:   Tue Nov 8 18:23:52 2011 +0000

    [1330] Tidy up sqlite3_accessor unit tests
    
    In particular, use checkRR to compare RRs returned from
    iterators.

commit 3000256b60ee6a2c19a7188be4d17eca833ce869
Author: Stephen Morris <stephen at isc.org>
Date:   Tue Nov 8 17:57:54 2011 +0000

    [1330] Updated with tests for valid sequences

commit edf044e9e2f1572b618ec2438cea1cad46432276
Author: Stephen Morris <stephen at isc.org>
Date:   Tue Nov 8 16:06:45 2011 +0000

    [1330] Back out change 918c35143eb61d6e0ac96e98f2a95b12d55fdc0c
    
    A different exception adds nothing to the error and has the
    complication of requiring an additional query.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/sqlite3_accessor.cc                |   75 +++-----
 src/lib/datasrc/sqlite3_accessor.h                 |   17 +--
 src/lib/datasrc/tests/sqlite3_accessor_unittest.cc |  195 +++++++++++---------
 src/lib/datasrc/tests/testdata/diffs.sqlite3       |  Bin 16384 -> 16384 bytes
 src/lib/datasrc/tests/testdata/diffs_table.sql     |    5 +-
 5 files changed, 145 insertions(+), 147 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/sqlite3_accessor.cc b/src/lib/datasrc/sqlite3_accessor.cc
index e5c35b6..c0c0666 100644
--- a/src/lib/datasrc/sqlite3_accessor.cc
+++ b/src/lib/datasrc/sqlite3_accessor.cc
@@ -54,11 +54,10 @@ enum StatementID {
     FIND_PREVIOUS = 10,
     ADD_RECORD_DIFF = 11,
     GET_RECORD_DIFF = 12,       // This is temporary for testing "add diff"
-    COUNT_DIFF_RECS = 13,
-    LOW_DIFF_ID = 14,
-    HIGH_DIFF_ID = 15,
-    DIFF_RECS = 16,
-    NUM_STATEMENTS = 17
+    LOW_DIFF_ID = 13,
+    HIGH_DIFF_ID = 14,
+    DIFF_RECS = 15,
+    NUM_STATEMENTS = 16
 };
 
 const char* const text_statements[NUM_STATEMENTS] = {
@@ -96,8 +95,6 @@ const char* const text_statements[NUM_STATEMENTS] = {
 
     // Two statements to select the lowest ID and highest ID in a set of
     // differences.
-    "SELECT COUNT(id) FROM diffs "  // COUNT_DIFF_RECS
-        "WHERE zone_id=?1",
     "SELECT id FROM diffs "     // LOW_DIFF_ID
         "WHERE zone_id=?1 AND version=?2 and OPERATION=0 "
         "ORDER BY id ASC LIMIT 1",
@@ -144,10 +141,8 @@ struct SQLite3Parameters {
     void
     finalizeStatements() {
         for (int i = 0; i < NUM_STATEMENTS; ++i) {
-            if (statements_[i] != NULL) {
-                sqlite3_finalize(statements_[i]);
-                statements_[i] = NULL;
-            }
+            sqlite3_finalize(statements_[i]);
+            statements_[i] = NULL;
         }
     }
 
@@ -629,15 +624,13 @@ public:
             int high_id = findIndex(HIGH_DIFF_ID, zone_id, end);
 
             // Prepare the statement that will return data values
-            clearBindings(DIFF_RECS);
+            reset(DIFF_RECS);
             bindInt(DIFF_RECS, 1, zone_id);
             bindInt(DIFF_RECS, 2, low_id);
             bindInt(DIFF_RECS, 3, high_id);
-
-            // last_status_ has been initialized to pretend that the last
-            // getNext() returned a record.
-
         } catch (...) {
+
+            // Something wrong, clear up everything.
             accessor_->dbparameters_->finalizeStatements();
             throw;
         }
@@ -659,12 +652,14 @@ public:
     /// \exceptions any Varied
     bool getNext(std::string (&data)[COLUMN_COUNT]) {
 
-        // Get a pointer to the statement for brevity (does not transfer
-        // resources)
-        sqlite3_stmt* stmt = accessor_->dbparameters_->getStatement(DIFF_RECS);
-
-        // If there is a row to get, get it.
         if (last_status_ != SQLITE_DONE) {
+            // Last call (if any) didn't reach end of result set, so we
+            // can read another row from it.
+            //
+            // Get a pointer to the statement for brevity (does not transfer
+            // resources)
+            sqlite3_stmt* stmt = accessor_->dbparameters_->getStatement(DIFF_RECS);
+
             const int rc(sqlite3_step(stmt));
             if (rc == SQLITE_ROW) {
                 // Copy the data across to the output array
@@ -672,8 +667,8 @@ public:
                 copyColumn(DIFF_RECS, data, TTL_COLUMN);
                 copyColumn(DIFF_RECS, data, NAME_COLUMN);
                 copyColumn(DIFF_RECS, data, RDATA_COLUMN);
+
             } else if (rc != SQLITE_DONE) {
-                accessor_->dbparameters_->finalizeStatements();
                 isc_throw(DataSourceError,
                           "Unexpected failure in sqlite3_step: " <<
                           sqlite3_errmsg(accessor_->dbparameters_->db_));
@@ -687,13 +682,12 @@ private:
 
     /// \brief Clear Statement Bindings
     ///
-    /// Clears the bindings of variables in a prepared statement and resets
-    /// them to null.
+    /// Resets the statement and clears any bindings attached to it.
     ///
     /// \param stindex Index of prepared statement to which to bind
-    void clearBindings(int stindex) {
-        if (sqlite3_clear_bindings(
-            accessor_->dbparameters_->getStatement(stindex)) != SQLITE_OK) {
+    void reset(int stindex) {
+        sqlite3_stmt* stmt = accessor_->dbparameters_->getStatement(stindex);
+        if ((sqlite3_reset(stmt) != SQLITE_OK) || (sqlite3_clear_bindings(stmt) != SQLITE_OK)) {
             isc_throw(SQLite3Error, "Could not clear statement bindings in '" <<
                       text_statements[stindex] << "': " << 
                       sqlite3_errmsg(accessor_->dbparameters_->db_));
@@ -788,7 +782,7 @@ private:
     int findIndex(StatementID stindex, int zone_id, uint32_t serial) {
 
         // Set up the statement
-        clearBindings(stindex);
+        reset(stindex);
         bindInt(stindex, 1, zone_id);
         bindInt(stindex, 2, serial);
 
@@ -799,23 +793,11 @@ private:
 
         } catch (TooLittleData) {
 
-            // Why is there too little data?  Could be there is no data in
-            // the table for the zone, or there is but there is no data for
-            // that particular serial number.  Do another query to find out.
-            clearBindings(COUNT_DIFF_RECS);
-            bindInt(COUNT_DIFF_RECS, 1, zone_id);
-
-            // If this throws an exception, let it propagate - there is
-            // definitely an error.
-            result = getSingleValue(COUNT_DIFF_RECS);
-            if (result == 0) {
-                isc_throw(NoDiffRecs, "no data in differences table for "
-                          "zone ID " << zone_id);
-            } else {
-                isc_throw(NoSuchSerial, "no data in differences table for "
-                          "zone ID " << zone_id << ", serial number " <<
-                          serial);
-            }
+            // No data returned but the SQL query succeeded.  Only possibility
+            // is that there is no entry in the differences table for the given
+            // zone and version.
+            isc_throw(NoSuchSerial, "No entry in differences table for " <<
+                      " zone ID " << zone_id << ", serial number " << serial);
         }
 
         return (result);
@@ -843,7 +825,8 @@ private:
     // Attributes
 
     boost::shared_ptr<const SQLite3Accessor> accessor_; // Accessor object
-    int last_status_;   // Last status received from sqlite3_step
+    sqlite3_stmt*   stmt_;      // Prepared statement for this iterator
+    int last_status_;           // Last status received from sqlite3_step
 };
 
 // ... and return the iterator
diff --git a/src/lib/datasrc/sqlite3_accessor.h b/src/lib/datasrc/sqlite3_accessor.h
index eef3b7f..c3841f8 100644
--- a/src/lib/datasrc/sqlite3_accessor.h
+++ b/src/lib/datasrc/sqlite3_accessor.h
@@ -71,22 +71,10 @@ public:
 };
 
 /**
- * \brief No difference records
- *
- * Thrown if there are no difference records in the table for the requested
- * zone.
- */
-class NoDiffRecs : public Exception {
-public:
-    NoDiffRecs(const char* file, size_t line, const char* what) :
-        isc::Exception(file, line, what) {}
-};
-
-/**
  * \brief No such serial number when obtaining difference iterator
  *
- * Thrown if either the start or end version requested for the difference
- * iterator does not exist.
+ * Thrown if either the zone/start version or zone/end version combination
+ * does not exist in the differences table.
  */
 class NoSuchSerial : public Exception {
 public:
@@ -94,6 +82,7 @@ public:
         isc::Exception(file, line, what) {}
 };
 
+
 struct SQLite3Parameters;
 
 /**
diff --git a/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc b/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc
index 0d8454d..61341f6 100644
--- a/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc
+++ b/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc
@@ -117,6 +117,26 @@ TEST_F(SQLite3AccessorTest, noClass) {
     EXPECT_FALSE(accessor->getZone("example.com.").first);
 }
 
+// Simple check to test that the sequence is valid.  It gets the next record
+// from the iterator, checks that it is not null, then checks the data.
+void checkRR(DatabaseAccessor::IteratorContextPtr& context,
+     std::string name, std::string ttl, std::string type, std::string rdata) {
+
+    // Mark where we are in the text
+    SCOPED_TRACE(name + " " + ttl + " " + type + " " + rdata);
+
+    std::string data[DatabaseAccessor::COLUMN_COUNT];
+
+    // Get next record
+    EXPECT_TRUE(context->getNext(data));
+
+    // ... and check expected values
+    EXPECT_EQ(name, data[DatabaseAccessor::NAME_COLUMN]);
+    EXPECT_EQ(ttl, data[DatabaseAccessor::TTL_COLUMN]);
+    EXPECT_EQ(type, data[DatabaseAccessor::TYPE_COLUMN]);
+    EXPECT_EQ(rdata, data[DatabaseAccessor::RDATA_COLUMN]);
+}
+
 // This tests the iterator context
 TEST_F(SQLite3AccessorTest, iterator) {
     // Our test zone is conveniently small, but not empty
@@ -131,74 +151,21 @@ TEST_F(SQLite3AccessorTest, iterator) {
     ASSERT_NE(DatabaseAccessor::IteratorContextPtr(), context);
 
     std::string data[DatabaseAccessor::COLUMN_COUNT];
-    // Get and check the first and only record
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("MX", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("10 mail.example.org.", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("example.org.", data[DatabaseAccessor::NAME_COLUMN]);
-
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("NS", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("ns1.example.org.", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("example.org.", data[DatabaseAccessor::NAME_COLUMN]);
-
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("NS", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("ns2.example.org.", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("example.org.", data[DatabaseAccessor::NAME_COLUMN]);
-
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("NS", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("ns3.example.org.", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("example.org.", data[DatabaseAccessor::NAME_COLUMN]);
-
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("SOA", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("ns1.example.org. admin.example.org. "
-              "1234 3600 1800 2419200 7200",
-              data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("example.org.", data[DatabaseAccessor::NAME_COLUMN]);
-
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("DNAME", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("dname.example.info.", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("dname.example.org.", data[DatabaseAccessor::NAME_COLUMN]);
-
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("DNAME", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("dname2.example.info.", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("dname2.foo.example.org.", data[DatabaseAccessor::NAME_COLUMN]);
 
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("A", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("192.0.2.10", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("mail.example.org.", data[DatabaseAccessor::NAME_COLUMN]);
-
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("NS", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("ns.sub.example.org.", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("sub.example.org.", data[DatabaseAccessor::NAME_COLUMN]);
-
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("A", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("192.0.2.101", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("ns.sub.example.org.", data[DatabaseAccessor::NAME_COLUMN]);
-
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("A", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("3600", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("192.0.2.1", data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("www.example.org.", data[DatabaseAccessor::NAME_COLUMN]);
+    checkRR(context, "example.org.", "3600", "MX", "10 mail.example.org.");
+    checkRR(context, "example.org.", "3600", "NS", "ns1.example.org.");
+    checkRR(context, "example.org.", "3600", "NS", "ns2.example.org.");
+    checkRR(context, "example.org.", "3600", "NS", "ns3.example.org.");
+    checkRR(context, "example.org.", "3600", "SOA",
+            "ns1.example.org. admin.example.org. 1234 3600 1800 2419200 7200");
+    checkRR(context, "dname.example.org.", "3600", "DNAME",
+            "dname.example.info.");
+    checkRR(context, "dname2.foo.example.org.", "3600", "DNAME",
+            "dname2.example.info.");
+    checkRR(context, "mail.example.org.", "3600", "A", "192.0.2.10");
+    checkRR(context, "sub.example.org.", "3600", "NS", "ns.sub.example.org.");
+    checkRR(context, "ns.sub.example.org.", "3600", "A", "192.0.2.101");
+    checkRR(context, "www.example.org.", "3600", "A", "192.0.2.1");
 
     // Check there's no other
     EXPECT_FALSE(context->getNext(data));
@@ -209,9 +176,8 @@ TEST_F(SQLite3AccessorTest, iterator) {
 
 // This tests the difference iterator context
 
-// Test that at attempt to create a difference iterator for a serial that
-// does not exist throws an exception.
-
+// Test that at attempt to create a difference iterator for a serial number
+// that does not exist throws an exception.
 TEST_F(SQLite3AccessorTest, diffIteratorNoRecords) {
 
     // Our test zone is conveniently small, but not empty
@@ -230,34 +196,93 @@ TEST_F(SQLite3AccessorTest, diffIteratorNoRecords) {
                  NoSuchSerial);
 
     // Check that valid versions - but for the wrong zone which does not hold
-    // any records - throws the correct exception.
+    // any records - also throws this exception.
     EXPECT_THROW(accessor->getDiffs(zone_info.second + 42, 1231, 1234),
-                 NoDiffRecs);
+                 NoSuchSerial);
 
 }
 
-// Try to iterate through a valid set of differences
-TEST_F(SQLite3AccessorTest, validSequence) {
+// Try to iterate through a valid sets of differences
+TEST_F(SQLite3AccessorTest, diffIteratorSequences) {
+    std::string data[DatabaseAccessor::COLUMN_COUNT];
 
     // Our test zone is conveniently small, but not empty
     initAccessor(SQLITE_DBFILE_DIFFS, "IN");
-
     const std::pair<bool, int> zone_info(accessor->getZone("example.org."));
     ASSERT_TRUE(zone_info.first);
+
+
+    // Check the difference sequence 1230-1231 (two adjacent differences)
     // Get the iterator context
     DatabaseAccessor::IteratorContextPtr
-        context(accessor->getDiffs(zone_info.second, 1230, 1232));
-    ASSERT_NE(DatabaseAccessor::IteratorContextPtr(), context);
+        context1(accessor->getDiffs(zone_info.second, 1230, 1231));
+    ASSERT_NE(DatabaseAccessor::IteratorContextPtr(), context1);
 
-    std::string data[DatabaseAccessor::COLUMN_COUNT];
+    // Change: 1230-1231
+    checkRR(context1, "example.org.", "1800", "SOA",
+            "ns1.example.org. admin.example.org. 1230 3600 1800 2419200 7200");
+    checkRR(context1, "example.org.", "3600", "SOA",
+            "ns1.example.org. admin.example.org. 1231 3600 1800 2419200 7200");
 
-    // Check the records
-    EXPECT_TRUE(context->getNext(data));
-    EXPECT_EQ("SOA", data[DatabaseAccessor::TYPE_COLUMN]);
-    EXPECT_EQ("1800", data[DatabaseAccessor::TTL_COLUMN]);
-    EXPECT_EQ("ns1.example.org. admin.example.org. 1230 3600 1800 2419200 7200",
-        data[DatabaseAccessor::RDATA_COLUMN]);
-    EXPECT_EQ("example.org.", data[DatabaseAccessor::NAME_COLUMN]);
+    // Check there's no other and that calling it again after no records doesn't
+    // cause problems.
+    EXPECT_FALSE(context1->getNext(data));
+    EXPECT_FALSE(context1->getNext(data));
+
+
+    // Check that the difference sequence 1231-1233 (two separate difference
+    // sequences) is OK.
+    DatabaseAccessor::IteratorContextPtr
+        context2(accessor->getDiffs(zone_info.second, 1231, 1233));
+    ASSERT_NE(DatabaseAccessor::IteratorContextPtr(), context2);
+
+    // Change 1231-1232
+    checkRR(context2, "example.org.", "3600", "SOA",
+            "ns1.example.org. admin.example.org. 1231 3600 1800 2419200 7200");
+    checkRR(context2, "unused.example.org.", "3600", "A", "192.0.2.102");
+    checkRR(context2, "example.org.", "3600", "SOA",
+            "ns1.example.org. admin.example.org. 1232 3600 1800 2419200 7200");
+
+    // Change: 1232-1233
+    checkRR(context2, "example.org.", "3600", "SOA",
+            "ns1.example.org. admin.example.org. 1232 3600 1800 2419200 7200");
+    checkRR(context2, "example.org.", "3600", "SOA",
+            "ns1.example.org. admin.example.org. 1233 3600 1800 2419200 7200");
+    checkRR(context2, "sub.example.org.", "3600", "NS", "ns.sub.example.org.");
+    checkRR(context2, "ns.sub.example.org.", "3600", "A", "192.0.2.101");
+
+    // Check there's no other and that calling it again after no records doesn't
+    // cause problems.
+    EXPECT_FALSE(context2->getNext(data));
+    EXPECT_FALSE(context2->getNext(data));
+
+
+    // Check that the difference sequence 4294967280 to 1230 (serial number
+    // rollover) is OK
+    DatabaseAccessor::IteratorContextPtr
+        context3(accessor->getDiffs(zone_info.second, 4294967280U, 1230));
+    ASSERT_NE(DatabaseAccessor::IteratorContextPtr(), context3);
+
+    // Change 4294967280 to 1230.
+    checkRR(context3, "example.org.", "3600", "SOA",
+            "ns1.example.org. admin.example.org. 4294967280 3600 1800 2419200 7200");
+    checkRR(context3, "www.example.org.", "3600", "A", "192.0.2.31");
+    checkRR(context3, "example.org.", "1800", "SOA",
+            "ns1.example.org. admin.example.org. 1230 3600 1800 2419200 7200");
+    checkRR(context3, "www.example.org.", "3600", "A", "192.0.2.21");
+
+    EXPECT_FALSE(context3->getNext(data));
+    EXPECT_FALSE(context3->getNext(data));
+
+
+    // Check the difference sequence 1233-1231 (versions in wrong order).  This
+    // should give an empty difference set.
+    DatabaseAccessor::IteratorContextPtr
+        context4(accessor->getDiffs(zone_info.second, 1233, 1231));
+    ASSERT_NE(DatabaseAccessor::IteratorContextPtr(), context2);
+
+    EXPECT_FALSE(context4->getNext(data));
+    EXPECT_FALSE(context4->getNext(data));
 }
 
 TEST(SQLite3Open, getDBNameExample2) {
diff --git a/src/lib/datasrc/tests/testdata/diffs.sqlite3 b/src/lib/datasrc/tests/testdata/diffs.sqlite3
index 2095d4c..d3c9b3b 100644
Binary files a/src/lib/datasrc/tests/testdata/diffs.sqlite3 and b/src/lib/datasrc/tests/testdata/diffs.sqlite3 differ
diff --git a/src/lib/datasrc/tests/testdata/diffs_table.sql b/src/lib/datasrc/tests/testdata/diffs_table.sql
index 39c913a..336d79a 100644
--- a/src/lib/datasrc/tests/testdata/diffs_table.sql
+++ b/src/lib/datasrc/tests/testdata/diffs_table.sql
@@ -29,7 +29,8 @@
 -- the ".quit" on the command line then  getting executed to exit SQLite3.
 
 -- Create the diffs table
-CREATE TABLE diffs (id INTEGER PRIMARY KEY AUTOINCREMENT,
+DROP TABLE diffs;
+CREATE TABLE diffs (id INTEGER PRIMARY KEY,
                     zone_id INTEGER NOT NULL,
                     version INTEGER NOT NULL,
                     operation INTEGER NOT NULL,
@@ -51,7 +52,7 @@ INSERT INTO diffs(zone_id, version, operation, name, rrtype, ttl, rdata)
 
 -- Records added in version 1230 of the zone
 INSERT INTO diffs(zone_id, version, operation, name, rrtype, ttl, rdata)
-    VALUES(1, 1230, 1, "example.org.", "SOA", 3600,
+    VALUES(1, 1230, 1, "example.org.", "SOA", 1800,
            "ns1.example.org. admin.example.org. 1230 3600 1800 2419200 7200");
 INSERT INTO diffs(zone_id, version, operation, name, rrtype, ttl, rdata)
     VALUES(1, 1230, 1, "www.example.org.", "A", 3600, "192.0.2.21");




More information about the bind10-changes mailing list