function __construct($user, $pwd, $server, $dbname, $pfx = '', $debug = false) { Pluf::loadFunction('Pluf_DB_defaultTypecast'); $this->type_cast = Pluf_DB_defaultTypecast(); $this->debug('* MYSQL CONNECT'); $this->con_id = mysql_connect($server, $user, $pwd); $this->debug = $debug; $this->pfx = $pfx; if (!$this->con_id) { throw new Exception($this->getError()); } $this->database($dbname); $this->execute('SET NAMES \'utf8\''); }
function __construct($user, $pwd, $server, $dbname, $pfx = '', $debug = false) { Pluf::loadFunction('Pluf_DB_defaultTypecast'); $this->type_cast = Pluf_DB_defaultTypecast(); $this->debug = $debug; $this->pfx = $pfx; $this->debug('* SQLITE OPEN'); $this->type_cast['Pluf_DB_Field_Compressed'] = array('Pluf_DB_CompressedFromDb', 'Pluf_DB_SQLite_CompressedToDb'); // Connect and let the Exception be thrown in case of problem try { $this->con_id = new PDO('sqlite:' . $dbname); } catch (PDOException $e) { throw $e; } }
function __construct($user, $pwd, $server, $dbname, $pfx = '', $debug = false) { Pluf::loadFunction('Pluf_DB_defaultTypecast'); $this->type_cast = Pluf_DB_defaultTypecast(); $this->type_cast['Pluf_DB_Field_Boolean'] = array('Pluf_DB_PostgreSQL_BooleanFromDb', 'Pluf_DB_BooleanToDb'); $this->type_cast['Pluf_DB_Field_Compressed'] = array('Pluf_DB_PostgreSQL_CompressedFromDb', 'Pluf_DB_PostgreSQL_CompressedToDb'); $this->debug('* POSTGRESQL CONNECT'); $cstring = ''; if ($server) { $cstring .= 'host=' . $server . ' '; } $cstring .= 'dbname=' . $dbname . ' user='******' password=' . $pwd; } $this->debug = $debug; $this->pfx = $pfx; $this->cur = null; $this->con_id = @pg_connect($cstring); if (!$this->con_id) { throw new Exception($this->getError()); } }