From ece62fadcfe50967be6d782350416ecfa6adeba6 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Mon, 13 Jul 2015 10:55:45 +0200 Subject: [PATCH 1/2] godbc SQLite3 tests --- regression-tests/backends/common | 5 ++ .../backends/godbc_sqlite3-master | 81 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 regression-tests/backends/godbc_sqlite3-master diff --git a/regression-tests/backends/common b/regression-tests/backends/common index f24f955ee7d3..8ec1d20a805a 100644 --- a/regression-tests/backends/common +++ b/regression-tests/backends/common @@ -18,6 +18,11 @@ start_master () source ./backends/godbc_mssql-master ;; + godbc_sqlite3*) + [ -z $GODBC_SQLITE3_DSN ] && echo '$GODBC_SQLITE3_DSN must be set' >&2 && exit 1 + source ./backends/godbc_sqlite3-master + ;; + goracle*) source ./backends/goracle-master ;; diff --git a/regression-tests/backends/godbc_sqlite3-master b/regression-tests/backends/godbc_sqlite3-master new file mode 100644 index 000000000000..eed7562841cf --- /dev/null +++ b/regression-tests/backends/godbc_sqlite3-master @@ -0,0 +1,81 @@ +source ./backends/gsql-common +case $context in + godbc_sqlite3-nodnssec | godbc_sqlite3 | godbc_sqlite3-nsec3 | godbc_sqlite3-nsec3-optout | godbc_sqlite3-nsec3-narrow) + rm -f pdns.sqlite3 + sqlite3 pdns.sqlite3 < ../modules/gsqlite3backend/schema.sqlite3.sql + tosql gsqlite | sqlite3 pdns.sqlite3 + echo ANALYZE\; | sqlite3 pdns.sqlite3 + + cat > pdns-godbc_sqlite3.conf << __EOF__ +module-dir=./modules +launch=godbc +godbc-datasource=$GODBC_SQLITE3_DSN +godbc-dnssec=yes + +godbc-activate-domain-key-query=update cryptokeys set active=1 where domain_id=(select id from domains where name=:domain) and cryptokeys.id=:key_id +godbc-add-domain-key-query=insert into cryptokeys (domain_id, flags, active, content) select id, :flags,:active, :content from domains where name=:domain +godbc-any-id-query=SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and name=:qname and domain_id=:domain_id +godbc-any-query=SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and name=:qname +godbc-basic-query=SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and type=:qtype and name=:qname +godbc-clear-domain-all-keys-query=delete from cryptokeys where domain_id=(select id from domains where name=:domain) +godbc-clear-domain-all-metadata-query=delete from domainmetadata where domain_id=(select id from domains where name=:domain) +godbc-clear-domain-metadata-query=delete from domainmetadata where domain_id=(select id from domains where name=:domain) and domainmetadata.kind=:kind +godbc-deactivate-domain-key-query=update cryptokeys set active=0 where domain_id=(select id from domains where name=:domain) and cryptokeys.id=:key_id +godbc-delete-comment-rrset-query=DELETE FROM comments WHERE domain_id=:domain_id AND name=:qname AND type=:qtype +godbc-delete-comments-query=DELETE FROM comments WHERE domain_id=:domain_id +godbc-delete-domain-query=delete from domains where name=:domain +godbc-delete-empty-non-terminal-query=delete from records where domain_id=:domain_id and name=:qname and type is null +godbc-delete-names-query=delete from records where domain_id=:domain_id and name=:qname +godbc-delete-rrset-query=delete from records where domain_id=:domain_id and name=:qname and type=:qtype +godbc-delete-tsig-key-query=delete from tsigkeys where name=:key_name +godbc-delete-zone-query=delete from records where domain_id=:domain_id +godbc-get-all-domain-metadata-query=select kind,content from domains, domainmetadata where domainmetadata.domain_id=domains.id and name=:domain +godbc-get-all-domains-query=select domains.id, domains.name, records.content, domains.type, domains.master, domains.notified_serial, domains.last_check, domains.account from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name WHERE records.disabled=0 OR :include_disabled +godbc-get-domain-metadata-query=select content from domains, domainmetadata where domainmetadata.domain_id=domains.id and name=:domain and domainmetadata.kind=:kind +godbc-get-order-after-query=select min(ordername) from records where disabled=0 and ordername > :ordername and domain_id=:domain_id and ordername is not null +godbc-get-order-before-query=select ordername, name from records where disabled=0 and ordername <= :ordername and domain_id=:domain_id and ordername is not null order by 1 desc limit 1 +godbc-get-order-first-query=select ordername, name from records where disabled=0 and domain_id=:domain_id and ordername is not null order by 1 asc limit 1 +godbc-get-order-last-query=select ordername, name from records where disabled=0 and ordername != '' and domain_id=:domain_id and ordername is not null order by 1 desc limit 1 +godbc-get-tsig-key-query=select algorithm, secret from tsigkeys where name=:key_name +godbc-get-tsig-keys-query=select name,algorithm, secret from tsigkeys +godbc-id-query=SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and type=:qtype and name=:qname and domain_id=:domain_id +godbc-info-all-master-query=select id,name,master,last_check,notified_serial,type from domains where type='MASTER' +godbc-info-all-slaves-query=select id,name,master,last_check,type from domains where type='SLAVE' +godbc-info-zone-query=select id,name,master,last_check,notified_serial,type,account from domains where name=:domain +godbc-insert-comment-query=INSERT INTO comments (domain_id, name, type, modified_at, account, comment) VALUES (:domain_id, :qname, :qtype, :modified_at, :account, :content) +godbc-insert-empty-non-terminal-query=insert into records (domain_id,name,type,disabled,auth) values (:domain_id,:qname,null,0,'1') +godbc-insert-ent-order-query=insert into records (type,domain_id,disabled,name,ordername,auth) values (null,:domain_id,0,:qname,:ordername,:auth) +godbc-insert-ent-query=insert into records (type,domain_id,disabled,name,auth) values (null,:domain_id,0,:qname,:auth) +godbc-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) +godbc-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) +godbc-insert-slave-query=insert into domains (type,name,master,account) values('SLAVE',:domain,:masters,:account) +godbc-insert-zone-query=insert into domains (type,name) values('NATIVE',:domain) +godbc-list-comments-query=SELECT domain_id,name,type,modified_at,account,comment FROM comments WHERE domain_id=:domain_id +godbc-list-domain-keys-query=select cryptokeys.id, flags, active, content from domains, cryptokeys where cryptokeys.domain_id=domains.id and name=:domain +godbc-list-query=SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE (disabled=0 OR :include_disabled) and domain_id=:domain_id order by name, type +godbc-list-subzone-query=SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and (name=:zone OR name like :wildzone) and domain_id=:domain_id +godbc-master-zone-query=select master from domains where name=:domain and type='SLAVE' +godbc-nullify-ordername-and-auth-query=update records set ordername=NULL,auth=0 where name=:qname and type=:qtype and domain_id=:domain_id and disabled=0 +godbc-nullify-ordername-and-update-auth-query=update records set ordername=NULL,auth=:auth where domain_id=:domain_id and name=:qname and disabled=0 +godbc-remove-domain-key-query=delete from cryptokeys where domain_id=(select id from domains where name=:domain) and cryptokeys.id=:key_id +godbc-remove-empty-non-terminals-from-zone-query=delete from records where domain_id=:domain_id and type is null +godbc-set-auth-on-ds-record-query=update records set auth=1 where domain_id=:domain_id and name=:qname and type='DS' and disabled=0 +godbc-set-domain-metadata-query=insert into domainmetadata (domain_id, kind, content) select id, :kind, :content from domains where name=:domain +godbc-set-order-and-auth-query=update records set ordername=:ordername,auth=:auth where name=:qname and domain_id=:domain_id and disabled=0 +godbc-set-tsig-key-query=replace into tsigkeys (name,algorithm,secret) values(:key_name,:algorithm,:content) +godbc-supermaster-name-to-ips=select ip,account from supermasters where nameserver=:nameserver and account=:account +godbc-supermaster-query=select account from supermasters where ip=:ip and nameserver=:nameserver +godbc-update-account-query=update domains set account=:account where name=:domain +godbc-update-kind-query=update domains set type=:kind where name=:domain +godbc-update-lastcheck-query=update domains set last_check=:last_check where id=:domain_id +godbc-update-master-query=update domains set master=:master where name=:domain +godbc-update-serial-query=update domains set notified_serial=:serial where id=:domain_id +godbc-zone-lastchange-query=select max(change_date) from records where domain_id=:domain_id +__EOF__ + + gsql-master godbc_sqlite3 nodyndns + ;; + + *) + nocontext=yes +esac From 2268cfec3597e63e28167402ee84bee42a2d7604 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Mon, 13 Jul 2015 10:58:30 +0200 Subject: [PATCH 2/2] Extra docs wrt MSSQL --- docs/markdown/authoritative/backend-godbc.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/markdown/authoritative/backend-godbc.md b/docs/markdown/authoritative/backend-godbc.md index 0739f6c68be6..87c5a8a321b9 100644 --- a/docs/markdown/authoritative/backend-godbc.md +++ b/docs/markdown/authoritative/backend-godbc.md @@ -53,6 +53,9 @@ The user to connect to the datasource. The password to connect with the datasource. # Connecting to Microsoft SQL Server +**note**: In order to connect to Microsoft SQL Server, you will need at least +version 3.2.0 of UnixODBC. FreeDTS has been tested with versions 0.91 and 0.95. + Install the [FreeTDS](http://www.freetds.org/) driver for UnixODBC, either by compiling or getting it from our distribution's repository and configure your `/etc/odbcinst.ini` with the driver, e.g.: