From: Aki Tuomi Date: Wed, 5 Aug 2015 15:56:04 +0000 (+0300) Subject: Use extractComment for comments X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~57^2~2^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=512ad04f8dd48bc51dae64611ae3a29145095091;p=pdns Use extractComment for comments --- diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index 44768ffa7..df6e9beb2 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -1408,13 +1408,7 @@ bool GSQLBackend::getComment(Comment& comment) throw PDNSException("GSQLBackend comment get: "+e.txtReason()); } // domain_id,name,type,modified_at,account,comment - comment.domain_id = atol(row[0].c_str()); - comment.qname = row[1]; - comment.qtype = row[2]; - comment.modified_at = atol(row[3].c_str()); - comment.account = row[4]; - comment.content = row[5]; - + extractComment(row, comment); return true; } @@ -1539,12 +1533,7 @@ bool GSQLBackend::searchComments(const string &pattern, int maxResults, vectornextRow(row); Comment comment; - comment.domain_id = atol(row[0].c_str()); - comment.qname = row[1]; - comment.qtype = row[2]; - comment.modified_at = atol(row[3].c_str()); - comment.account = row[4]; - comment.content = row[5]; + extractComment(row, comment); result.push_back(comment); } @@ -1588,6 +1577,16 @@ void GSQLBackend::extractRecord(const SSqlStatement::row_t& row, DNSResourceReco r.domain_id=atoi(row[4].c_str()); } +void GSQLBackend::extractComment(const SSqlStatement::row_t& row, Comment& comment) +{ + comment.domain_id = atol(row[0].c_str()); + comment.qname = row[1]; + comment.qtype = row[2]; + comment.modified_at = atol(row[3].c_str()); + comment.account = row[4]; + comment.content = row[5]; +} + SSqlStatement::~SSqlStatement() { // make sure vtable won't break } diff --git a/pdns/backends/gsql/gsqlbackend.hh b/pdns/backends/gsql/gsqlbackend.hh index 4cc93472c..cb0067440 100644 --- a/pdns/backends/gsql/gsqlbackend.hh +++ b/pdns/backends/gsql/gsqlbackend.hh @@ -227,6 +227,7 @@ public: protected: string pattern2SQLPattern(const string& pattern); void extractRecord(const SSqlStatement::row_t& row, DNSResourceRecord& rr); + void extractComment(const SSqlStatement::row_t& row, Comment& c); private: DNSName d_qname;