Function Database_Static_postgresql->get_connection
Definitions
sources/database/postgresql.php
- Get a database connection. This function shouldn't be used by you, as a connection to the database is established automatically.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
Parameters
Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
---|---|---|---|---|---|---|---|
$persistent | boolean | No | No | required parameter | N/A | N/A | Whether to create a persistent connection |
$db_name | string | No | No | required parameter | N/A | N/A | The database name |
$db_host | string | No | No | required parameter | N/A | N/A | The database host (the server) |
$db_user | string | No | No | required parameter | N/A | N/A | The database connection username |
$db_password | string | No | No | required parameter | N/A | N/A | The database connection password |
$fail_ok | boolean | No | No | False | N/A | N/A | Whether to on error echo an error and return with a null, rather than giving a critical error |
Returns
- A database connection (null: failed)
- Type: ?mixed
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Get a database connection. This function shouldn't be used by you, as a connection to the database is established automatically.
*
* @param boolean $persistent Whether to create a persistent connection
* @param string $db_name The database name
* @param string $db_host The database host (the server)
* @param string $db_user The database connection username
* @param string $db_password The database connection password
* @param boolean $fail_ok Whether to on error echo an error and return with a null, rather than giving a critical error
* @return ?mixed A database connection (null: failed)
*/
public function get_connection(bool $persistent, string $db_name, string $db_host, string $db_user, string $db_password, bool $fail_ok = false)
* Get a database connection. This function shouldn't be used by you, as a connection to the database is established automatically.
*
* @param boolean $persistent Whether to create a persistent connection
* @param string $db_name The database name
* @param string $db_host The database host (the server)
* @param string $db_user The database connection username
* @param string $db_password The database connection password
* @param boolean $fail_ok Whether to on error echo an error and return with a null, rather than giving a critical error
* @return ?mixed A database connection (null: failed)
*/
public function get_connection(bool $persistent, string $db_name, string $db_host, string $db_user, string $db_password, bool $fail_ok = false)