Class jDb

Description

factory for database connector and other db utilities

Located in /db/jDb.class.php (line 110)


	
			
Method Summary
static void clearProfiles ()
static void createVirtualProfile (string $name, array|string $params)
static void floatToStr ( $value)
static jDbConnection getConnection ([string $name = ''])
static jDbWidget getDbWidget ([string $name = null])
static array getProfile ([string $name = ''], [boolean $noDefault = false])
static jDbTools getTools ([string $name = null])
boolean testProfile (array $profile)
Methods
static clearProfiles (line 215)

clear the loaded profiles to force to reload the db profiles file.

WARNING: it closes all opened connections !

  • deprecated: since 1.3, use jProfiles::clear instead
  • since: 1.2
  • access: public
static void clearProfiles ()
static createVirtualProfile (line 205)

create a temporary new profile

  • deprecated: since 1.3, use jProfiles::createVirtualProfile instead
  • access: public
static void createVirtualProfile (string $name, array|string $params)
  • string $name: the name of the profile
  • array|string $params: parameters of the profile. key=parameter name, value=parameter value. same kind of parameters we found in profiles.ini.php we can also indicate a name of an other profile, to create an alias
static floatToStr (line 225)

perform a convertion float to str. It takes care about the decimal separator which should be a '.' for SQL. Because when doing a native convertion float->str, PHP uses the local decimal separator, and so, we don't want that.

  • since: 1.1.11
  • access: public
static void floatToStr ( $value)
  • $value
static getConnection (line 119)

return a database connector. It uses a temporay pool of connection to reuse currently opened connections.

  • return: the connector
  • access: public
static jDbConnection getConnection ([string $name = ''])
  • string $name: profile name to use. if empty, use the default one
static getDbWidget (line 128)

create a new jDbWidget

  • access: public
static jDbWidget getDbWidget ([string $name = null])
  • string $name: profile name to use. if empty, use the default one
static getProfile (line 159)

load properties of a connector profile

a profile is a section in the profiles.ini.php file

the given name can be a profile name (it should correspond to a section name in the ini file), or an alias of a profile. An alias is a parameter name in the global section of the ini file, and the value of this parameter should be a profile name.

  • return: properties
  • deprecated: use jProfiles::get instead
  • access: public
static array getProfile ([string $name = ''], [boolean $noDefault = false])
  • string $name: profile name or alias of a profile name. if empty, use the default profile
  • boolean $noDefault: if true and if the profile doesn't exist, throw an error instead of getting the default profile
static getTools (line 139)

instancy a jDbTools object. Use jDbConnection::tools() instead.

  • deprecated: since 1.2
  • access: public
static jDbTools getTools ([string $name = null])
  • string $name: profile name to use. if empty, use the default one
static _createConnector (line 184)

create a connector. internal use (callback method for jProfiles)

  • return: database connector
  • access: public
static jDbConnection|jDbPDOConnection _createConnector (array $profile)
  • array $profile: profile properties
testProfile (line 168)

call it to test a profile (during an install for example)

  • return: true if properties are ok
  • access: public
boolean testProfile (array $profile)
  • array $profile: profile properties

Documentation generated on Wed, 24 Sep 2014 21:58:25 +0200 by phpDocumentor 1.4.3