diff options
Diffstat (limited to 'it_dbi_postgres.class')
-rw-r--r-- | it_dbi_postgres.class | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/it_dbi_postgres.class b/it_dbi_postgres.class index 6b60fb4..1190f2c 100644 --- a/it_dbi_postgres.class +++ b/it_dbi_postgres.class @@ -95,13 +95,15 @@ function _escape_name($str) return pg_escape_identifier($this->_link, $str); } -function _connect_db($p) { +function _connect_db($p) +{ $result = @pg_connect("host=$p[server] user=$p[user] dbname=$p[db] password=$p[pw]", PGSQL_CONNECT_FORCE_NEW); if ($result) { # set charset used for this connection (also change mariadb specific default utf8mb4 to utf8) - if ($p['charset']) { + if ($p['charset']) + { $charset = $p['charset'] == 'utf8mb4' ? 'UNICODE' : $p['charset']; if (pg_set_client_encoding($result, $charset) < 0) $this->_fatal("_connect(): can't set charset \"$charset\""); @@ -117,7 +119,8 @@ function __query($query, $p) { $starttime = microtime(true); pg_send_query($this->_link, $query); - while (pg_connection_busy($this->_link)) { + while (pg_connection_busy($this->_link)) + { if ($p['timeout'] && (microtime(true) - $starttime) > $p['timeout']) return false; $read = $error = [pg_socket($this->_link)]; |