summaryrefslogtreecommitdiffstats
path: root/lib/db.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/db.php')
-rw-r--r--lib/db.php19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/db.php b/lib/db.php
index 23fd9acfc59..e63a7a20c81 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -168,8 +168,7 @@ class OC_DB {
try{
self::$PDO=new PDO($dsn, $user, $pass, $opts);
}catch(PDOException $e) {
- echo( '<b>can not connect to database, using '.$type.'. ('.$e->getMessage().')</center>');
- die();
+ OC_Template::printErrorPage( 'can not connect to database, using '.$type.'. ('.$e->getMessage().')' );
}
// We always, really always want associative arrays
self::$PDO->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
@@ -263,10 +262,9 @@ class OC_DB {
// Die if we could not connect
if( PEAR::isError( self::$MDB2 )) {
- echo( '<b>can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')</center>');
OC_Log::write('core', self::$MDB2->getUserInfo(), OC_Log::FATAL);
OC_Log::write('core', self::$MDB2->getMessage(), OC_Log::FATAL);
- die();
+ OC_Template::printErrorPage( 'can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')' );
}
// We always, really always want associative arrays
@@ -326,7 +324,7 @@ class OC_DB {
$entry .= 'Offending command was: '.htmlentities($query).'<br />';
OC_Log::write('core', $entry, OC_Log::FATAL);
error_log('DB error: '.$entry);
- die( $entry );
+ OC_Template::printErrorPage( $entry );
}
}else{
try{
@@ -336,7 +334,7 @@ class OC_DB {
$entry .= 'Offending command was: '.htmlentities($query).'<br />';
OC_Log::write('core', $entry, OC_Log::FATAL);
error_log('DB error: '.$entry);
- die( $entry );
+ OC_Template::printErrorPage( $entry );
}
$result=new PDOStatementWrapper($result);
}
@@ -456,7 +454,7 @@ class OC_DB {
// Die in case something went wrong
if( $definition instanceof MDB2_Schema_Error ) {
- die( $definition->getMessage().': '.$definition->getUserInfo());
+ OC_Template::printErrorPage( $definition->getMessage().': '.$definition->getUserInfo() );
}
if(OC_Config::getValue('dbtype', 'sqlite')==='oci') {
unset($definition['charset']); //or MDB2 tries SHUTDOWN IMMEDIATE
@@ -468,8 +466,7 @@ class OC_DB {
// Die in case something went wrong
if( $ret instanceof MDB2_Error ) {
- echo (self::$MDB2->getDebugOutput());
- die ($ret->getMessage() . ': ' . $ret->getUserInfo());
+ OC_Template::printErrorPage( self::$MDB2->getDebugOutput().' '.$ret->getMessage() . ': ' . $ret->getUserInfo() );
}
return true;
@@ -582,7 +579,7 @@ class OC_DB {
$entry .= 'Offending command was: ' . $query . '<br />';
OC_Log::write('core', $entry, OC_Log::FATAL);
error_log('DB error: '.$entry);
- die( $entry );
+ OC_Template::printErrorPage( $entry );
}
if($result->numRows() == 0) {
@@ -614,7 +611,7 @@ class OC_DB {
$entry .= 'Offending command was: ' . $query.'<br />';
OC_Log::write('core', $entry, OC_Log::FATAL);
error_log('DB error: ' . $entry);
- die( $entry );
+ OC_Template::printErrorPage( $entry );
}
return $result->execute();