{
SSqlStatement::row_t row;
- if (!d_query_stmt->hasNextRow()) {
+ for(;;) {
+ if (!d_query_stmt->hasNextRow()) {
+ try {
+ d_query_stmt->reset();
+ } catch(SSqlException &e) {
+ throw DBException("GSQLBackend comment get: "+e.txtReason());
+ }
+ d_query_stmt = NULL;
+ return false;
+ }
+
try {
- d_query_stmt->reset();
+ d_query_stmt->nextRow(row);
+ ASSERT_ROW_COLUMNS(d_query_name, row, 6);
} catch(SSqlException &e) {
throw DBException("GSQLBackend comment get: "+e.txtReason());
}
- d_query_stmt = NULL;
- return false;
- }
-
- try {
- d_query_stmt->nextRow(row);
- ASSERT_ROW_COLUMNS(d_query_name, row, 6);
- } catch(SSqlException &e) {
- throw DBException("GSQLBackend comment get: "+e.txtReason());
+ try {
+ extractComment(row, comment);
+ } catch (...) {
+ continue;
+ }
+ return true;
}
- // domain_id,name,type,modified_at,account,comment
- extractComment(row, comment);
- return true;
}
void GSQLBackend::feedComment(const Comment& comment)
try {
d_InsertCommentQuery_stmt->
bind("domain_id",comment.domain_id)->
- bind("qname",toLower(comment.qname))->
+ bind("qname",comment.qname)->
bind("qtype",comment.qtype.getName())->
bind("modified_at",comment.modified_at)->
bind("account",comment.account)->
bool GSQLBackend::searchRecords(const string &pattern, int maxResults, vector<DNSResourceRecord>& result)
{
+ d_qname.clear();
try {
string escaped_pattern = pattern2SQLPattern(pattern);
void GSQLBackend::extractComment(const SSqlStatement::row_t& row, Comment& comment)
{
- comment.domain_id = pdns_stou(row[0]);
- comment.qname = row[1];
- comment.qtype = row[2];
- comment.modified_at = pdns_stou(row[3]);
- comment.account = row[4];
- comment.content = row[5];
+ comment.domain_id = pdns_stou(row[0]);
+ comment.qname = DNSName(row[1]);
+ comment.qtype = row[2];
+ comment.modified_at = pdns_stou(row[3]);
+ comment.account = row[4];
+ comment.content = row[5];
}
bool GSQLBackend::isOurDomain(const DNSName *zone, int domain_id) {
di.backend->listComments(di.id);
while(di.backend->getComment(comment)) {
comments.push_back(Json::object {
- { "name", comment.qname },
+ { "name", comment.qname.toString() },
{ "type", comment.qtype.getName() },
{ "modified_at", (double)comment.modified_at },
{ "account", comment.account },
{
auto object = Json::object {
{ "object_type", "comment" },
- { "name", c.qname },
+ { "name", c.qname.toString() },
{ "content", c.content }
};
if ((val = zoneIdZone.find(c.domain_id)) != zoneIdZone.end()) {