X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=db.php;h=55768f3f66364909b06eb06d346a20138c863e59;hb=e8614131e893af473e0a585addb19d9f4e8b8973;hp=e4673f679c4ed476531ee76ef93c08f73a981ab8;hpb=6e0584e9308e0dc0049d2d59d2b0c86f619720b0;p=tt-rss.git diff --git a/db.php b/db.php index e4673f67..55768f3f 100644 --- a/db.php +++ b/db.php @@ -5,12 +5,16 @@ require_once "config.php"; function db_connect($host, $user, $pass, $db) { if (DB_TYPE == "pgsql") { - $string = "dbname=$db user=$user password=$pass"; + $string = "dbname=$db user=$user password=$pass"; if ($host) { $string .= " host=$host"; } + if (defined('DB_PORT')) { + $string = "$string port=" . DB_PORT; + } + $link = pg_connect($string); if (!$link) { @@ -118,3 +122,12 @@ function db_close($link) { return mysql_close($link); } } + +function db_affected_rows($link, $result) { + if (DB_TYPE == "pgsql") { + return pg_affected_rows($result); + } else if (DB_TYPE == "mysql") { + return mysql_affected_rows($link); + } +} +?>