* insert the @input values when they do not exist yet
* @param string $table name
* @param array $input key->value pair, key has to be sanitized properly
+ * @throws \OC\HintException
* @return int count of inserted rows
*/
public function insertIfNotExist($table, $input) {
$entry .= 'Offending command was: ' . $query.'<br />';
\OC_Log::write('core', $entry, \OC_Log::FATAL);
error_log('DB error: ' . $entry);
- \OC_Template::printErrorPage( $entry );
+ throw new \OC\HintException($entry);
}
}
}
$entry .= 'Offending command was: ' . $query . '<br />';
\OC_Log::write('core', $entry, \OC_Log::FATAL);
error_log('DB error: '.$entry);
- \OC_Template::printErrorPage( $entry );
+ throw new \OC\HintException($entry);
}
if ($stmt->fetchColumn() === '0') {
$entry .= 'Offending command was: ' . $query.'<br />';
\OC_Log::write('core', $entry, \OC_Log::FATAL);
error_log('DB error: ' . $entry);
- \OC_Template::printErrorPage( $entry );
+ throw new \OC\HintException($entry);
}
return $result;
} else {
$result = $this->statement->execute();
}
-
+
if ($result === false) {
return false;
}
// send http status 503
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
- OC_Template::printErrorPage('Failed to connect to database');
- die ($entry);
+ throw new \OC\HintException($entry);
}
}
-
+
/**
* provide an alias for fetch
*