Commit cfd1d9e1 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[1062] some minor editorial changes, mostly just folding long lines.

parent 5951ef6f
......@@ -179,15 +179,16 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
try {
const isc::dns::RRType cur_type(columns[DatabaseConnection::TYPE_COLUMN]);
const isc::dns::RRTTL cur_ttl(columns[DatabaseConnection::TTL_COLUMN]);
// Ths sigtype column was an optimization for finding the relevant
// RRSIG RRs for a lookup. Currently this column is not used in this
// revised datasource implementation. We should either start using it
// again, or remove it from use completely (i.e. also remove it from
// the schema and the backend implementation).
// Note that because we don't use it now, we also won't notice it if
// the value is wrong (i.e. if the sigtype column contains an rrtype
// that is different from the actual value of the 'type covered' field
// in the RRSIG Rdata).
// Ths sigtype column was an optimization for finding the
// relevant RRSIG RRs for a lookup. Currently this column is
// not used in this revised datasource implementation. We
// should either start using it again, or remove it from use
// completely (i.e. also remove it from the schema and the
// backend implementation).
// Note that because we don't use it now, we also won't notice
// it if the value is wrong (i.e. if the sigtype column
// contains an rrtype that is different from the actual value
// of the 'type covered' field in the RRSIG Rdata).
//cur_sigtype(columns[SIGTYPE_COLUMN]);
if (cur_type == type) {
......@@ -199,7 +200,8 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
addOrCreate(result_rrset, name, getClass(), cur_type,
cur_ttl, columns[DatabaseConnection::RDATA_COLUMN]);
} else if (cur_type == isc::dns::RRType::CNAME()) {
// There should be no other data, so result_rrset should be empty.
// There should be no other data, so result_rrset should
// be empty.
if (result_rrset) {
isc_throw(DataSourceError, "CNAME found but it is not "
"the only record for " + name.toText());
......@@ -211,9 +213,10 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
// If we get signatures before we get the actual data, we
// can't know which ones to keep and which to drop...
// So we keep a separate store of any signature that may be
// relevant and add them to the final RRset when we are done.
// A possible optimization here is to not store them for types
// we are certain we don't need
// relevant and add them to the final RRset when we are
// done.
// A possible optimization here is to not store them for
// types we are certain we don't need
sig_store.addSig(isc::dns::rdata::createRdata(cur_type,
getClass(),
columns[DatabaseConnection::RDATA_COLUMN]));
......
......@@ -329,6 +329,7 @@ SQLite3Connection::searchForRecords(int zone_id, const std::string& name) {
"Error in sqlite3_bind_int() for zone_id " <<
zone_id << ", sqlite3 result code: " << result);
}
// use transient since name is a ref and may disappear
result = sqlite3_bind_text(dbparameters_->q_any_, 2, name.c_str(), -1,
SQLITE_TRANSIENT);
......@@ -337,7 +338,7 @@ SQLite3Connection::searchForRecords(int zone_id, const std::string& name) {
"Error in sqlite3_bind_text() for name " <<
name << ", sqlite3 result code: " << result);
}
};
}
namespace {
// This helper function converts from the unsigned char* type (used by
......@@ -382,8 +383,9 @@ SQLite3Connection::getNextRecord(std::string columns[], size_t column_count) {
resetSearch();
isc_throw(DataSourceError,
"Unexpected failure in sqlite3_step (sqlite result code " << rc << ")");
} catch (std::bad_alloc) {
isc_throw(DataSourceError, "bad_alloc in Sqlite3Connection::getNextRecord");
} catch (const std::bad_alloc&) {
isc_throw(DataSourceError,
"bad_alloc in Sqlite3Connection::getNextRecord");
}
// Compilers might not realize isc_throw always throws
return (false);
......
......@@ -51,7 +51,7 @@ public:
search_running_ = true;
// 'hardcoded' name to trigger exceptions (for testing
// the error handling of find() (the other on is below in
// the error handling of find() (the other on is below in
// if the name is "exceptiononsearch" it'll raise an exception here
if (name == "dsexception.in.search.") {
isc_throw(DataSourceError, "datasource exception on search");
......
......@@ -127,8 +127,7 @@ TEST_F(SQLite3Conn, getRecords) {
std::string columns[column_count];
// without search, getNext() should return false
EXPECT_FALSE(conn->getNextRecord(columns,
column_count));
EXPECT_FALSE(conn->getNextRecord(columns, column_count));
checkRecordRow(columns, "", "", "", "");
conn->searchForRecords(zone_id, "foo.bar.");
......
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