Class Prefs_sql

Description

Preferences storage implementation for PHP's PEAR database abstraction layer.

Required parameters:

   'phptype'      The database type (ie. 'pgsql', 'mysql', etc.).
   'charset'      The database's internal charset.

Optional parameters:

   'table'        The name of the preferences table in 'database'.
                  DEFAULT: 'horde_prefs'

Required by some database implementations:

   'hostspec'     The hostname of the database server.
   'protocol'     The communication protocol ('tcp', 'unix', etc.).
   'database'     The name of the database.
   'username'     The username with which to connect to the database.
   'password'     The password associated with 'username'.
   'options'      Additional options to pass to the database.
   'port'         The port on which to connect to the database.
   'tty'          The TTY on which to connect to the database.

Optional values when using separate reading and writing servers, for example in replication settings:

   'splitread'   Boolean, whether to implement the separation or not.
   'read'        Array containing the parameters which are different for
                 the read database connection, currently supported
                 only 'hostspec' and 'port' parameters.

The table structure for the Prefs system is in scripts/sql/horde_prefs.sql.

$Horde: framework/Prefs/Prefs/sql.php,v 1.91.10.26 2009/02/25 05:35:43 chuck Exp $

Copyright 1999-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Located in /Prefs/Prefs/sql.php (line 59)

Prefs
   |
   --Prefs_sql
Variable Summary
 boolean $_connected
 DB $_db
 array $_params
Method Summary
 Prefs_sql Prefs_sql (string $user, [string $password = ''], [string $scope = ''], [array $params = array()], [boolean $caching = false])
 void clear ()
 mixed convertFromDriver (mixed $value, string $charset)
 mixed convertToDriver (mixed $value, string $charset)
 string getCharset ()
 void store ()
 mixed _retrieve ($scope $scope)
Variables
boolean $_connected = false (line 89)

Boolean indicating whether or not we're connected to the SQL server.

DB $_db (line 73)

Handle for the current database connection.

array $_params = array() (line 66)

Hash containing connection parameters.

DB $_write_db (line 82)

Handle for the current database connection, used for writing. Defaults to the same handle as $_db if a separate write database is not configured.

Inherited Variables

Inherited from Prefs

Prefs::$_cache
Prefs::$_caching
Prefs::$_hooks
Prefs::$_prefs
Prefs::$_scope
Prefs::$_scopes
Prefs::$_user
Methods
Constructor Prefs_sql (line 100)

Constructs a new SQL preferences object.

Prefs_sql Prefs_sql (string $user, [string $password = ''], [string $scope = ''], [array $params = array()], [boolean $caching = false])
  • string $user: The user who owns these preferences.
  • string $password: The password associated with $user. (Unused)
  • string $scope: The current preferences scope.
  • array $params: A hash containing connection parameters.
  • boolean $caching: Should caching be used?
clear (line 264)

Clears all preferences from the backend.

void clear ()

Redefinition of:
Prefs::clear()
Clears all preferences from the backend.
convertFromDriver (line 295)

Converts a value from the driver's charset to the specified charset.

  • return: The converted value.
mixed convertFromDriver (mixed $value, string $charset)
  • mixed $value: A value to convert.
  • string $charset: The charset to convert to.

Redefinition of:
Prefs::convertFromDriver()
Converts a value from the driver's charset to the specified charset.
convertToDriver (line 322)

Converts a value from the specified charset to the driver's charset.

  • return: The converted value.
mixed convertToDriver (mixed $value, string $charset)
  • mixed $value: A value to convert.
  • string $charset: The charset to convert from.

Redefinition of:
Prefs::convertToDriver()
Converts a value from the specified charset to the driver's charset.
getCharset (line 116)

Returns the charset used by the concrete preference backend.

  • return: The preference backend's charset.
string getCharset ()

Redefinition of:
Prefs::getCharset()
Returns the charset used by the concrete preference backend.
store (line 181)

Stores preferences to the SQL server.

void store ()

Redefinition of:
Prefs::store()
This function will be run at the end of every request as a shutdown
_retrieve (line 129)

Retrieves the requested set of preferences from the user's database entry.

  • return: True on success or a PEAR_Error object on failure.
mixed _retrieve ($scope $scope)
  • $scope $scope: Scope specifier.

Inherited Methods

Inherited From Prefs

 Prefs::Prefs()
 Prefs::cleanup()
 Prefs::clear()
 Prefs::convertFromDriver()
 Prefs::convertToDriver()
 Prefs::factory()
 Prefs::getCharset()
 Prefs::getDefault()
 Prefs::getScope()
 Prefs::getUser()
 Prefs::getValue()
 Prefs::isDefault()
 Prefs::isDirty()
 Prefs::isLocked()
 Prefs::isShared()
 Prefs::remove()
 Prefs::retrieve()
 Prefs::setDefault()
 Prefs::setDirty()
 Prefs::setLocked()
 Prefs::setScope()
 Prefs::setShared()
 Prefs::setValue()
 Prefs::singleton()
 Prefs::store()
 Prefs::_cacheLookup()
 Prefs::_cacheUpdate()
 Prefs::_dirtyPrefs()
 Prefs::_getPreferenceScope()
 Prefs::_loadScope()
 Prefs::_setValue()
 Prefs::__get()
 Prefs::__set()

Documentation generated on Sun, 30 Jan 2011 05:21:52 +0000 by phpDocumentor 1.4.3