From c174e201353960c7c2e59a39bd525be3427e8421 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 15 Nov 2007 00:19:41 +0000 Subject: [PATCH] --- dibi/dibi.php | 8 +++++--- dibi/drivers/mysql.php | 3 --- dibi/libs/NException.php | 4 +++- dibi/libs/NObject.php | 9 --------- examples/log.sql | 27 +++++---------------------- 5 files changed, 13 insertions(+), 38 deletions(-) diff --git a/dibi/dibi.php b/dibi/dibi.php index 99ac9216..317c0610 100644 --- a/dibi/dibi.php +++ b/dibi/dibi.php @@ -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'; diff --git a/dibi/drivers/mysql.php b/dibi/drivers/mysql.php index 4413a1bd..c3046075 100644 --- a/dibi/drivers/mysql.php +++ b/dibi/drivers/mysql.php @@ -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()); diff --git a/dibi/libs/NException.php b/dibi/libs/NException.php index 48a94882..5b89e8ec 100644 --- a/dibi/libs/NException.php +++ b/dibi/libs/NException.php @@ -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 { diff --git a/dibi/libs/NObject.php b/dibi/libs/NObject.php index 77a9a313..5e6b0caf 100644 --- a/dibi/libs/NObject.php +++ b/dibi/libs/NObject.php @@ -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 } } - - -} \ No newline at end of file diff --git a/examples/log.sql b/examples/log.sql index 9cf316a0..1c4f65da 100644 --- a/examples/log.sql +++ b/examples/log.sql @@ -1,34 +1,17 @@ OK: SELECT * FROM [customers] WHERE [customer_id] = 1; -- rows: 1 --- takes: 0.294 ms +-- takes: 0.395 ms -- driver: sqlite --- 2007-11-15 00:01:13 +-- 2007-11-15 01:19:00 OK: SELECT * FROM [customers] WHERE [customer_id] < 5; -- rows: 4 --- takes: 0.366 ms +-- takes: 0.437 ms -- driver: sqlite --- 2007-11-15 00:01:13 +-- 2007-11-15 01:19:00 ERROR: [1] near "FROM": syntax error -- SQL: SELECT FROM [customers] WHERE [customer_id] < 38 -- driver: ; --- 2007-11-15 00:01:13 - -OK: SELECT * FROM [customers] WHERE [customer_id] = 1; --- rows: 1 --- takes: 0.299 ms --- driver: sqlite --- 2007-11-15 00:04:41 - -OK: SELECT * FROM [customers] WHERE [customer_id] < 5; --- rows: 4 --- takes: 0.274 ms --- driver: sqlite --- 2007-11-15 00:04:41 - -ERROR: [1] near "FROM": syntax error --- SQL: SELECT FROM [customers] WHERE [customer_id] < 38 --- driver: ; --- 2007-11-15 00:04:41 +-- 2007-11-15 01:19:00