3 class ezSQL_pdo_YOURLS extends ezSQL_pdo {
6 * Constructor - Overwrite original to use MySQL and handle custom port
10 function ezSQL_pdo_YOURLS( $dbuser='', $dbpassword='', $dbname='', $dbhost='localhost', $encoding='' ) {
11 $this->dbuser = $dbuser;
12 $this->dbpassword = $dbpassword;
13 $this->dbname = $dbname;
14 // Get custom port if any
15 if ( false !== strpos( $dbhost, ':' ) ) {
16 list( $dbhost, $dbport ) = explode( ':', $dbhost );
17 $dbhost = sprintf( '%1$s;port=%2$d', $dbhost, $dbport );
19 $this->dbhost = $dbhost;
20 $this->encoding = $encoding;
21 $dsn = 'mysql:host=' . $dbhost . ';dbname=' . $dbname ;
24 // Turn on track errors
25 ini_set('track_errors',1);
27 $this->connect( $dsn, $dbuser, $dbpassword );
32 * Return MySQL server version
36 function mysql_version() {
37 return ( $this->dbh->getAttribute(PDO::ATTR_SERVER_VERSION) );
43 * Added to the original function: logging of all queries
47 function query( $query ) {
49 // Keep history of all queries
50 $this->debug_log[] = $query;
53 return parent::query( $query );
59 * Actually not needed for PDO it seems, the function is there only for consistency with
64 function disconnect() {