mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 22:26:43 +02:00
__toString() do not throw an exception [Closes #19]
This commit is contained in:
@@ -285,6 +285,7 @@ class DibiDataSource extends DibiObject implements IDataSource
|
|||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
return $this->connection->translate('
|
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, '
|
||||||
@@ -292,6 +293,9 @@ class DibiDataSource extends DibiObject implements IDataSource
|
|||||||
%ex', $this->sorting ? array('ORDER BY %by', $this->sorting) : NULL, '
|
%ex', $this->sorting ? array('ORDER BY %by', $this->sorting) : NULL, '
|
||||||
%ofs %lmt', $this->offset, $this->limit
|
%ofs %lmt', $this->offset, $this->limit
|
||||||
);
|
);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
trigger_error($e->getMessage(), E_USER_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -434,7 +434,11 @@ class DibiFluent extends DibiObject implements IDataSource
|
|||||||
*/
|
*/
|
||||||
final public function __toString()
|
final public function __toString()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
return $this->connection->translate($this->_export());
|
return $this->connection->translate($this->_export());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
trigger_error($e->getMessage(), E_USER_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user