1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-21 05:11:49 +02:00
This commit is contained in:
David Grudl
2007-11-15 00:19:41 +00:00
parent 6bfa40f594
commit c174e20135
5 changed files with 13 additions and 38 deletions

View File

@@ -30,9 +30,11 @@ if (version_compare(PHP_VERSION , '5.1.0', '<')) {
// libraries
require_once __FILE__ . '/../libs/NObject.php';
require_once __FILE__ . '/../libs/NException.php';
// nette libraries
if (!class_exists('NObject', FALSE)) { require_once __FILE__ . '/../libs/NObject.php'; }
if (!class_exists('NException', FALSE)) { require_once __FILE__ . '/../libs/NException.php'; }
// dibi libraries
require_once __FILE__ . '/../libs/DibiException.php';
require_once __FILE__ . '/../libs/DibiConnection.php';
require_once __FILE__ . '/../libs/DibiDriverInterface.php';

View File

@@ -93,20 +93,17 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface
}
}
if (empty($config['socket'])) {
$host = $config['host'] . (empty($config['port']) ? '' : ':' . $config['port']);
} else {
$host = ':' . $config['socket'];
}
NException::catchError('DibiDatabaseException');
if (empty($config['persistent'])) {
$this->connection = @mysql_connect($host, $config['username'], $config['password'], TRUE, $config['options']);
} else {
$this->connection = @mysql_pconnect($host, $config['username'], $config['password'], $config['options']);
}
NException::restore();
if (!is_resource($this->connection)) {
throw new DibiDatabaseException(mysql_error(), mysql_errno());

View File

@@ -24,7 +24,9 @@
*
* @author David Grudl
* @copyright Copyright (c) 2004, 2007 David Grudl
* @package Nette-Exception
* @license http://php7.org/nette/license Nette license
* @link http://php7.org/nette/
* @package Nette
*/
class NException extends Exception
{

View File

@@ -19,12 +19,6 @@
/**
* compatiblity
*/
if (!class_exists('NObject', FALSE)) {
/**
* NObject is the ultimate ancestor of all instantiable classes.
*
@@ -241,6 +235,3 @@ abstract class NClass
}
}
}