@@ -30,34 +30,34 @@ |
||
30 | 30 | |
31 | 31 | class PgSqlExpressionBuilder extends ExpressionBuilder { |
32 | 32 | |
33 | - /** |
|
34 | - * Returns a IQueryFunction that casts the column to the given type |
|
35 | - * |
|
36 | - * @param string $column |
|
37 | - * @param mixed $type One of IQueryBuilder::PARAM_* |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public function castColumn($column, $type) { |
|
41 | - if ($type === IQueryBuilder::PARAM_INT) { |
|
42 | - $column = $this->helper->quoteColumnName($column); |
|
43 | - return new QueryFunction('CAST(' . $column . ' AS INT)'); |
|
44 | - } |
|
45 | - |
|
46 | - if ($type === IQueryBuilder::PARAM_STR) { |
|
47 | - $column = $this->helper->quoteColumnName($column); |
|
48 | - return new QueryFunction('CAST(' . $column . ' AS TEXT)'); |
|
49 | - } |
|
50 | - |
|
51 | - return parent::castColumn($column, $type); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @inheritdoc |
|
56 | - */ |
|
57 | - public function iLike($x, $y, $type = null) { |
|
58 | - $x = $this->helper->quoteColumnName($x); |
|
59 | - $y = $this->helper->quoteColumnName($y); |
|
60 | - return $this->expressionBuilder->comparison($x, 'ILIKE', $y); |
|
61 | - } |
|
33 | + /** |
|
34 | + * Returns a IQueryFunction that casts the column to the given type |
|
35 | + * |
|
36 | + * @param string $column |
|
37 | + * @param mixed $type One of IQueryBuilder::PARAM_* |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public function castColumn($column, $type) { |
|
41 | + if ($type === IQueryBuilder::PARAM_INT) { |
|
42 | + $column = $this->helper->quoteColumnName($column); |
|
43 | + return new QueryFunction('CAST(' . $column . ' AS INT)'); |
|
44 | + } |
|
45 | + |
|
46 | + if ($type === IQueryBuilder::PARAM_STR) { |
|
47 | + $column = $this->helper->quoteColumnName($column); |
|
48 | + return new QueryFunction('CAST(' . $column . ' AS TEXT)'); |
|
49 | + } |
|
50 | + |
|
51 | + return parent::castColumn($column, $type); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @inheritdoc |
|
56 | + */ |
|
57 | + public function iLike($x, $y, $type = null) { |
|
58 | + $x = $this->helper->quoteColumnName($x); |
|
59 | + $y = $this->helper->quoteColumnName($y); |
|
60 | + return $this->expressionBuilder->comparison($x, 'ILIKE', $y); |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |
@@ -40,12 +40,12 @@ |
||
40 | 40 | public function castColumn($column, $type) { |
41 | 41 | if ($type === IQueryBuilder::PARAM_INT) { |
42 | 42 | $column = $this->helper->quoteColumnName($column); |
43 | - return new QueryFunction('CAST(' . $column . ' AS INT)'); |
|
43 | + return new QueryFunction('CAST('.$column.' AS INT)'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if ($type === IQueryBuilder::PARAM_STR) { |
47 | 47 | $column = $this->helper->quoteColumnName($column); |
48 | - return new QueryFunction('CAST(' . $column . ' AS TEXT)'); |
|
48 | + return new QueryFunction('CAST('.$column.' AS TEXT)'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return parent::castColumn($column, $type); |