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

DibiDataSource: better table name detection in __construct

This commit is contained in:
David Grudl
2010-02-16 19:19:32 +01:00
parent ec1a1ec5b9
commit 576397319a

View File

@@ -58,7 +58,7 @@ class DibiDataSource extends DibiObject implements IDataSource
*/
public function __construct($sql, DibiConnection $connection)
{
if (strpos($sql, ' ') === FALSE) {
if (strpbrk($sql, " \t\r\n") === FALSE) {
$this->sql = $connection->getDriver()->escape($sql, dibi::IDENTIFIER); // table name
} else {
$this->sql = '(' . $sql . ') t'; // SQL command