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:
@@ -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
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user