mirror of
https://github.com/dg/dibi.git
synced 2025-08-08 15:16:58 +02:00
This commit is contained in:
@@ -30,9 +30,11 @@ if (version_compare(PHP_VERSION , '5.1.0', '<')) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// libraries
|
// nette libraries
|
||||||
require_once __FILE__ . '/../libs/NObject.php';
|
if (!class_exists('NObject', FALSE)) { require_once __FILE__ . '/../libs/NObject.php'; }
|
||||||
require_once __FILE__ . '/../libs/NException.php';
|
if (!class_exists('NException', FALSE)) { require_once __FILE__ . '/../libs/NException.php'; }
|
||||||
|
|
||||||
|
// dibi libraries
|
||||||
require_once __FILE__ . '/../libs/DibiException.php';
|
require_once __FILE__ . '/../libs/DibiException.php';
|
||||||
require_once __FILE__ . '/../libs/DibiConnection.php';
|
require_once __FILE__ . '/../libs/DibiConnection.php';
|
||||||
require_once __FILE__ . '/../libs/DibiDriverInterface.php';
|
require_once __FILE__ . '/../libs/DibiDriverInterface.php';
|
||||||
|
@@ -93,20 +93,17 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($config['socket'])) {
|
if (empty($config['socket'])) {
|
||||||
$host = $config['host'] . (empty($config['port']) ? '' : ':' . $config['port']);
|
$host = $config['host'] . (empty($config['port']) ? '' : ':' . $config['port']);
|
||||||
} else {
|
} else {
|
||||||
$host = ':' . $config['socket'];
|
$host = ':' . $config['socket'];
|
||||||
}
|
}
|
||||||
|
|
||||||
NException::catchError('DibiDatabaseException');
|
|
||||||
if (empty($config['persistent'])) {
|
if (empty($config['persistent'])) {
|
||||||
$this->connection = @mysql_connect($host, $config['username'], $config['password'], TRUE, $config['options']);
|
$this->connection = @mysql_connect($host, $config['username'], $config['password'], TRUE, $config['options']);
|
||||||
} else {
|
} else {
|
||||||
$this->connection = @mysql_pconnect($host, $config['username'], $config['password'], $config['options']);
|
$this->connection = @mysql_pconnect($host, $config['username'], $config['password'], $config['options']);
|
||||||
}
|
}
|
||||||
NException::restore();
|
|
||||||
|
|
||||||
if (!is_resource($this->connection)) {
|
if (!is_resource($this->connection)) {
|
||||||
throw new DibiDatabaseException(mysql_error(), mysql_errno());
|
throw new DibiDatabaseException(mysql_error(), mysql_errno());
|
||||||
|
@@ -24,7 +24,9 @@
|
|||||||
*
|
*
|
||||||
* @author David Grudl
|
* @author David Grudl
|
||||||
* @copyright Copyright (c) 2004, 2007 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
|
class NException extends Exception
|
||||||
{
|
{
|
||||||
|
@@ -19,12 +19,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* compatiblity
|
|
||||||
*/
|
|
||||||
if (!class_exists('NObject', FALSE)) {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NObject is the ultimate ancestor of all instantiable classes.
|
* NObject is the ultimate ancestor of all instantiable classes.
|
||||||
*
|
*
|
||||||
@@ -241,6 +235,3 @@ abstract class NClass
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@@ -1,34 +1,17 @@
|
|||||||
OK: SELECT * FROM [customers] WHERE [customer_id] = 1;
|
OK: SELECT * FROM [customers] WHERE [customer_id] = 1;
|
||||||
-- rows: 1
|
-- rows: 1
|
||||||
-- takes: 0.294 ms
|
-- takes: 0.395 ms
|
||||||
-- driver: sqlite
|
-- driver: sqlite
|
||||||
-- 2007-11-15 00:01:13
|
-- 2007-11-15 01:19:00
|
||||||
|
|
||||||
OK: SELECT * FROM [customers] WHERE [customer_id] < 5;
|
OK: SELECT * FROM [customers] WHERE [customer_id] < 5;
|
||||||
-- rows: 4
|
-- rows: 4
|
||||||
-- takes: 0.366 ms
|
-- takes: 0.437 ms
|
||||||
-- driver: sqlite
|
-- driver: sqlite
|
||||||
-- 2007-11-15 00:01:13
|
-- 2007-11-15 01:19:00
|
||||||
|
|
||||||
ERROR: [1] near "FROM": syntax error
|
ERROR: [1] near "FROM": syntax error
|
||||||
-- SQL: SELECT FROM [customers] WHERE [customer_id] < 38
|
-- SQL: SELECT FROM [customers] WHERE [customer_id] < 38
|
||||||
-- driver: ;
|
-- driver: ;
|
||||||
-- 2007-11-15 00:01:13
|
-- 2007-11-15 01:19:00
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user