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 * @param string $groupName The name of the group to create
*/ */
public static function createGroup( $gid ){ 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 )); $result = $query->execute( array( $gid ));
if( $result->numRows() > 0 ){ 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 * @param string $groupName The name of the group to delete
*/ */
public static function deleteGroup( $gid ){ 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 )); $result = $query->execute( array( $gid ));
return true; return true;
@ -85,7 +85,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
* @param string $groupName Name of the group * @param string $groupName Name of the group
*/ */
public static function inGroup( $username, $groupName ){ 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 )); $result = $query->execute( array( $groupName, $username ));
if( PEAR::isError($result)) { if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />'; $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 * @param string $username Name of the user
*/ */
public static function getUserGroups( $username ){ 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 )); $result = $query->execute( array( $username ));
$groups = array(); $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 * @param string $password The password of the new user
*/ */
public static function createUser( $uid, $password ){ 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 )); $result = $query->execute( array( $uid ));
// Check if the user already exists // Check if the user already exists
if ( $result->numRows() > 0 ){ 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 * @param string $username The username of the user to delete
*/ */
public static function deleteUser( $uid ){ 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 )); $result = $query->execute( array( $uid ));
return true; return true;
@ -131,7 +131,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
* @param string $password The new password for the user * @param string $password The new password for the user
*/ */
public static function setPassword( $username, $password ){ 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 )); $result = $query->execute( array( sha1( $password ), $username ));
if( $result->numRows() > 0 ){ if( $result->numRows() > 0 ){
@ -149,7 +149,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
* @param string $password Password of the user * @param string $password Password of the user
*/ */
public static function checkPassword( $username, $password ){ 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 ))); $result = $query->execute( array( $username, sha1( $password )));
if( $result->numRows() > 0 ){ if( $result->numRows() > 0 ){
@ -165,7 +165,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
* *
*/ */
public static function getUsers(){ 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(); $result = $query->execute();
$users=array(); $users=array();