1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-06 14:16:39 +02:00

DibiConnection::sql() renamed to verb translate()

This commit is contained in:
David Grudl
2010-08-04 12:10:29 +02:00
parent 746a553419
commit 5cce595518
3 changed files with 15 additions and 4 deletions

View File

@@ -260,7 +260,7 @@ class DibiConnection extends DibiObject
* @return string * @return string
* @throws DibiException * @throws DibiException
*/ */
final public function sql($args) final public function translate($args)
{ {
$this->connected || $this->connect(); $this->connected || $this->connect();
$args = func_get_args(); $args = func_get_args();
@@ -269,6 +269,17 @@ class DibiConnection extends DibiObject
/** @deprecated */
function sql($args)
{
trigger_error(__METHOD__ . '() is deprecated; use translate() instead.', E_USER_NOTICE);
$this->connected || $this->connect();
$args = func_get_args();
return $this->translator->translate($args);
}
/** /**
* Generates and prints SQL query. * Generates and prints SQL query.
* @param array|mixed one or more arguments * @param array|mixed one or more arguments

View File

@@ -286,7 +286,7 @@ class DibiDataSource extends DibiObject implements IDataSource
*/ */
public function __toString() public function __toString()
{ {
return $this->connection->sql(' return $this->connection->translate('
SELECT %n', (empty($this->cols) ? '*' : $this->cols), ' SELECT %n', (empty($this->cols) ? '*' : $this->cols), '
FROM %SQL', $this->sql, ' FROM %SQL', $this->sql, '
%ex', $this->conds ? array('WHERE %and', $this->conds) : NULL, ' %ex', $this->conds ? array('WHERE %and', $this->conds) : NULL, '

View File

@@ -422,7 +422,7 @@ class DibiFluent extends DibiObject implements IDataSource
*/ */
public function toDataSource() public function toDataSource()
{ {
return new DibiDataSource($this->connection->sql($this->_export()), $this->connection); return new DibiDataSource($this->connection->translate($this->_export()), $this->connection);
} }
@@ -433,7 +433,7 @@ class DibiFluent extends DibiObject implements IDataSource
*/ */
final public function __toString() final public function __toString()
{ {
return $this->connection->sql($this->_export()); return $this->connection->translate($this->_export());
} }