@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | protected function returnFunction() |
| 206 | 206 | { |
| 207 | - return $this->isGroupOpen === true ? $this : $this->query; |
|
| 207 | + return $this->isGroupOpen === true ? $this : $this->query; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $sql .= ')'; |
| 263 | 263 | break; |
| 264 | 264 | |
| 265 | - case 'NULL': |
|
| 265 | + case 'NULL': |
|
| 266 | 266 | case 'NOT_NULL': |
| 267 | 267 | $sql .= $isSqlNeedOperator ? ' '.$currentOperator.' ' : ''; |
| 268 | 268 | $sql .= $item['sql']; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | if (is_string($item['value']) && |
| 280 | 280 | strlen($item['value']) > strlen(Patabase\Constants::COLUMN_LITERALL) && |
| 281 | 281 | substr($item['value'], 0, strlen(Patabase\Constants::COLUMN_LITERALL)) === |
| 282 | - Patabase\Constants::COLUMN_LITERALL) { |
|
| 282 | + Patabase\Constants::COLUMN_LITERALL) { |
|
| 283 | 283 | |
| 284 | 284 | $arg = substr($item['value'], strlen(Patabase\Constants::COLUMN_LITERALL)); |
| 285 | 285 | $sql .= $isSqlNeedOperator ? ' '.$currentOperator.' ' : ''; |
@@ -143,9 +143,9 @@ |
||
| 143 | 143 | $sqlWhere = (isset($this->where)) ? $this->where->sql() : ''; |
| 144 | 144 | $sqlTableName = $this->escape($this->tableName); |
| 145 | 145 | return trim(sprintf('UPDATE %s SET %s %s', |
| 146 | - $sqlTableName, |
|
| 147 | - $this->sqlColumns(), |
|
| 148 | - $sqlWhere |
|
| 146 | + $sqlTableName, |
|
| 147 | + $this->sqlColumns(), |
|
| 148 | + $sqlWhere |
|
| 149 | 149 | )); |
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | \ No newline at end of file |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | * @param string $tableName The name of the table |
| 98 | 98 | * |
| 99 | 99 | * @return bool True if the table has been dropped, otherwise false |
| 100 | - */ |
|
| 100 | + */ |
|
| 101 | 101 | public function dropTable(string $tableName): bool |
| 102 | 102 | { |
| 103 | 103 | $sql = trim(sprintf('DROP TABLE %s', $tableName)); |
@@ -131,8 +131,8 @@ |
||
| 131 | 131 | */ |
| 132 | 132 | public function escape(string $str): string |
| 133 | 133 | { |
| 134 | - $list = explode('.', $str); |
|
| 135 | - return implode('.', $this->escapeList($list)); |
|
| 134 | + $list = explode('.', $str); |
|
| 135 | + return implode('.', $this->escapeList($list)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | protected function getArgName(string $column): string |
| 63 | 63 | { |
| 64 | - return '_' . str_replace('.', '_', $column); |
|
| 64 | + return '_' . str_replace('.', '_', $column); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -90,12 +90,12 @@ |
||
| 90 | 90 | */ |
| 91 | 91 | public function sql(): string |
| 92 | 92 | { |
| 93 | - // Build sql where and escape table name |
|
| 94 | - $sqlWhere = (isset($this->where)) ? $this->where->sql() : ''; |
|
| 95 | - $sqlTableName = $this->escape($this->tableName); |
|
| 93 | + // Build sql where and escape table name |
|
| 94 | + $sqlWhere = (isset($this->where)) ? $this->where->sql() : ''; |
|
| 95 | + $sqlTableName = $this->escape($this->tableName); |
|
| 96 | 96 | |
| 97 | - // DELETE query |
|
| 98 | - return trim(sprintf('DELETE FROM %s %s', |
|
| 97 | + // DELETE query |
|
| 98 | + return trim(sprintf('DELETE FROM %s %s', |
|
| 99 | 99 | $sqlTableName, |
| 100 | 100 | $sqlWhere)); |
| 101 | 101 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @access protected |
| 101 | 101 | * @var QueryBuilder |
| 102 | 102 | */ |
| 103 | - protected $topQuery = null; |
|
| 103 | + protected $topQuery = null; |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * Constructor |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - /** |
|
| 124 | + /** |
|
| 125 | 125 | * Parse the columns arguments for the select query |
| 126 | 126 | * |
| 127 | 127 | * @access protected |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function count(string $alias) |
| 201 | 201 | { |
| 202 | - $this->columns[] = array( |
|
| 202 | + $this->columns[] = array( |
|
| 203 | 203 | 'type' => 'count', |
| 204 | 204 | 'alias' => $alias |
| 205 | 205 | ); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function sum(string $column, string $alias) |
| 218 | 218 | { |
| 219 | - $this->columns[] = array( |
|
| 219 | + $this->columns[] = array( |
|
| 220 | 220 | 'type' => 'sum', |
| 221 | 221 | 'name' => $column, |
| 222 | 222 | 'alias' => $alias |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | public function min(string $column, string $alias) |
| 236 | 236 | { |
| 237 | - $this->columns[] = array( |
|
| 237 | + $this->columns[] = array( |
|
| 238 | 238 | 'type' => 'min', |
| 239 | 239 | 'name' => $column, |
| 240 | 240 | 'alias' => $alias |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function max(string $column, string $alias) |
| 254 | 254 | { |
| 255 | - $this->columns[] = array( |
|
| 255 | + $this->columns[] = array( |
|
| 256 | 256 | 'type' => 'max', |
| 257 | 257 | 'name' => $column, |
| 258 | 258 | 'alias' => $alias |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | case 'sub_query': |
| 111 | 111 | $colsList[] = '('. $val['query']->sql() .') AS '. $this->escape($val['alias']); |
| 112 | 112 | break; |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | } |
| 115 | 115 | return $sqlDistinct . implode(', ', $colsList); |
| 116 | 116 | } |
@@ -158,15 +158,15 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | return trim(implode(' ', ['SELECT', |
| 161 | - $this->sqlColumns(), |
|
| 162 | - $sqlFromTable, |
|
| 163 | - $sqlJoins, |
|
| 164 | - $sqlWhere, |
|
| 165 | - $sqlGroupBy, |
|
| 166 | - $sqlHaving, |
|
| 167 | - $sqlOrderBy, |
|
| 168 | - $sqlLimit, |
|
| 169 | - $sqlOffset])); |
|
| 161 | + $this->sqlColumns(), |
|
| 162 | + $sqlFromTable, |
|
| 163 | + $sqlJoins, |
|
| 164 | + $sqlWhere, |
|
| 165 | + $sqlGroupBy, |
|
| 166 | + $sqlHaving, |
|
| 167 | + $sqlOrderBy, |
|
| 168 | + $sqlLimit, |
|
| 169 | + $sqlOffset])); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | public function getAll(string $outputFormat = 'default') |
| 181 | 181 | { |
| 182 | 182 | // execute query |
| 183 | - $exec = $this->execute(); |
|
| 183 | + $exec = $this->execute(); |
|
| 184 | 184 | |
| 185 | - // format |
|
| 186 | - $format = ($outputFormat === 'default') ? $this->driver->defaultOutputFormat() : $outputFormat; |
|
| 185 | + // format |
|
| 186 | + $format = ($outputFormat === 'default') ? $this->driver->defaultOutputFormat() : $outputFormat; |
|
| 187 | 187 | |
| 188 | 188 | // return output |
| 189 | 189 | return $this->fetchOutput($exec, $format); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function escape(string $str): string |
| 113 | 113 | { |
| 114 | - return $this->driver->escape($str); |
|
| 114 | + return $this->driver->escape($str); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function prepare() |
| 190 | 190 | { |
| 191 | - try { |
|
| 191 | + try { |
|
| 192 | 192 | // prepare is in a try catch block because sqlite for example could raise |
| 193 | 193 | // an exception when prepareing the statement (with invalid table name for example) |
| 194 | 194 | // when mysql and postres wont. |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | try { |
| 254 | 254 | // prepare bind execute |
| 255 | 255 | if (!isset($this->pdoStatement)){ |
| 256 | - if (!$this->prepare()){ |
|
| 257 | - return false; |
|
| 258 | - } |
|
| 256 | + if (!$this->prepare()){ |
|
| 257 | + return false; |
|
| 258 | + } |
|
| 259 | 259 | } |
| 260 | 260 | $this->bindValues(); |
| 261 | 261 | return $this->pdoStatement ? $this->pdoStatement->execute() : false; |