value pairs). */ public function __construct( $dbParams ) { $database = null; $charset = null; $host = null; $port = null; $socket = null; foreach ( $dbParams as $key => $val ) { switch ( $key ) { case 'database': case 'dbname': $database = $val; break; case 'host': case 'hostspec': $host = $val; break; case 'port': $port = $val; break; } } if ( !isset( $database ) ) { throw new ezcDbException( ezcDbException::MISSING_DATABASE_NAME ); } $dsn = "pgsql:dbname=$database"; if ( isset( $host ) && $host ) { $dsn .= " host=$host"; } if ( isset( $port ) && $port ) { $dsn .= " port=$port"; } parent::__construct( $dbParams, $dsn ); } /** * Returns 'pgsql'. * * @return string */ static public function getName() { return 'pgsql'; } /** * Returns a new ezcQueryExpression derived object with PostgreSQL implementation specifics. * * @return ezcQueryExpressionPgsql */ public function createExpression() { $version = $this->getAttribute( PDO::ATTR_SERVER_VERSION ); return new ezcQueryExpressionPgsql( substr( $version, 0, 1 ) ); } /** * Returns a new ezcUtilities derived object with PostgreSQL implementation specifics. * * @return ezcUtilitiesPgsql */ public function createUtilities() { return new ezcDbUtilitiesPgsql( $this ); } } ?>