mirror of
https://github.com/dg/dibi.git
synced 2025-08-03 12:47:33 +02:00
removed IDibiVariable & DibiVariable, replaced with DibiLiteral
This commit is contained in:
@@ -24,6 +24,7 @@ if (version_compare(PHP_VERSION, '5.2.0', '<')) {
|
|||||||
require_once dirname(__FILE__) . '/libs/interfaces.php';
|
require_once dirname(__FILE__) . '/libs/interfaces.php';
|
||||||
require_once dirname(__FILE__) . '/libs/DibiDateTime.php';
|
require_once dirname(__FILE__) . '/libs/DibiDateTime.php';
|
||||||
require_once dirname(__FILE__) . '/libs/DibiObject.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/DibiHashMap.php';
|
||||||
require_once dirname(__FILE__) . '/libs/DibiException.php';
|
require_once dirname(__FILE__) . '/libs/DibiException.php';
|
||||||
require_once dirname(__FILE__) . '/libs/DibiConnection.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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
40
dibi/libs/DibiLiteral.php
Normal file
40
dibi/libs/DibiLiteral.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of the "dibi" - smart database abstraction layer.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2005 David Grudl (http://davidgrudl.com)
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the file license.txt that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SQL literal value.
|
||||||
|
*
|
||||||
|
* @author David Grudl
|
||||||
|
*/
|
||||||
|
class DibiLiteral extends DibiObject
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
private $value;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct($value)
|
||||||
|
{
|
||||||
|
$this->value = (string) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -438,8 +438,8 @@ final class DibiTranslator extends DibiObject
|
|||||||
} elseif ($value instanceof DateTime) {
|
} elseif ($value instanceof DateTime) {
|
||||||
return $this->driver->escape($value, dibi::DATETIME);
|
return $this->driver->escape($value, dibi::DATETIME);
|
||||||
|
|
||||||
} elseif ($value instanceof IDibiVariable) {
|
} elseif ($value instanceof DibiLiteral) {
|
||||||
return (string) $value->toSql();
|
return (string) $value;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->hasError = TRUE;
|
$this->hasError = TRUE;
|
||||||
|
@@ -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.
|
* dibi driver interface.
|
||||||
* @package dibi
|
* @package dibi
|
||||||
|
Reference in New Issue
Block a user