Browse Source

Use count SQL to check for user existance

tags/v6.0.0alpha2
Bart Visscher 11 years ago
parent
commit
3213c47188
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      lib/user/database.php

+ 2
- 2
lib/user/database.php View File

@@ -237,13 +237,13 @@ class OC_User_Database extends OC_User_Backend {
* @return boolean
*/
public function userExists($uid) {
$query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)' );
$query = OC_DB::prepare( 'SELECT COUNT(*) FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)' );
$result = $query->execute( array( $uid ));
if (OC_DB::isError($result)) {
OC_Log::write('core', OC_DB::getErrorMessage($result), OC_Log::ERROR);
return false;
}
return $result->numRows() > 0;
return $result->fetchColumn() > 0;
}

/**

Loading…
Cancel
Save