diff options
author | Evan Prodromou <evan@status.net> | 2009-08-27 08:58:03 -0700 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-08-27 08:58:03 -0700 |
commit | dcda2e1f7272c61c7c000285df9ace208e622e97 (patch) | |
tree | 148c8b358226aa7eca3ffececa973145daf6c71f | |
parent | 2371fe90922bec9ac212112e3a837f07edc61d5d (diff) |
show SQL errors in the output
-rw-r--r-- | install.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/install.php b/install.php index 24e85fe84..42d848911 100644 --- a/install.php +++ b/install.php @@ -220,6 +220,8 @@ function handlePost() return; } + // FIXME: use PEAR::DB or PDO instead of our own switch + switch($dbtype) { case 'mysql': $db = mysql_db_installer($host, $database, $username, $password); @@ -396,18 +398,25 @@ function runDbScript($filename, $conn, $type = 'mysql') if (!mb_strlen($stmt)) { continue; } + // FIXME: use PEAR::DB or PDO instead of our own switch switch ($type) { case 'mysql': $res = mysql_query($stmt, $conn); + if ($res === false) { + $error = mysql_error(); + } break; case 'pgsql': $res = pg_query($conn, $stmt); + if ($res === false) { + $error = pg_last_error(); + } break; default: updateStatus("runDbScript() error: unknown database type ". $type ." provided."); } if ($res === false) { - updateStatus("FAILED SQL: $stmt"); + updateStatus("ERROR ($error) for SQL '$stmt'"); return $res; } } |