- `info-zone-query`: Called to retrieve (nearly) all information for a domain.
- `insert-record-query`: Called during incoming AXFR.
-- `insert-record-order-query`: Add a new record for a domain, including the ordername.
- `update-account-query`: Set the account for a domain.
- `delete-names-query`: Called to delete all records of a certain name.
- `delete-rrset-query`: Called to delete an RRset based on domain\_id, name and type.
declare(suffix,"insert-zone-query","", "insert into domains (type,name) values('NATIVE',?)");
declare(suffix,"insert-slave-query","", "insert into domains (type,name,master,account) values('SLAVE',?,?,?)");
- declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,auth) values (?,?,?,?,?,?,?,?)");
- declare(suffix, "insert-record-order-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,?,?)");
+ declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,?,?)");
declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth) values (null,?,0,?,?,?)");
declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select ordername from records where domain_id=? and disabled=0 and ordername is not null order by 1 asc limit 1");
declare(suffix,"insert-zone-query","", "insert into domains (type,name) values('NATIVE',?)");
declare(suffix,"insert-slave-query","", "insert into domains (type,name,master,account) values('SLAVE',?,?,?)");
- declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,auth) values (?,?,?,?,?,?,?,?)");
- declare(suffix, "insert-record-order-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,convert(varbinary(255),?),?)");
+ declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (?,?,?,?,?,?,?,convert(varbinary(255),?),?)");
declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth) values (null,?,0,?,convert(varbinary(255),?),?)");
declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select top 1 convert(varchar(255), ordername) from records where domain_id=? and disabled=0 and ordername is not null order by 1 asc");
declare(suffix, "supermaster-name-to-ips", "", "select ip,account from supermasters where nameserver=:nameserver and account=:account");
declare(suffix, "insert-zone-query", "", "insert into domains (id,type,name) values(domains_id_sequence.nextval,'NATIVE',:domain)");
declare(suffix, "insert-slave-query", "", "insert into domains (id,type,name,master,account) values(domains_id_sequence.nextval,'SLAVE',:domain,:masters,:account)");
- declare(suffix, "insert-record-query", "", "insert into records (id,content,ttl,prio,type,domain_id,disabled,name,auth) values (records_id_sequence.nextval,:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:auth)");
- declare(suffix, "insert-record-order-query", "", "insert into records (id,content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (records_id_sequence.nextval,:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername || ' ',:auth)");
+ declare(suffix, "insert-record-query", "", "insert into records (id,content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (records_id_sequence.nextval,:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername || ' ',:auth)");
declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (id,type,domain_id,disabled,name,ordername,auth) values (records_id_sequence.nextval,null,:domain_id,0,:qname,:ordername,:auth)");
declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select * FROM (select trim(ordername) from records where disabled=0 and domain_id=:domain_id and ordername is not null order by ordername asc) where rownum=1");
declare(suffix,"insert-zone-query","", "insert into domains (type,name) values('NATIVE',$1)");
declare(suffix,"insert-slave-query","", "insert into domains (type,name,master,account) values('SLAVE',$1,$2,$3)");
- declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,auth) values ($1,$2,$3,$4,$5,$6,$7,$8)");
- declare(suffix, "insert-record-order-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values ($1,$2,$3,$4,$5,$6,$7,$8,$9)");
+ declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values ($1,$2,$3,$4,$5,$6,$7,$8,$9)");
declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth) values (null,$1,false,$2,$3,$4)");
declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, last", "select ordername from records where disabled=false and domain_id=$1 and ordername is not null order by 1 using ~<~ limit 1");
declare(suffix, "insert-zone-query", "", "insert into domains (type,name) values('NATIVE',:domain)");
declare(suffix, "insert-slave-query", "", "insert into domains (type,name,master,account) values('SLAVE',:domain,:masters,:account)");
- declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,auth) values (:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:auth)");
- declare(suffix, "insert-record-order-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername,:auth)");
+ declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values (:content,:ttl,:priority,:qtype,:domain_id,:disabled,:qname,:ordername,:auth)");
declare(suffix, "insert-empty-non-terminal-order-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,disabled,name,ordername,auth) values (null,:domain_id,0,:qname,:ordername,:auth)");
declare(suffix, "get-order-first-query", "DNSSEC Ordering Query, first", "select ordername from records where disabled=0 and domain_id=:domain_id and ordername is not null order by 1 asc limit 1");
d_DeleteCommentRRsetQuery = getArg("delete-comment-rrset-query");
d_DeleteCommentsQuery = getArg("delete-comments-query");
- d_InsertRecordOrderQuery=getArg("insert-record-order-query");
-
d_firstOrderQuery = getArg("get-order-first-query");
d_beforeOrderQuery = getArg("get-order-before-query");
d_afterOrderQuery = getArg("get-order-after-query");
d_InsertZoneQuery_stmt = NULL;
d_InsertSlaveZoneQuery_stmt = NULL;
d_InsertRecordQuery_stmt = NULL;
- d_InsertRecordOrderQuery_stmt = NULL;
d_InsertEmptyNonTerminalOrderQuery_stmt = NULL;
d_UpdateMasterOfZoneQuery_stmt = NULL;
d_UpdateKindOfZoneQuery_stmt = NULL;
}
try {
- if(d_dnssecQueries && ordername)
- {
- d_InsertRecordOrderQuery_stmt->
- bind("content",content)->
- bind("ttl",r.ttl)->
- bind("priority",prio)->
- bind("qtype",r.qtype.getName())->
- bind("domain_id",r.domain_id)->
- bind("disabled",r.disabled)->
- bind("qname",r.qname); // FIXME400 lowercase?
- if (ordername == NULL)
- d_InsertRecordOrderQuery_stmt->bindNull("ordername");
- else
- d_InsertRecordOrderQuery_stmt->bind("ordername",*ordername);
- d_InsertRecordOrderQuery_stmt->
- bind("auth",r.auth)->
- execute()->
- reset();
- }
+ d_InsertRecordQuery_stmt->
+ bind("content",content)->
+ bind("ttl",r.ttl)->
+ bind("priority",prio)->
+ bind("qtype",r.qtype.getName())->
+ bind("domain_id",r.domain_id)->
+ bind("disabled",r.disabled)->
+ bind("qname",stripDot(r.qname.toString())); // FIXME400 lowercase?
+
+ if (ordername == NULL)
+ d_InsertRecordQuery_stmt->bindNull("ordername");
else
- {
- d_InsertRecordQuery_stmt->
- bind("content",content)->
- bind("ttl",r.ttl)->
- bind("priority",prio)->
- bind("qtype",r.qtype.getName())->
- bind("domain_id",r.domain_id)->
- bind("disabled",r.disabled)->
- bind("qname",r.qname)->
- bind("auth", (r.auth || !d_dnssecQueries))->
- execute()->
- reset();
- }
+ d_InsertRecordQuery_stmt->bind("ordername",*ordername);
+
+ if (d_dnssecQueries)
+ d_InsertRecordQuery_stmt->bind("auth", r.auth);
+ else
+ d_InsertRecordQuery_stmt->bind("auth", true);
+
+ d_InsertRecordQuery_stmt->
+ execute()->
+ reset();
}
catch (SSqlException &e) {
throw DBException("GSQLBackend unable to feed record: "+e.txtReason());
d_GetSuperMasterIPs_stmt = d_db->prepare(d_GetSuperMasterIPs, 2);
d_InsertZoneQuery_stmt = d_db->prepare(d_InsertZoneQuery, 1);
d_InsertSlaveZoneQuery_stmt = d_db->prepare(d_InsertSlaveZoneQuery, 3);
- d_InsertRecordQuery_stmt = d_db->prepare(d_InsertRecordQuery, 8);
- d_InsertRecordOrderQuery_stmt = d_db->prepare(d_InsertRecordOrderQuery, 9);
+ d_InsertRecordQuery_stmt = d_db->prepare(d_InsertRecordQuery, 9);
d_InsertEmptyNonTerminalOrderQuery_stmt = d_db->prepare(d_InsertEmptyNonTerminalOrderQuery, 4);
d_UpdateMasterOfZoneQuery_stmt = d_db->prepare(d_UpdateMasterOfZoneQuery, 2);
d_UpdateKindOfZoneQuery_stmt = d_db->prepare(d_UpdateKindOfZoneQuery, 2);
release(&d_InsertZoneQuery_stmt);
release(&d_InsertSlaveZoneQuery_stmt);
release(&d_InsertRecordQuery_stmt);
- release(&d_InsertRecordOrderQuery_stmt);
release(&d_InsertEmptyNonTerminalOrderQuery_stmt);
release(&d_UpdateMasterOfZoneQuery_stmt);
release(&d_UpdateKindOfZoneQuery_stmt);
string d_InsertZoneQuery;
string d_InsertSlaveZoneQuery;
string d_InsertRecordQuery;
- string d_InsertRecordOrderQuery;
string d_InsertEmptyNonTerminalOrderQuery;
string d_UpdateMasterOfZoneQuery;
string d_UpdateKindOfZoneQuery;
SSqlStatement* d_InsertZoneQuery_stmt;
SSqlStatement* d_InsertSlaveZoneQuery_stmt;
SSqlStatement* d_InsertRecordQuery_stmt;
- SSqlStatement* d_InsertRecordOrderQuery_stmt;
SSqlStatement* d_InsertEmptyNonTerminalOrderQuery_stmt;
SSqlStatement* d_UpdateMasterOfZoneQuery_stmt;
SSqlStatement* d_UpdateKindOfZoneQuery_stmt;
#else
if (sqlite3_prepare(d_db->db(), query.c_str(), -1, &d_stmt, &pTail ) != SQLITE_OK)
#endif
- throw SSqlException(string("Unable to compile SQLite statement : ")+sqlite3_errmsg(d_db->db()));
+ throw SSqlException(string("Unable to compile SQLite statement : '")+query+"': "+sqlite3_errmsg(d_db->db()));
if (pTail && strlen(pTail)>0)
L<<Logger::Warning<<"Sqlite3 command partially processed. Unprocessed part: "<<pTail<<endl;
}