jDbParameters

allow to normalize & analyse database parameters.

supported parameters in a profile:

  • driver: the jdb driver name, or "pdo" to use dbo ("pdo" value is deprecated, use usepdo instead)
  • database: the name of the database (for sqlite: path to the sqlite file)
  • host: the host of the database
  • port: the port of the database
  • user & password: credentials to connect to the database
  • force_encoding: force the encoding at the connection, using the default encoding of the application
  • dsn: dsn (pdo, odbc... optional)
  • usepdo: true if pdo should be used
  • pdodriver: name of the pdodriver to use. Guessed from dsn
  • pdoext: name of the pdo extension to use. Guessed from dsn
  • dbtype: type of the database (so it determines the SQL language)
  • phpext: name of the php extension to use
  • persistent: if true, the connection should be persistent
  • extensions: some informations about extensions to load (For sqlite for example. optional)
  • single_transaction: indicate to execute all queries into a single transaction (pgsql, optional)
  • busytimeout: timeout for the connection (sqlite, optional)
  • timeout: timeout for the connection (pgsql, optional)
  • search_path: schema for pgsql (optional)
  • table_prefix: prefix to add to database table. Used by jDao (optional)
package

jelix

Methods

the constructor normalizes parameters: it ensure that all parameters needed by jDb and the targeted database type are there, as some parameters can be "guessed" by jDb or needed for internal use.

__construct(array $profileParameters) 

Arguments

$profileParameters

array

profile parameters for a jdb connection required keys: driver optional keys: dsn, host, username, password, database,....

_checkRequirements

_checkRequirements( $requirements,  &$profile) 

Arguments

$requirements

$profile

it gives the name of the jDb driver and the database type indicated in a profile.

getDatabaseInfo(array $profile) : array

(or corresponding to the PDO dsn indicated in the profile).

Throws
\Exception

Arguments

$profile

array

'driver' key is required. It should indicates 'pdo' or a jdb driver. if 'pdo', a 'dsn' key is required.

Response

array

['database type', 'native extension name', 'pdo extension name', 'jdb driver name', 'pdo driver name']

getDriversInfosList

getDriversInfosList() 
static

getParameters

getParameters() 

getPDODsn

getPDODsn( $profile) 

Arguments

$profile

indicate if the php extension corresponding to the database configuration is available in the current php configuration.

isExtensionActivated() 

normalizeBoolean

normalizeBoolean( &$profile,  $param) 

Arguments

$profile

$param

Properties

parameters

parameters : 

Type(s)

JdbDriverIndex

JdbDriverIndex : 
static

Type(s)

PDODriverIndex

PDODriverIndex : 
static

Type(s)

informations about correspondance between pdo driver and native driver, type of function etc.

driversInfos : 
static

..

Type(s)

pdoNeededDsnInfo

pdoNeededDsnInfo : 
static

Type(s)