From 2a5934c385c575636b43d7860d6234581b83aff1 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 12 Jan 2012 00:43:06 +0100 Subject: [PATCH] removed IDibiVariable & DibiVariable, replaced with DibiLiteral --- dibi/dibi.php | 15 +------------- dibi/libs/DibiLiteral.php | 40 ++++++++++++++++++++++++++++++++++++ dibi/libs/DibiTranslator.php | 4 ++-- dibi/libs/interfaces.php | 13 ------------ 4 files changed, 43 insertions(+), 29 deletions(-) create mode 100644 dibi/libs/DibiLiteral.php diff --git a/dibi/dibi.php b/dibi/dibi.php index 1b4cccb9..da217aa6 100644 --- a/dibi/dibi.php +++ b/dibi/dibi.php @@ -24,6 +24,7 @@ if (version_compare(PHP_VERSION, '5.2.0', '<')) { require_once dirname(__FILE__) . '/libs/interfaces.php'; require_once dirname(__FILE__) . '/libs/DibiDateTime.php'; require_once dirname(__FILE__) . '/libs/DibiObject.php'; +require_once dirname(__FILE__) . '/libs/DibiLiteral.php'; require_once dirname(__FILE__) . '/libs/DibiHashMap.php'; require_once dirname(__FILE__) . '/libs/DibiException.php'; require_once dirname(__FILE__) . '/libs/DibiConnection.php'; @@ -43,20 +44,6 @@ if (interface_exists('Nette\Diagnostics\IBarPanel') || interface_exists('IBarPan -/** - * @deprecated - */ -class DibiVariable extends DibiDateTime -{ - function __construct($val) - { - parent::__construct($val); - trigger_error(__CLASS__ . ' is deprecated; use class DateTime instead.', E_USER_WARNING); - } -} - - - /** diff --git a/dibi/libs/DibiLiteral.php b/dibi/libs/DibiLiteral.php new file mode 100644 index 00000000..94d91179 --- /dev/null +++ b/dibi/libs/DibiLiteral.php @@ -0,0 +1,40 @@ +value = (string) $value; + } + + + + /** + * @return string + */ + public function __toString() + { + return $this->value; + } + +} diff --git a/dibi/libs/DibiTranslator.php b/dibi/libs/DibiTranslator.php index 1b9a2924..7640743c 100644 --- a/dibi/libs/DibiTranslator.php +++ b/dibi/libs/DibiTranslator.php @@ -438,8 +438,8 @@ final class DibiTranslator extends DibiObject } elseif ($value instanceof DateTime) { return $this->driver->escape($value, dibi::DATETIME); - } elseif ($value instanceof IDibiVariable) { - return (string) $value->toSql(); + } elseif ($value instanceof DibiLiteral) { + return (string) $value; } else { $this->hasError = TRUE; diff --git a/dibi/libs/interfaces.php b/dibi/libs/interfaces.php index a541fe38..79c4d01f 100644 --- a/dibi/libs/interfaces.php +++ b/dibi/libs/interfaces.php @@ -23,19 +23,6 @@ interface IDataSource extends Countable, IteratorAggregate -/** - * Object that is able to generate SQL. - * @package dibi - */ -interface IDibiVariable -{ - - function toSql(); - -} - - - /** * dibi driver interface. * @package dibi