]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
GSQLBackend::searchRecords: log search pattern in error
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 15 Mar 2019 11:28:23 +0000 (12:28 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Fri, 15 Mar 2019 13:34:48 +0000 (14:34 +0100)
pdns/backends/gsql/gsqlbackend.cc

index e77bbd70fa17e32d7267de57382f760b5e30a979..da3400f50872f3020a3cfd3b31d167a1311428cc 100644 (file)
@@ -1623,9 +1623,8 @@ string GSQLBackend::pattern2SQLPattern(const string &pattern)
 bool GSQLBackend::searchRecords(const string &pattern, int maxResults, vector<DNSResourceRecord>& result)
 {
   d_qname.clear();
+  string escaped_pattern = pattern2SQLPattern(pattern);
   try {
-    string escaped_pattern = pattern2SQLPattern(pattern);
-
     reconnectIfNeeded();
 
     d_SearchRecordsQuery_stmt->
@@ -1653,7 +1652,7 @@ bool GSQLBackend::searchRecords(const string &pattern, int maxResults, vector<DN
     return true;
   }
   catch (SSqlException &e) {
-    throw PDNSException("GSQLBackend unable to execute query: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to search for records with pattern '" + pattern + "' (escaped pattern '" + escaped_pattern + "'): "+e.txtReason());
   }
 
   return false;