|
|
|
@ -55,20 +55,24 @@ function db_escape_string_2($s, $link) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function db_query($link, $query) {
|
|
|
|
|
function db_query($link, $query, $die_on_error = true) {
|
|
|
|
|
if (DB_TYPE == "pgsql") {
|
|
|
|
|
$result = pg_query($link, $query);
|
|
|
|
|
if (!$result) {
|
|
|
|
|
$query = htmlspecialchars($query); // just in case
|
|
|
|
|
if ($die_on_error) {
|
|
|
|
|
die("Query <i>$query</i> failed: " . pg_last_error($link));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
} else if (DB_TYPE == "mysql") {
|
|
|
|
|
$result = mysql_query($query, $link);
|
|
|
|
|
if (!$result) {
|
|
|
|
|
$query = htmlspecialchars($query);
|
|
|
|
|
if ($die_on_error) {
|
|
|
|
|
die("Query <i>$query</i> failed: " . mysql_error($link));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|