DBInstance
in package
uses
FileConfiguration
Provides a PDO DB connection to instances of \Pipit\Classes\Data\DBObject and its descendants
Tags
Table of Contents
Constants
- CONFIG_FILE = "db.instance"
Properties
- $handle : PDO
- $configs : array<string, array<string|int, mixed>>
- $debug : bool
- $instance : DBInstance
- $type : string
Methods
- getInstance() : DBInstance
- Returns a singleton instance of the db class
- getType() : string
- Returns the type of the DBInstance
- isDebug() : bool
- Returns whether or not the DBInstance is in debug mode
- configurationFileExists() : bool
- Checks for the existence of a file with the given filename
- getConfigurationFromFileName() : array<string|int, mixed>
- Retrieves a config array by its corresponding filename
- __construct() : mixed
- Instantiates a new \PDO instance using the DBInstance.config config file
- loadConfigurationFile() : void
- Loads and parses a php ini file into an array keyed by ini sections
Constants
CONFIG_FILE
private
mixed
CONFIG_FILE
= "db.instance"
Properties
$handle
public
PDO
$handle
A PDO instance
$configs
private
array<string, array<string|int, mixed>>
$configs
= []
An array of configuration arrays
$debug
private
bool
$debug
= false
The debug status
$instance
private
static DBInstance
$instance
= null
An instance of this db class
$type
private
string
$type
= 'mysql'
The SQL type
Methods
getInstance()
Returns a singleton instance of the db class
public
static getInstance() : DBInstance
Return values
DBInstancegetType()
Returns the type of the DBInstance
public
getType() : string
Return values
stringisDebug()
Returns whether or not the DBInstance is in debug mode
public
isDebug() : bool
Return values
boolconfigurationFileExists()
Checks for the existence of a file with the given filename
protected
configurationFileExists(string $configurationFileName) : bool
Parameters
- $configurationFileName : string
-
The name of the file without extension or path
Return values
boolgetConfigurationFromFileName()
Retrieves a config array by its corresponding filename
protected
getConfigurationFromFileName(string $configurationFileName) : array<string|int, mixed>
Parameters
- $configurationFileName : string
-
The name of the file without extension or path
Return values
array<string|int, mixed>__construct()
Instantiates a new \PDO instance using the DBInstance.config config file
private
__construct() : mixed
loadConfigurationFile()
Loads and parses a php ini file into an array keyed by ini sections
private
loadConfigurationFile(string $configurationFileName) : void
Parameters
- $configurationFileName : string
-
The name of the file without extension or path