Skip to content
Permalink
Browse files

Fixing tests in postgres

  • Loading branch information...
lorenzo committed Aug 15, 2013
1 parent e043699 commit 5ad4b20f31d57a7ec377eef190831c1138e4d379
Showing with 7 additions and 2 deletions.
  1. +6 −1 lib/Cake/Database/Dialect/PostgresDialectTrait.php
  2. +1 −1 lib/Cake/Database/Query.php
@@ -17,6 +17,7 @@
namespace Cake\Database\Dialect;
use Cake\Database\Expression\FunctionExpression;
use Cake\Database\Expression\OrderByExpression;
use Cake\Database\Expression\UnaryExpression;
use Cake\Database\Query;
use Cake\Database\SqlDialectTrait;
@@ -69,6 +70,10 @@ protected function _selectQueryTranslator($query) {
$outer->where(["$field <=" => (int)$offset + (int)$limit]);
}
if ($order === null) {
$order = new OrderByExpression('NULL');
}
$query
->select(['_cake_page_rownum_' => new UnaryExpression($order, [], 'ROW_NUMBER() OVER')])
->limit(null)
@@ -129,7 +134,7 @@ protected function _transformFunctionExpression(FunctionExpression $expression)
->name('')
->type('-')
->iterateParts(function($p) {
return new FunctionExpression('DATE', [$p => 'literal']);
return new FunctionExpression('DATE', [$p['value']], [$p['type']]);
});
break;
case 'CURRENT_DATE':
@@ -445,7 +445,7 @@ protected function _buildSelectPart($parts, $generator) {
}
if (is_array($this->_parts['distinct'])) {
$distinct = $this->_stringifyExpressions($this->_parts['distinct']);
$distinct = $this->_stringifyExpressions($this->_parts['distinct'], $generator);
$distinct = sprintf('DISTINCT ON (%s) ', implode(', ', $distinct));
}

0 comments on commit 5ad4b20

Please sign in to comment.
You can’t perform that action at this time.