1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-01-31 20:17:11 +00:00

block mysql versions where true is undefined in sanity_check

This commit is contained in:
Andrew Dolgov
2006-08-13 05:46:40 +01:00
parent 746a0d5eb3
commit aec3ce39de
3 changed files with 22 additions and 4 deletions

10
db.php
View File

@@ -55,19 +55,23 @@ 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
die("Query <i>$query</i> failed: " . pg_last_error($link));
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);
die("Query <i>$query</i> failed: " . mysql_error($link));
if ($die_on_error) {
die("Query <i>$query</i> failed: " . mysql_error($link));
}
}
return $result;
}