From 58cb46c4e85ff4af41d91522e8fcba89e01fed81 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 17 Apr 2011 12:35:58 +0200 Subject: [PATCH] make sql queries work in sqlite --- lib/Group/database.php | 8 ++++---- lib/User/database.php | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Group/database.php b/lib/Group/database.php index aea27a3d6d..58e7a28d3e 100644 --- a/lib/Group/database.php +++ b/lib/Group/database.php @@ -52,7 +52,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { * @param string $groupName The name of the group to create */ public static function createGroup( $gid ){ - $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups` WHERE `gid` = ?" ); + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups` WHERE gid = ?" ); $result = $query->execute( array( $gid )); if( $result->numRows() > 0 ){ @@ -72,7 +72,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { * @param string $groupName The name of the group to delete */ public static function deleteGroup( $gid ){ - $query = OC_DB::prepare( "DELETE FROM `*PREFIX*groups` WHERE `gid` = ?" ); + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*groups` WHERE gid = ?" ); $result = $query->execute( array( $gid )); return true; @@ -85,7 +85,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { * @param string $groupName Name of the group */ public static function inGroup( $username, $groupName ){ - $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` = ?" ); + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE gid = ? AND uid = ?" ); $result = $query->execute( array( $groupName, $username )); if( PEAR::isError($result)) { $entry = 'DB Error: "'.$result->getMessage().'"
'; @@ -126,7 +126,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { * @param string $username Name of the user */ public static function getUserGroups( $username ){ - $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE `uid` = ?" ); + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE uid = ?" ); $result = $query->execute( array( $username )); $groups = array(); diff --git a/lib/User/database.php b/lib/User/database.php index 533cadbb95..9a059c1b23 100644 --- a/lib/User/database.php +++ b/lib/User/database.php @@ -49,7 +49,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND { * @param string $password The password of the new user */ public static function createUser( $uid, $password ){ - $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*users` WHERE `uid` = ?" ); + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*users` WHERE uid = ?" ); $result = $query->execute( array( $uid )); // Check if the user already exists if ( $result->numRows() > 0 ){ @@ -69,7 +69,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND { * @param string $username The username of the user to delete */ public static function deleteUser( $uid ){ - $query = OC_DB::prepare( "DELETE FROM `*PREFIX*users` WHERE `uid` = ?" ); + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*users` WHERE uid = ?" ); $result = $query->execute( array( $uid )); return true; @@ -131,7 +131,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND { * @param string $password The new password for the user */ public static function setPassword( $username, $password ){ - $query = OC_DB::prepare( "UPDATE `*PREFIX*users` SET `password` = ? WHERE `uid` = ?" ); + $query = OC_DB::prepare( "UPDATE *PREFIX*users SET password = ? WHERE uid = ?" ); $result = $query->execute( array( sha1( $password ), $username )); if( $result->numRows() > 0 ){ @@ -149,7 +149,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND { * @param string $password Password of the user */ public static function checkPassword( $username, $password ){ - $query = OC_DB::prepare( "SELECT `uid` FROM `*PREFIX*users` WHERE `uid` = ? AND `password` = ?" ); + $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users WHERE uid = ? AND password = ?" ); $result = $query->execute( array( $username, sha1( $password ))); if( $result->numRows() > 0 ){ @@ -165,7 +165,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND { * */ public static function getUsers(){ - $query = OC_DB::prepare( "SELECT `uid` FROM `*PREFIX*users`" ); + $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users" ); $result = $query->execute(); $users=array();