declare(suffix, "wildcard-any-id-query", "Wildcard ANY with ID query", record_query+" and name like '%s' and domain_id='%d'");
declare(suffix, "list-query", "AXFR query", record_query+" and domain_id='%d'");
+ declare(suffix, "list-subzone-query", "Subzone listing", record_query+" and (name='%s' OR name like '%s') and domain_id='%d'");
declare(suffix,"remove-empty-non-terminals-from-zone-query", "remove all empty non-terminals from zone", "delete from records where domain_id='%d' and type is null");
declare(suffix,"insert-empty-non-terminal-query", "insert empty non-terminal in zone", "insert into records (domain_id,name,type) values ('%d','%s',null)");
declare(suffix, "wildcard-any-id-query-auth", "Wildcard ANY with ID query", record_auth_query+" and name like '%s' and domain_id='%d'");
declare(suffix, "list-query-auth", "AXFR query", record_auth_query+" and domain_id='%d' order by name, type");
+ declare(suffix, "list-subzone-query-auth", "Subzone listing", record_auth_query+" and (name='%s' OR name like '%s') and domain_id='%d'");
declare(suffix,"insert-empty-non-terminal-query-auth", "insert empty non-terminal in zone", "insert into records (domain_id,name,type,auth) values ('%d','%s',null,'1')");
declare(suffix, "wildcard-any-id-query", "Wildcard ANY with ID query", record_query+" and name like '%s' and domain_id='%d'");
declare(suffix, "list-query", "AXFR query", record_query+" and domain_id='%d'");
+ declare(suffix, "list-subzone-query", "Subzone listing", record_query+" and (name='%s' OR name like '%s') and domain_id='%d'");
declare(suffix,"remove-empty-non-terminals-from-zone-query", "remove all empty non-terminals from zone", "delete from records where domain_id='%d' and type is null");
declare(suffix,"insert-empty-non-terminal-query", "insert empty non-terminal in zone", "insert into records (id,domain_id,name,type) values (records_id_sequence.nextval,'%d','%s',null)");
declare(suffix, "wildcard-any-query-auth", "Wildcard ANY query", record_auth_query+" and name like '%s'");
declare(suffix, "wildcard-any-id-query-auth", "Wildcard ANY with ID query", record_auth_query+" and name like '%s' and domain_id='%d'");
- declare(suffix, "list-query-auth", "AXFR query", record_auth_query+" and domain_id='%d' order by name, type");
+ declare(suffix, "list-query-auth", "AXFR query", record_auth_query+" and domain_id='%d' order by name, type");
+ declare(suffix, "list-subzone-query-auth", "Subzone listing", record_auth_query+" and (name='%s' OR name like '%s') and domain_id='%d'");
declare(suffix,"insert-empty-non-terminal-query-auth", "insert empty non-terminal in zone", "insert into records (id,domain_id,name,type,auth) values (records_id_sequence.nextval,'%d','%s',null,'1')");
declare(suffix, "wildcard-any-id-query", "Wildcard ANY with ID query", record_query+" and name like E'%s' and domain_id='%d'");
declare(suffix, "list-query", "AXFR query", record_query+" and domain_id='%d'");
+ declare(suffix, "list-subzone-query", "Subzone listing", record_query+" and (name=E'%s' OR name like E'%s') and domain_id='%d'");
declare(suffix,"remove-empty-non-terminals-from-zone-query", "remove all empty non-terminals from zone", "delete from records where domain_id='%d' and type is null");
declare(suffix,"insert-empty-non-terminal-query", "insert empty non-terminal in zone", "insert into records (domain_id,name,type) values ('%d','%s',null)");
declare(suffix, "wildcard-any-id-query-auth", "Wildcard ANY with ID query", record_auth_query+" and name like E'%s' and domain_id='%d'");
declare(suffix, "list-query-auth", "AXFR query", record_auth_query+" and domain_id='%d' order by name, type");
+ declare(suffix, "list-subzone-query-auth", "Subzone listing", record_auth_query+" and (name=E'%s' OR name like E'%s') and domain_id='%d'");
declare(suffix,"insert-empty-non-terminal-query-auth", "insert empty non-terminal in zone", "insert into records (domain_id,name,type,auth) values ('%d','%s',null,true)");
declare(suffix, "wildcard-any-id-query", "Wildcard ANY with ID query", record_query+" and name like '%s' and domain_id=%d");
declare(suffix, "list-query", "AXFR query", record_query+" and domain_id=%d");
+ declare(suffix, "list-subzone-query", "Subzone listing", record_query+" and (name='%s' OR name like '%s') and domain_id=%d");
declare(suffix,"remove-empty-non-terminals-from-zone-query", "remove all empty non-terminals from zone", "delete from records where domain_id='%d' and type is null");
declare(suffix,"insert-empty-non-terminal-query", "insert empty non-terminal in zone", "insert into records (domain_id,name,type) values ('%d','%s',null)");
declare(suffix, "wildcard-any-id-query-auth", "Wildcard ANY with ID query", record_auth_query+" and name like '%s' and domain_id='%d'");
declare(suffix, "list-query-auth", "AXFR query", record_auth_query+" and domain_id='%d' order by name, type");
+ declare(suffix, "list-subzone-query-auth", "Subzone listing", record_auth_query+" and (name='%s' OR name like '%s') and domain_id=%d");
declare(suffix,"insert-empty-non-terminal-query-auth", "insert empty non-terminal in zone", "insert into records (domain_id,name,type,auth) values ('%d','%s',null,'1')");
d_wildCardANYIDQuery=getArg("wildcard-any-id-query"+authswitch);
d_listQuery=getArg("list-query"+authswitch);
+ d_listSubZoneQuery=getArg("list-subzone-query"+authswitch);
d_MasterOfDomainsZoneQuery=getArg("master-zone-query");
d_InfoOfDomainsZoneQuery=getArg("info-zone-query");
bool GSQLBackend::listSubZone(const string &zone, int domain_id) {
string wildzone = "%." + zone;
- string listSubZone = "select content,ttl,prio,type,domain_id,name from records where (name='%s' OR name like '%s') and domain_id=%d";
- if (d_dnssecQueries)
- listSubZone = "select content,ttl,prio,type,domain_id,name,auth from records where (name='%s' OR name like '%s') and domain_id=%d";
- string output = (boost::format(listSubZone) % sqlEscape(zone) % sqlEscape(wildzone) % domain_id).str();
+ string query = (boost::format(d_listSubZoneQuery)
+ % sqlEscape(zone)
+ % sqlEscape(wildzone)
+ % domain_id
+ ).str();
try {
- d_db->doQuery(output.c_str());
+ d_db->doQuery(query);
}
catch(SSqlException &e) {
throw PDNSException("GSQLBackend listSubZone query: "+e.txtReason());
string d_noWildCardANYIDQuery;
string d_wildCardANYIDQuery;
string d_listQuery;
+ string d_listSubZoneQuery;
string d_logprefix;
string d_MasterOfDomainsZoneQuery;