forked from GNUsocial/gnu-social
show SQL errors in the output
This commit is contained in:
parent
2371fe9092
commit
dcda2e1f72
11
install.php
11
install.php
|
@ -220,6 +220,8 @@ function handlePost()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: use PEAR::DB or PDO instead of our own switch
|
||||||
|
|
||||||
switch($dbtype) {
|
switch($dbtype) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$db = mysql_db_installer($host, $database, $username, $password);
|
$db = mysql_db_installer($host, $database, $username, $password);
|
||||||
|
@ -396,18 +398,25 @@ function runDbScript($filename, $conn, $type = 'mysql')
|
||||||
if (!mb_strlen($stmt)) {
|
if (!mb_strlen($stmt)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// FIXME: use PEAR::DB or PDO instead of our own switch
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$res = mysql_query($stmt, $conn);
|
$res = mysql_query($stmt, $conn);
|
||||||
|
if ($res === false) {
|
||||||
|
$error = mysql_error();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
$res = pg_query($conn, $stmt);
|
$res = pg_query($conn, $stmt);
|
||||||
|
if ($res === false) {
|
||||||
|
$error = pg_last_error();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
updateStatus("runDbScript() error: unknown database type ". $type ." provided.");
|
updateStatus("runDbScript() error: unknown database type ". $type ." provided.");
|
||||||
}
|
}
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
updateStatus("FAILED SQL: $stmt");
|
updateStatus("ERROR ($error) for SQL '$stmt'");
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue