make sql queries work in sqlite

This commit is contained in:
Robin Appelman 2011-04-17 12:35:58 +02:00
parent 243d6566dd
commit 58cb46c4e8
2 changed files with 9 additions and 9 deletions

View File

@ -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().'"<br />';
@ -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();

View File

@ -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();