added OC_DB::isError and logging

This commit is contained in:
Florin Peter 2013-05-25 21:33:05 +02:00
parent dbb6a10364
commit 9a6cd89a69
1 changed files with 36 additions and 2 deletions

View File

@ -291,6 +291,10 @@ class Util
$recoveryEnabled = array(); $recoveryEnabled = array();
if (\OC_DB::isError($result)) {
\OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
}
while ( $row = $result->fetchRow() ) { while ( $row = $result->fetchRow() ) {
$recoveryEnabled[] = $row['recovery_enabled']; $recoveryEnabled[] = $row['recovery_enabled'];
@ -820,6 +824,10 @@ class Util
$result = $query->execute( array( $fileId ) ); $result = $query->execute( array( $fileId ) );
if (\OC_DB::isError($result)) {
\OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
}
$row = $result->fetchRow(); $row = $result->fetchRow();
return substr( $row['path'], 5 ); return substr( $row['path'], 5 );
@ -1086,6 +1094,10 @@ class Util
$migrationStatus = array(); $migrationStatus = array();
if (\OC_DB::isError($result)) {
\OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
}
$row = $result->fetchRow(); $row = $result->fetchRow();
if($row) { if($row) {
$migrationStatus[] = $row['migration_status']; $migrationStatus[] = $row['migration_status'];
@ -1221,6 +1233,10 @@ class Util
$result = $query->execute( array( $id ) ); $result = $query->execute( array( $id ) );
if (\OC_DB::isError($result)) {
\OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
}
$row = $result->fetchRow(); $row = $result->fetchRow();
return $row; return $row;
@ -1240,6 +1256,10 @@ class Util
$result = $query->execute( array( $id ) ); $result = $query->execute( array( $id ) );
if (\OC_DB::isError($result)) {
\OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
}
$row = $result->fetchRow(); $row = $result->fetchRow();
return $row; return $row;
@ -1255,7 +1275,14 @@ class Util
public function getOwnerFromSharedFile( $id ) { public function getOwnerFromSharedFile( $id ) {
$query = \OC_DB::prepare( 'SELECT `parent`, `uid_owner` FROM `*PREFIX*share` WHERE `id` = ?', 1 ); $query = \OC_DB::prepare( 'SELECT `parent`, `uid_owner` FROM `*PREFIX*share` WHERE `id` = ?', 1 );
$source = $query->execute( array( $id ) )->fetchRow();
$result = $query->execute( array( $id ) );
if (\OC_DB::isError($result)) {
\OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
}
$source = $result->fetchRow();
$fileOwner = false; $fileOwner = false;
@ -1266,7 +1293,14 @@ class Util
while ( isset( $parent ) ) { while ( isset( $parent ) ) {
$query = \OC_DB::prepare( 'SELECT `parent`, `uid_owner` FROM `*PREFIX*share` WHERE `id` = ?', 1 ); $query = \OC_DB::prepare( 'SELECT `parent`, `uid_owner` FROM `*PREFIX*share` WHERE `id` = ?', 1 );
$item = $query->execute( array( $parent ) )->fetchRow();
$result = $query->execute( array( $parent ) );
if (\OC_DB::isError($result)) {
\OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
}
$item = $result->fetchRow();
if ( isset( $item['parent'] ) ) { if ( isset( $item['parent'] ) ) {