Used to define all of the configuration settings for the database object.

author Andrew Judd
copyright Andrew Judd, 2012
license GPLv3
package Database

 Methods

This function is used in order to configure the DatabaseConfiguration object from an array.

fromArray(array $config) : \DatabaseConfiguration

Parameters

$config

array

The array of values to configure

Returns

\DatabaseConfigurationA fully hydrated database configuration object

This function is used statically in order to make an instance of a database configuration object from an INI file.

fromINIFile(string $iniFile, string $section) : \DatabaseConfiguration

Parameters

$iniFile

string

The .ini file path

$section

string

The section in the ini file which the database connection information is stored. Default: NULL, no sections.

Exceptions

\Exception::If the file does not exist
\InvalidArgumentException::If the INI file is invalid

Returns

\DatabaseConfigurationA fully hydrated database configuration object

This function is used statically in order to make an instance of a database configuration object from an INI string.

fromINIString(string $iniString, string $section) : \DatabaseConfiguration

Parameters

$iniString

string

The INI string

$section

string

The section in the ini file which the database connection information is stored. Default: NULL, no sections.

Exceptions

\Exception::If the file does not exist
\InvalidArgumentException::If the INI string is invalid

Returns

\DatabaseConfigurationA fully hydrated database configuration object

 Properties

 

The name of the database which is being used.

$database : string

 

The database engine to connect to the database with.

$engine : string

 

Used if the error logging is set to ERROR_LOGFILE. This will contain the file name that should be written to.

$errorLogFile : array

 

Configuration stating how any issues which arise should be handled.

$errorReporting : int

 

Defines the host name for the database connection.

$hostname : string

 

Whether or not a query log should be maintained.

$maintainQueryLog : bool

 

The password used to log into the database server

$password : string

 

Which parser to use

$queryMode : int

 

The username used to log into the database server.

$username : string

 Constants

 

Echo the error to the screen

ERRORS_ECHO : int

 

Throw an exception when there is an error

ERRORS_EXCEPTION : int

 

Ignore any errors

ERRORS_IGNORE : int

 

Write the exception to a log file

ERRORS_LOGFILE : int

 

Classic query parser

QUERY_CLASSIC : int

 

Default query parser

QUERY_DEFAULT : int