Db.Db Class
The database interface module. Contains basic properties and methods and serves as namespace for more specific sub-classes
Item Index
Methods
connect
-
name
This function uses Db to establish a connection with the information stored in the configuration. If the this Db object has already been made, it returns this Db object.
Parameters:
-
name
StringThe name of the connection out of the connections added with Db::setConnection
Returns:
The database connection
getConnection
-
name
Returns connection details for a connection
Parameters:
-
name
String
Returns:
getShard
-
connName
-
[shardName='']
Returns modification details for a shard pertaining to a connection
Returns:
getShards
-
connName
Returns all the shards added thus far for a connection
Parameters:
-
connName
String
Returns:
parseDsnString
-
dsn
Parses dsn string and convert to object
Parameters:
-
dsn
StringThe dsn string for the database
Returns:
The data extracted from the DSN string
setConnection
-
name
-
details
Add a database connection with a name
setShard
-
connName
-
shardName
-
modifications
Add a named shard under a database connection Can contain the keys "dsn", "username", "password", "driver_options" They are used in constructing the PDO object.
Parameters:
-
connName
StringThe name of the connection to which the shard pertains
-
shardName
StringThe name under which to store the shard modifications
-
modifications
ObjectThe shard modifications. Can include the keys: 'dsn', 'host', 'port', 'dbname', 'unix_socket', 'charset', 'username', 'password', 'driver_options',