Extends PDO class
Sets database connections to automatically use utf-8 and provides some useful debugging behaviour, lazy shortcuts etc
| package | dstruct_common |
|---|
__construct(string $dbtype, string $host, string $uname, string $pwd, string $schema, integer $port, string $charset) : object
Any errors setting up the connection etc are echoed to the browser!
| todo | Check $dbtype has an available driver? |
|---|
stringDatabase type to access e.g. MySQL, SQLITE etc
stringHostname or IP address
stringDatabase user name
stringDatabase password
stringDatabase schema to connect to
integerPort to attempt connection on
stringCharacterset to use
objectPDO database objectgetNewStatementCount() : integer
Mainly useful for optimisation.
integergetQueryCount() : integer
Mainly useful for optimisation.
integerprepare(integer $statement, array $driver_options)
See PDO manual for usage.
integerSQL statement to prepare
arraySee PDO manual
query(string $query) : object
Development tool.
Should not be used in a production environment in general as using prepared statements is safer
and potentially faster (if statement is re-used). Remember to always escape any data which can
not be trusted with PDO::quote().
Increments db::$querycount
| see | \DB::queryNoOverload |
|---|
stringSQL string
objectqueryNoOverload(string $query) : object
PDO::query() is overloaded when using the query() function of this class, so this provides a way of accessing it without the overloaded code
stringSQL Statement
object$newstatements : \unknown
$querycount : integer
| see | \getQueryCount() |
|---|