mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:04:53 +01:00
new constructor, which can be passed the connection-data as an array
This commit is contained in:
parent
81e1887e24
commit
e568a02b2e
@ -243,6 +243,29 @@ class egw_db
|
||||
|
||||
var $prepared_sql = array(); // sql is the index
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $db_data=null values for keys 'db_name', 'db_host', 'db_port', 'db_user', 'db_pass', 'db_type'
|
||||
*/
|
||||
function __construct(array $db_data=null)
|
||||
{
|
||||
if (!is_null($db_data))
|
||||
{
|
||||
foreach(array(
|
||||
'Database' => 'db_name',
|
||||
'Host' => 'db_host',
|
||||
'Port' => 'db_port',
|
||||
'User' => 'db_user',
|
||||
'Password' => 'db_pass',
|
||||
'Type' => 'db_type',
|
||||
) as $var => $key)
|
||||
{
|
||||
$this->$var = $db_data[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query query to be executed (optional)
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user