diff options
author | Jakob Sack <kde@jakobsack.de> | 2011-05-15 15:03:12 +0200 |
---|---|---|
committer | Jakob Sack <kde@jakobsack.de> | 2011-05-15 15:03:12 +0200 |
commit | d70dfbdebba6070368d1c8999a311dcfc81dec1d (patch) | |
tree | c3dea499e98166a3076b6c3c620dbad3aabf12aa /lib/preferences.php | |
parent | 6b83e5ccfe31a947b758eabadb9865ad898dbbef (diff) | |
download | nextcloud-server-d70dfbdebba6070368d1c8999a311dcfc81dec1d.tar.gz nextcloud-server-d70dfbdebba6070368d1c8999a311dcfc81dec1d.zip |
Renamed a few columns in order t ohave both sqlite and mysql up and running
Diffstat (limited to 'lib/preferences.php')
-rw-r--r-- | lib/preferences.php | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/preferences.php b/lib/preferences.php index 6fb3cf1312f..5a9ed395085 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -28,8 +28,8 @@ * CREATE TABLE `preferences` ( * `userid` VARCHAR( 255 ) NOT NULL , * `appid` VARCHAR( 255 ) NOT NULL , - * `key` VARCHAR( 255 ) NOT NULL , - * `value` VARCHAR( 255 ) NOT NULL + * `configkey` VARCHAR( 255 ) NOT NULL , + * `configvalue` VARCHAR( 255 ) NOT NULL * ) * */ @@ -47,7 +47,7 @@ class OC_PREFERENCES{ */ public static function getUsers(){ // No need for more comments - $query = OC_DB::prepare( 'SELECT DISTINCT( `userid` ) FROM `*PREFIX*preferences`' ); + $query = OC_DB::prepare( 'SELECT DISTINCT( userid ) FROM *PREFIX*preferences' ); $result = $query->execute(); $users = array(); @@ -68,7 +68,7 @@ class OC_PREFERENCES{ */ public static function getApps( $user ){ // No need for more comments - $query = OC_DB::prepare( 'SELECT DISTINCT( `appid` ) FROM `*PREFIX*preferences` WHERE `userid` = ?' ); + $query = OC_DB::prepare( 'SELECT DISTINCT( appid ) FROM *PREFIX*preferences WHERE userid = ?' ); $result = $query->execute( array( $user )); $apps = array(); @@ -90,12 +90,12 @@ class OC_PREFERENCES{ */ public static function getKeys( $user, $app ){ // No need for more comments - $query = OC_DB::prepare( 'SELECT `key` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' ); + $query = OC_DB::prepare( 'SELECT configkey FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' ); $result = $query->execute( array( $user, $app )); $keys = array(); while( $row = $result->fetchRow()){ - $keys[] = $row["key"]; + $keys[] = $row["configkey"]; } return $keys; @@ -114,7 +114,7 @@ class OC_PREFERENCES{ */ public static function getValue( $user, $app, $key, $default = null ){ // Try to fetch the value, return default if not exists. - $query = OC_DB::prepare( 'SELECT `value` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `key` = ?' ); + $query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); $result = $query->execute( array( $user, $app, $key )); if( !$result->numRows()){ @@ -123,7 +123,7 @@ class OC_PREFERENCES{ $row = $result->fetchRow(); - return $row["value"]; + return $row["configvalue"]; } /** @@ -143,11 +143,11 @@ class OC_PREFERENCES{ // null: does not exist. Insert. if( is_null( $exists )){ - $query = OC_DB::prepare( 'INSERT INTO `*PREFIX*preferences` ( `userid`, `appid`, `key`, `value` ) VALUES( ?, ?, ?, ? )' ); + $query = OC_DB::prepare( 'INSERT INTO *PREFIX*preferences ( userid, appid, configkey, configvalue ) VALUES( ?, ?, ?, ? )' ); $query->execute( array( $user, $app, $key, $value )); } else{ - $query = OC_DB::prepare( 'UPDATE `*PREFIX*preferences` SET `value` = ? WHERE `userid` = ? AND `appid` = ? AND `key` = ?' ); + $query = OC_DB::prepare( 'UPDATE *PREFIX*preferences SET configvalue = ? WHERE userid = ? AND appid = ? AND configkey = ?' ); $query->execute( array( $value, $user, $app, $key )); } } @@ -163,7 +163,7 @@ class OC_PREFERENCES{ */ public static function deleteKey( $user, $app, $key ){ // No need for more comments - $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `key` = ?' ); + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); $result = $query->execute( array( $user, $app, $key )); return true; @@ -179,7 +179,7 @@ class OC_PREFERENCES{ */ public static function deleteApp( $user, $app ){ // No need for more comments - $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' ); + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' ); $result = $query->execute( array( $user, $app )); return true; @@ -194,7 +194,7 @@ class OC_PREFERENCES{ */ public static function deleteUser( $user ){ // No need for more comments - $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?' ); + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ?' ); $result = $query->execute( array( $user )); return true; @@ -209,7 +209,7 @@ class OC_PREFERENCES{ */ public static function deleteAppFromAllUsers( $app ){ // No need for more comments - $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `appid` = ?' ); + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid = ?' ); $result = $query->execute( array( $app )); return true; |