mirror of
https://github.com/dg/dibi.git
synced 2025-08-15 10:34:06 +02:00
remove operator @ in connect() methods
This commit is contained in:
@@ -48,14 +48,15 @@ class DibiMySqlDriver extends DibiDriver {
|
||||
if (!extension_loaded('mysql'))
|
||||
return new DibiException("PHP extension 'mysql' is not loaded");
|
||||
|
||||
foreach (array('username', 'password', 'protocol') as $var)
|
||||
if (!isset($config[$var])) $config[$var] = NULL;
|
||||
|
||||
if (empty($config['host'])) $config['host'] = 'localhost';
|
||||
|
||||
if (@$config['protocol'] === 'unix') // host can be socket
|
||||
if ($config['protocol'] === 'unix') // host can be socket
|
||||
$host = ':' . $config['host'];
|
||||
else
|
||||
$host = $config['host'] . (empty($config['port']) ? '' : $config['port']);
|
||||
|
||||
$host = $config['host'] . (empty($config['port']) ? '' : ':'.$config['port']);
|
||||
|
||||
// some errors aren't handled. Must use $php_errormsg
|
||||
if (function_exists('ini_set'))
|
||||
@@ -63,9 +64,9 @@ class DibiMySqlDriver extends DibiDriver {
|
||||
$php_errormsg = '';
|
||||
|
||||
if (empty($config['persistent']))
|
||||
$conn = @mysql_connect($host, @$config['username'], @$config['password']);
|
||||
$conn = @mysql_connect($host, $config['username'], $config['password']);
|
||||
else
|
||||
$conn = @mysql_pconnect($host, @$config['username'], @$config['password']);
|
||||
$conn = @mysql_pconnect($host, $config['username'], $config['password']);
|
||||
|
||||
if (function_exists('ini_set'))
|
||||
ini_set('track_errors', $save);
|
||||
|
@@ -48,7 +48,10 @@ class DibiMySqliDriver extends DibiDriver {
|
||||
|
||||
if (empty($config['host'])) $config['host'] = 'localhost';
|
||||
|
||||
$conn = @mysqli_connect($config['host'], @$config['username'], @$config['password'], @$config['database'], @$config['port']);
|
||||
foreach (array('username', 'password', 'database', 'port') as $var)
|
||||
if (!isset($config[$var])) $config[$var] = NULL;
|
||||
|
||||
$conn = @mysqli_connect($config['host'], $config['username'], $config['password'], $config['database'], $config['port']);
|
||||
|
||||
if (!$conn)
|
||||
return new DibiException("Connecting error", array(
|
||||
|
@@ -45,10 +45,16 @@ class DibiOdbcDriver extends DibiDriver {
|
||||
if (!extension_loaded('odbc'))
|
||||
return new DibiException("PHP extension 'odbc' is not loaded");
|
||||
|
||||
if (@$config['persistent'])
|
||||
$conn = @odbc_pconnect($config['database'], $config['username'], $config['password']);
|
||||
else
|
||||
if (!isset($config['username']))
|
||||
return new DibiException("Username must be specified");
|
||||
|
||||
if (!isset($config['password']))
|
||||
return new DibiException("Password must be specified");
|
||||
|
||||
if (empty($config['persistent']))
|
||||
$conn = @odbc_connect($config['database'], $config['username'], $config['password']);
|
||||
else
|
||||
$conn = @odbc_pconnect($config['database'], $config['username'], $config['password']);
|
||||
|
||||
if (!is_resource($conn))
|
||||
return new DibiException("Connecting error", array(
|
||||
|
@@ -49,11 +49,14 @@ class DibiSqliteDriver extends DibiDriver {
|
||||
if (empty($config['database']))
|
||||
return new DibiException("Database must be specified");
|
||||
|
||||
if (!isset($config['mode']))
|
||||
$config['mode'] = 0666;
|
||||
|
||||
$errorMsg = '';
|
||||
if (empty($config['persistent']))
|
||||
$conn = @sqlite_open($config['database'], @$config['mode'], $errorMsg);
|
||||
$conn = @sqlite_open($config['database'], $config['mode'], $errorMsg);
|
||||
else
|
||||
$conn = @sqlite_popen($config['database'], @$config['mode'], $errorMsg);
|
||||
$conn = @sqlite_popen($config['database'], $config['mode'], $errorMsg);
|
||||
|
||||
if (!$conn)
|
||||
return new DibiException("Connecting error", array(
|
||||
|
Reference in New Issue
Block a user