Skip to content
Snippets Groups Projects
Commit 93b0bd0a authored by Andreas Fischer's avatar Andreas Fischer
Browse files

Use getLastError() everywhere.

parent 904573d0
Branches
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ class OCI extends AbstractDatabase { ...@@ -51,7 +51,7 @@ class OCI extends AbstractDatabase {
." WHERE user_role_privs.granted_role = role_sys_privs.role AND privilege = 'CREATE ROLE'"; ." WHERE user_role_privs.granted_role = role_sys_privs.role AND privilege = 'CREATE ROLE'";
$stmt = oci_parse($connection, $query); $stmt = oci_parse($connection, $query);
if (!$stmt) { if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
} }
...@@ -118,7 +118,7 @@ class OCI extends AbstractDatabase { ...@@ -118,7 +118,7 @@ class OCI extends AbstractDatabase {
$un = $this->tableprefix.'users'; $un = $this->tableprefix.'users';
oci_bind_by_name($stmt, ':un', $un); oci_bind_by_name($stmt, ':un', $un);
if (!$stmt) { if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
} }
...@@ -144,14 +144,14 @@ class OCI extends AbstractDatabase { ...@@ -144,14 +144,14 @@ class OCI extends AbstractDatabase {
$query = "SELECT * FROM all_users WHERE USERNAME = :un"; $query = "SELECT * FROM all_users WHERE USERNAME = :un";
$stmt = oci_parse($connection, $query); $stmt = oci_parse($connection, $query);
if (!$stmt) { if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
} }
oci_bind_by_name($stmt, ':un', $name); oci_bind_by_name($stmt, ':un', $name);
$result = oci_execute($stmt); $result = oci_execute($stmt);
if(!$result) { if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
} }
...@@ -162,14 +162,14 @@ class OCI extends AbstractDatabase { ...@@ -162,14 +162,14 @@ class OCI extends AbstractDatabase {
$query = 'CREATE USER '.$name.' IDENTIFIED BY "'.$password.'" DEFAULT TABLESPACE '.$this->dbtablespace; $query = 'CREATE USER '.$name.' IDENTIFIED BY "'.$password.'" DEFAULT TABLESPACE '.$this->dbtablespace;
$stmt = oci_parse($connection, $query); $stmt = oci_parse($connection, $query);
if (!$stmt) { if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
} }
//oci_bind_by_name($stmt, ':un', $name); //oci_bind_by_name($stmt, ':un', $name);
$result = oci_execute($stmt); $result = oci_execute($stmt);
if(!$result) { if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s', $entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
array($query, $name, $password)) . '<br />'; array($query, $name, $password)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
...@@ -178,7 +178,7 @@ class OCI extends AbstractDatabase { ...@@ -178,7 +178,7 @@ class OCI extends AbstractDatabase {
$query = "ALTER USER :un IDENTIFIED BY :pw"; $query = "ALTER USER :un IDENTIFIED BY :pw";
$stmt = oci_parse($connection, $query); $stmt = oci_parse($connection, $query);
if (!$stmt) { if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
} }
...@@ -186,7 +186,7 @@ class OCI extends AbstractDatabase { ...@@ -186,7 +186,7 @@ class OCI extends AbstractDatabase {
oci_bind_by_name($stmt, ':pw', $password); oci_bind_by_name($stmt, ':pw', $password);
$result = oci_execute($stmt); $result = oci_execute($stmt);
if(!$result) { if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
} }
...@@ -195,13 +195,13 @@ class OCI extends AbstractDatabase { ...@@ -195,13 +195,13 @@ class OCI extends AbstractDatabase {
$query = 'GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE TO '.$name; $query = 'GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE TO '.$name;
$stmt = oci_parse($connection, $query); $stmt = oci_parse($connection, $query);
if (!$stmt) { if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
} }
$result = oci_execute($stmt); $result = oci_execute($stmt);
if(!$result) { if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; $entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s', $entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
array($query, $name, $password)) . '<br />'; array($query, $name, $password)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN); \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment