From e37af6f99ddf4d68f21d47ed996a11888b22ca29 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 16 Feb 2011 18:01:22 +0100 Subject: [PATCH] added IDibiVariable --- dibi/libs/DibiTranslator.php | 3 +++ dibi/libs/interfaces.php | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/dibi/libs/DibiTranslator.php b/dibi/libs/DibiTranslator.php index 6737f844..372c7b12 100644 --- a/dibi/libs/DibiTranslator.php +++ b/dibi/libs/DibiTranslator.php @@ -439,6 +439,9 @@ final class DibiTranslator extends DibiObject } elseif ($value instanceof DateTime) { return $this->driver->escape($value, dibi::DATETIME); + } elseif ($value instanceof IDibiVariable) { + return (string) $value->toSql(); + } else { $this->hasError = TRUE; return '**Unexpected ' . gettype($value) . '**'; diff --git a/dibi/libs/interfaces.php b/dibi/libs/interfaces.php index 6a42c15d..1c0c41b4 100644 --- a/dibi/libs/interfaces.php +++ b/dibi/libs/interfaces.php @@ -25,6 +25,17 @@ interface IDataSource extends Countable, IteratorAggregate +/** + * Object that is able to generate SQL. + * @package dibi + */ +interface IDibiVariable +{ + + function toSql(); + +} + /**