mirror of
https://github.com/dg/dibi.git
synced 2025-08-13 09:34:30 +02:00
- Oracle driver: implemented applyLimit() & getTables()
- DibiDataSource: removed key word AS - DibiProfiler: fixed bug with unbuffered queries - DibiTranslator: empty %and generates '1=1'
This commit is contained in:
@@ -70,7 +70,7 @@ class DibiDataSource extends DibiObject implements IDataSource
|
||||
if (strpos($sql, ' ') === FALSE) {
|
||||
$this->sql = $sql; // table name
|
||||
} else {
|
||||
$this->sql = '(' . $sql . ') AS t'; // SQL command
|
||||
$this->sql = '(' . $sql . ') t'; // SQL command
|
||||
}
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
@@ -108,11 +108,17 @@ class DibiProfiler extends DibiObject implements IDibiProfiler
|
||||
if (($event & $this->filter) === 0) return;
|
||||
|
||||
if ($event & self::QUERY) {
|
||||
try {
|
||||
$count = $res instanceof DibiResult ? count($res) : '-';
|
||||
} catch (Exception $e) {
|
||||
$count = '?';
|
||||
}
|
||||
|
||||
if ($this->useFirebug && !headers_sent()) {
|
||||
self::$table[] = array(
|
||||
sprintf('%0.3f', dibi::$elapsedTime * 1000),
|
||||
trim($sql),
|
||||
$res instanceof DibiResult ? count($res) : '-',
|
||||
$count,
|
||||
$connection->getConfig('driver') . '/' . $connection->getConfig('name')
|
||||
);
|
||||
|
||||
@@ -138,7 +144,7 @@ class DibiProfiler extends DibiObject implements IDibiProfiler
|
||||
if ($this->file) {
|
||||
$this->writeFile(
|
||||
"OK: " . $sql
|
||||
. ($res instanceof DibiResult ? ";\n-- rows: " . count($res) : '')
|
||||
. ($res instanceof DibiResult ? ";\n-- rows: " . $count : '')
|
||||
. "\n-- takes: " . sprintf('%0.3f', dibi::$elapsedTime * 1000) . ' ms'
|
||||
. "\n-- driver: " . $connection->getConfig('driver') . '/' . $connection->getConfig('name')
|
||||
. "\n-- " . date('Y-m-d H:i:s')
|
||||
|
@@ -210,7 +210,7 @@ final class DibiTranslator extends DibiObject
|
||||
case 'and':
|
||||
case 'or': // key=val AND key IS NULL AND ...
|
||||
if (empty($value)) {
|
||||
return $this->driver->escape(TRUE, 'b');
|
||||
return '1=1';
|
||||
}
|
||||
|
||||
foreach ($value as $k => $v) {
|
||||
|
Reference in New Issue
Block a user