Class jDb

Description

factory for database connector and other db utilities

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


	
			
Method Summary
static void clearProfiles ()
static void createVirtualProfile (string $name, array|string $params)
static void floatToStr ( $value)
static jDbConnection getConnection ([string $name = null])
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 214)

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

WARNING: it closes all opened connections !

  • since: 1.2
  • access: public
static void clearProfiles ()
static createVirtualProfile (line 195)

create a temporary new profile

  • 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 dbprofils.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 46)

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 = null])
  • string $name: profile name to use. if empty, use the default one
static getDbWidget (line 65)

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 95)

load properties of a connector profile

a profile is a section in the dbprofils.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
  • 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 76)

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
testProfile (line 150)

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 Thu, 19 Sep 2013 00:03:54 +0200 by phpDocumentor 1.4.3