Beatnik_Driver_pdnsgsql
extends Beatnik_Driver
in package
The Beatnik_Driver_sql class implements a SQL driver for managing DNS records in the PowerDNS generic SQL driver. The PowerDNS generic SQL driver aims to support MySQL, PostgreSQL, SQLite and Oracle. This driver attempts to do the same as long as the default queries are used.
Copyright 2008-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Tags
Table of Contents
- $_connected : bool
- Boolean indicating whether or not we're connected to the SQL server.
- $_db : DB
- Handle for the current database connection.
- $_params : array<string|int, mixed>
- Hash containing connection parameters.
- $_write_db : DB
- Handle for the current database connection, used for writing. Defaults to the same handle as $_db if a separate write database is not required.
- __construct() : mixed
- Constructs a new Beatnik DB driver object.
- _connect() : bool
- Attempts to open a persistent connection to the SQL server.
- _deleteRecord() : bool
- Delete record from backend
- _disconnect() : bool
- Disconnects from the SQL server and cleans up the connection.
- _getDomains() : array<string|int, mixed>
- Gets all zones
- _saveRecord() : bool
- Saves a new or edited record to the DNS backend
- Beatnik_Driver() : mixed
- deleteRecord() : bool
- Delete record from backend
- factory() : mixed
- Attempts to return a concrete Beatnik_Driver instance based on $driver.
- getDomain() : array<string|int, mixed>
- Return SOA for a single domain
- getDomains() : array<string|int, mixed>
- Gets domains from driver for which the user has the specified permission.
- getRecDriverFields() : array<string|int, mixed>
- Get any fields available specifically in this driver by record type.
- getRecDriverTypes() : array<string|int, mixed>
- Get any record types available specifically in this driver.
- getRecord() : array<string|int, mixed>
- Gets a specific record from the backend. This method may be overridden in specific backend drivers if there is a performance or other benefit for doing so.
- getRecords() : array<string|int, mixed>
- Gets all records associated with the given zone
- recordExists() : bool
- Try to determinate if the autogenerated record already exits. This method may be overridden in the backend driver for performance or other reasons.
- saveRecord() : mixed
- Saves a record fo the configured driver and checks/sets needCommit() Also first checks to ensure permission to save record is available.
Properties
$_connected
Boolean indicating whether or not we're connected to the SQL server.
public
bool
$_connected
= alse
$_db
Handle for the current database connection.
public
DB
$_db
$_params
Hash containing connection parameters.
public
array<string|int, mixed>
$_params
= array()
$_write_db
Handle for the current database connection, used for writing. Defaults to the same handle as $_db if a separate write database is not required.
public
DB
$_write_db
Methods
__construct()
Constructs a new Beatnik DB driver object.
public
__construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $params : array<string|int, mixed> = array()
-
A hash containing connection parameters.
Return values
mixed —_connect()
Attempts to open a persistent connection to the SQL server.
public
_connect() : bool
Tags
Return values
bool —True on success.
_deleteRecord()
Delete record from backend
public
_deleteRecord(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
-
Reference to array of record data to be deleted
Tags
Return values
bool —true on success, PEAR::Error on error
_disconnect()
Disconnects from the SQL server and cleans up the connection.
public
_disconnect() : bool
Tags
Return values
bool —True on success, false on failure.
_getDomains()
Gets all zones
public
_getDomains() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Array with zone records numerically indexed
_saveRecord()
Saves a new or edited record to the DNS backend
public
_saveRecord(array<string|int, mixed> $info) : bool
Parameters
- $info : array<string|int, mixed>
-
Array of record data
Tags
Return values
bool —true on success
Beatnik_Driver()
public
Beatnik_Driver([mixed $params = array() ]) : mixed
Parameters
- $params : mixed = array()
Return values
mixed —deleteRecord()
Delete record from backend
public
deleteRecord(array<string|int, mixed> &$info) : bool
Parameters
- $info : array<string|int, mixed>
-
Reference to array of record information for deletion
Tags
Return values
bool —true on success
factory()
Attempts to return a concrete Beatnik_Driver instance based on $driver.
public
factory([string $driver = null ][, array<string|int, mixed> $params = null ]) : mixed
Parameters
- $driver : string = null
-
The type of the concrete Beatnik_Driver subclass to return. The class name is based on the storage driver ($driver). The code is dynamically included.
- $params : array<string|int, mixed> = null
-
(optional) A hash containing any additional configuration or connection parameters a subclass might need.
Return values
mixed —The newly created concrete Beatnik_Driver instance, or false on an error.
getDomain()
Return SOA for a single domain
public
getDomain(mixed $domainname) : array<string|int, mixed>
Parameters
- $domainname : mixed
Return values
array<string|int, mixed> —Domain SOA
getDomains()
Gets domains from driver for which the user has the specified permission.
public
getDomains([int $perms = Horde_Perms::SHOW ]) : array<string|int, mixed>
Parameters
- $perms : int = Horde_Perms::SHOW
-
Permissions filter for domain result set
Return values
array<string|int, mixed> —Possibly empty array of domain information
getRecDriverFields()
Get any fields available specifically in this driver by record type.
public
getRecDriverFields(string $type) : array<string|int, mixed>
Parameters
- $type : string
-
Record type for which fields should be returned
Return values
array<string|int, mixed> —Fields specific to this driver
getRecDriverTypes()
Get any record types available specifically in this driver.
public
getRecDriverTypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —Records available only to this driver
getRecord()
Gets a specific record from the backend. This method may be overridden in specific backend drivers if there is a performance or other benefit for doing so.
public
getRecord(mixed $id) : array<string|int, mixed>
Parameters
- $id : mixed
Return values
array<string|int, mixed> —Array of type and record information
getRecords()
Gets all records associated with the given zone
public
getRecords(string $domain) : array<string|int, mixed>
Parameters
- $domain : string
-
Retrieve records for this domain
Return values
array<string|int, mixed> —Array with zone records
recordExists()
Try to determinate if the autogenerated record already exits. This method may be overridden in the backend driver for performance or other reasons.
public
recordExists(array<string|int, mixed> $record, mixed $rectype) : bool
Parameters
- $record : array<string|int, mixed>
-
record to check
- $rectype : mixed
Return values
bool —if records exits or or not
saveRecord()
Saves a record fo the configured driver and checks/sets needCommit() Also first checks to ensure permission to save record is available.
public
saveRecord(array<string|int, mixed> &$info) : mixed
Parameters
- $info : array<string|int, mixed>
-
Data to be passed to backend driver for storage
Return values
mixed —True on success, PEAR::Error on error