1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-04 21:28:02 +02:00

- DibiDataSource: added escaping

This commit is contained in:
David Grudl
2009-06-13 19:05:23 +00:00
parent bf15d60fd1
commit c67bcd5598

View File

@@ -62,13 +62,13 @@ class DibiDataSource extends DibiObject implements IDataSource
/** /**
* @param string SQL command or table name, as data source * @param string SQL command or table or view name, as data source
* @param DibiConnection connection * @param DibiConnection connection
*/ */
public function __construct($sql, DibiConnection $connection) public function __construct($sql, DibiConnection $connection)
{ {
if (strpos($sql, ' ') === FALSE) { if (strpos($sql, ' ') === FALSE) {
$this->sql = $sql; // table name $this->sql = $connection->getDriver()->escape($sql, dibi::IDENTIFIER); // table name
} else { } else {
$this->sql = '(' . $sql . ') t'; // SQL command $this->sql = '(' . $sql . ') t'; // SQL command
} }