@@ -38,8 +38,8 @@ |
||
38 | 38 | public function getPHPType() |
39 | 39 | { |
40 | 40 | $dbtype = strtolower($this->getDbType()); |
41 | - foreach (self::$types as $type => $dbtypes) { |
|
42 | - if (in_array($dbtype, $dbtypes)) { |
|
41 | + foreach(self::$types as $type => $dbtypes) { |
|
42 | + if(in_array($dbtype, $dbtypes)) { |
|
43 | 43 | return $type; |
44 | 44 | } |
45 | 45 | } |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function getSchemaTableName($table) |
91 | 91 | { |
92 | - if (count($parts = explode('.', str_replace('"', '', $table))) > 1) { |
|
92 | + if(count($parts = explode('.', str_replace('"', '', $table))) > 1) { |
|
93 | 93 | return [$parts[0], $parts[1]]; |
94 | 94 | } else { |
95 | - return [$this->getDefaultSchema(),$parts[0]]; |
|
95 | + return [$this->getDefaultSchema(), $parts[0]]; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $command->bindValue(':schema', $schemaName); |
145 | 145 | $tableInfo = $this->createNewTableInfo($schemaName, $tableName); |
146 | 146 | $index = 0; |
147 | - foreach ($command->query() as $col) { |
|
147 | + foreach($command->query() as $col) { |
|
148 | 148 | $col['index'] = $index++; |
149 | 149 | $this->processColumn($tableInfo, $col); |
150 | 150 | } |
151 | - if ($index === 0) { |
|
151 | + if($index === 0) { |
|
152 | 152 | throw new TDbException('dbmetadata_invalid_table_view', $table); |
153 | 153 | } |
154 | 154 | return $tableInfo; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $info['SchemaName'] = $this->assertIdentifier($schemaName); |
165 | 165 | $info['TableName'] = $this->assertIdentifier($tableName); |
166 | - if ($this->getIsView($schemaName, $tableName)) { |
|
166 | + if($this->getIsView($schemaName, $tableName)) { |
|
167 | 167 | $info['IsView'] = true; |
168 | 168 | } |
169 | 169 | list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | protected function assertIdentifier($name) |
180 | 180 | { |
181 | - if (strpos($name, '"') !== false) { |
|
181 | + if(strpos($name, '"') !== false) { |
|
182 | 182 | $ref = 'http://www.postgresql.org/docs/7.4/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS'; |
183 | 183 | throw new TDbException('dbcommon_invalid_identifier_name', $name, $ref); |
184 | 184 | } |
@@ -216,34 +216,34 @@ discard block |
||
216 | 216 | $info['ColumnName'] = '"' . $columnId . '"'; //quote the column names! |
217 | 217 | $info['ColumnId'] = $columnId; |
218 | 218 | $info['ColumnIndex'] = $col['index']; |
219 | - if (!$col['attnotnull']) { |
|
219 | + if(!$col['attnotnull']) { |
|
220 | 220 | $info['AllowNull'] = true; |
221 | 221 | } |
222 | - if (in_array($columnId, $tableInfo->getPrimaryKeys())) { |
|
222 | + if(in_array($columnId, $tableInfo->getPrimaryKeys())) { |
|
223 | 223 | $info['IsPrimaryKey'] = true; |
224 | 224 | } |
225 | - if ($this->isForeignKeyColumn($columnId, $tableInfo)) { |
|
225 | + if($this->isForeignKeyColumn($columnId, $tableInfo)) { |
|
226 | 226 | $info['IsForeignKey'] = true; |
227 | 227 | } |
228 | 228 | |
229 | - if ($col['atttypmod'] > 0) { |
|
229 | + if($col['atttypmod'] > 0) { |
|
230 | 230 | $info['ColumnSize'] = $col['atttypmod'] - 4; |
231 | 231 | } |
232 | - if ($col['atthasdef']) { |
|
232 | + if($col['atthasdef']) { |
|
233 | 233 | $info['DefaultValue'] = $col['adsrc']; |
234 | 234 | } |
235 | - if ($col['attisserial'] || substr($col['adsrc'], 0, 8) === 'nextval(') { |
|
236 | - if (($sequence = $this->getSequenceName($tableInfo, $col['adsrc'])) !== null) { |
|
235 | + if($col['attisserial'] || substr($col['adsrc'], 0, 8) === 'nextval(') { |
|
236 | + if(($sequence = $this->getSequenceName($tableInfo, $col['adsrc'])) !== null) { |
|
237 | 237 | $info['SequenceName'] = $sequence; |
238 | 238 | unset($info['DefaultValue']); |
239 | 239 | } |
240 | 240 | } |
241 | 241 | $matches = []; |
242 | - if (preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches)) { |
|
242 | + if(preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches)) { |
|
243 | 243 | $info['DbType'] = preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']); |
244 | - if ($this->isPrecisionType($info['DbType'])) { |
|
244 | + if($this->isPrecisionType($info['DbType'])) { |
|
245 | 245 | $info['NumericPrecision'] = intval($matches[1]); |
246 | - if (count($matches) > 2) { |
|
246 | + if(count($matches) > 2) { |
|
247 | 247 | $info['NumericScale'] = intval($matches[2]); |
248 | 248 | } |
249 | 249 | } else { |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | protected function getSequenceName($tableInfo, $src) |
263 | 263 | { |
264 | 264 | $matches = []; |
265 | - if (preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches)) { |
|
266 | - if (is_int(strpos($matches[1], '.'))) { |
|
265 | + if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches)) { |
|
266 | + if(is_int(strpos($matches[1], '.'))) { |
|
267 | 267 | return $matches[1]; |
268 | 268 | } else { |
269 | 269 | return $tableInfo->getSchemaName() . '.' . $matches[1]; |
@@ -341,19 +341,19 @@ discard block |
||
341 | 341 | $command->bindValue(':schema', $schemaName); |
342 | 342 | $primary = []; |
343 | 343 | $foreign = []; |
344 | - foreach ($command->query() as $row) { |
|
345 | - switch ($row['contype']) { |
|
344 | + foreach($command->query() as $row) { |
|
345 | + switch($row['contype']) { |
|
346 | 346 | case 'p': |
347 | 347 | $primary = $this->getPrimaryKeys($tableName, $schemaName, $row['indkey']); |
348 | 348 | break; |
349 | 349 | case 'f': |
350 | - if (($fkey = $this->getForeignKeys($row['consrc'])) !== null) { |
|
350 | + if(($fkey = $this->getForeignKeys($row['consrc'])) !== null) { |
|
351 | 351 | $foreign[] = $fkey; |
352 | 352 | } |
353 | 353 | break; |
354 | 354 | } |
355 | 355 | } |
356 | - return [$primary,$foreign]; |
|
356 | + return [$primary, $foreign]; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $command->bindValue(':schema', $schemaName); |
380 | 380 | // $command->bindValue(':columnIndex', join(', ', explode(' ', $columnIndex))); |
381 | 381 | $primary = []; |
382 | - foreach ($command->query() as $row) { |
|
382 | + foreach($command->query() as $row) { |
|
383 | 383 | $primary[] = $row['attname']; |
384 | 384 | } |
385 | 385 | |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | $matches = []; |
397 | 397 | $brackets = '\(([^\)]+)\)'; |
398 | 398 | $find = "/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i"; |
399 | - if (preg_match($find, $src, $matches)) { |
|
399 | + if(preg_match($find, $src, $matches)) { |
|
400 | 400 | $keys = preg_split('/,\s+/', $matches[1]); |
401 | 401 | $fkeys = []; |
402 | - foreach (preg_split('/,\s+/', $matches[3]) as $i => $fkey) { |
|
402 | + foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey) { |
|
403 | 403 | $fkeys[$keys[$i]] = $fkey; |
404 | 404 | } |
405 | 405 | return ['table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys]; |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | */ |
414 | 414 | protected function isForeignKeyColumn($columnId, $tableInfo) |
415 | 415 | { |
416 | - foreach ($tableInfo->getForeignKeys() as $fk) { |
|
417 | - if (in_array($columnId, array_keys($fk['keys']))) { |
|
416 | + foreach($tableInfo->getForeignKeys() as $fk) { |
|
417 | + if(in_array($columnId, array_keys($fk['keys']))) { |
|
418 | 418 | return true; |
419 | 419 | } |
420 | 420 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | */ |
430 | 430 | public function findTableNames($schema = 'public') |
431 | 431 | { |
432 | - if ($schema === '') { |
|
432 | + if($schema === '') { |
|
433 | 433 | $schema = self::DEFAULT_SCHEMA; |
434 | 434 | } |
435 | 435 | $sql = <<<EOD |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | $command->bindParam(':schema', $schema); |
441 | 441 | $rows = $command->queryAll(); |
442 | 442 | $names = []; |
443 | - foreach ($rows as $row) { |
|
444 | - if ($schema === self::DEFAULT_SCHEMA) { |
|
443 | + foreach($rows as $row) { |
|
444 | + if($schema === self::DEFAULT_SCHEMA) { |
|
445 | 445 | $names[] = $row['table_name']; |
446 | 446 | } else { |
447 | 447 | $names[] = $row['table_schema'] . '.' . $row['table_name']; |
@@ -39,8 +39,8 @@ |
||
39 | 39 | public function getPHPType() |
40 | 40 | { |
41 | 41 | $dbtype = strtolower($this->getDbType()); |
42 | - foreach (self::$types as $type => $dbtypes) { |
|
43 | - if (in_array($dbtype, $dbtypes)) { |
|
42 | + foreach(self::$types as $type => $dbtypes) { |
|
43 | + if(in_array($dbtype, $dbtypes)) { |
|
44 | 44 | return $type; |
45 | 45 | } |
46 | 46 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | */ |
40 | 40 | public function getTableFullName() |
41 | 41 | { |
42 | - if (($schema = $this->getSchemaName()) !== null) { |
|
42 | + if(($schema = $this->getSchemaName()) !== null) { |
|
43 | 43 | return $schema . '.' . $this->getTableName(); |
44 | 44 | } else { |
45 | 45 | return $this->getTableName(); |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | public function getSearchExpression($fields, $keywords) |
35 | 35 | { |
36 | 36 | $columns = []; |
37 | - foreach ($fields as $field) { |
|
38 | - if ($this->isSearchableColumn($this->getTableInfo()->getColumn($field))) { |
|
37 | + foreach($fields as $field) { |
|
38 | + if($this->isSearchableColumn($this->getTableInfo()->getColumn($field))) { |
|
39 | 39 | $columns[] = $field; |
40 | 40 | } |
41 | 41 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | protected function getSearchCondition($column, $words) |
62 | 62 | { |
63 | 63 | $conditions = []; |
64 | - foreach ($words as $word) { |
|
64 | + foreach($words as $word) { |
|
65 | 65 | $conditions[] = $column . ' ILIKE ' . $this->getDbConnection()->quoteString('%' . $word . '%'); |
66 | 66 | } |
67 | 67 | return '(' . implode(' AND ', $conditions) . ')'; |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function getSchemaTableName($table) |
63 | 63 | { |
64 | - if (count($parts = explode('.', str_replace('"', '', $table))) > 1) { |
|
64 | + if(count($parts = explode('.', str_replace('"', '', $table))) > 1) { |
|
65 | 65 | return [$parts[0], $parts[1]]; |
66 | 66 | } else { |
67 | - return [$this->getDefaultSchema(),$parts[0]]; |
|
67 | + return [$this->getDefaultSchema(), $parts[0]]; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | //$command->bindValue(':schema', $schemaName); |
106 | 106 | $tableInfo = $this->createNewTableInfo($schemaName, $tableName); |
107 | 107 | $index = 0; |
108 | - foreach ($command->query() as $col) { |
|
108 | + foreach($command->query() as $col) { |
|
109 | 109 | $col['index'] = $index++; |
110 | 110 | $this->processColumn($tableInfo, $col); |
111 | 111 | } |
112 | - if ($index === 0) { |
|
112 | + if($index === 0) { |
|
113 | 113 | throw new TDbException('dbmetadata_invalid_table_view', $table); |
114 | 114 | } |
115 | 115 | return $tableInfo; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $info['SchemaName'] = $this->assertIdentifier($schemaName); |
126 | 126 | $info['TableName'] = $this->assertIdentifier($tableName); |
127 | 127 | $info['IsView'] = false; |
128 | - if ($this->getIsView($schemaName, $tableName)) { |
|
128 | + if($this->getIsView($schemaName, $tableName)) { |
|
129 | 129 | $info['IsView'] = true; |
130 | 130 | } |
131 | 131 | list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | protected function assertIdentifier($name) |
142 | 142 | { |
143 | - if (strpos($name, '"') !== false) { |
|
143 | + if(strpos($name, '"') !== false) { |
|
144 | 144 | $ref = 'http://www.oracle.com'; |
145 | 145 | throw new TDbException('dbcommon_invalid_identifier_name', $name, $ref); |
146 | 146 | } |
@@ -181,19 +181,19 @@ discard block |
||
181 | 181 | $info['ColumnName'] = $columnId; //NOT quote the column names! |
182 | 182 | $info['ColumnId'] = $columnId; |
183 | 183 | $info['ColumnIndex'] = $col['index']; |
184 | - if (! (bool)$col['attnotnull']) { |
|
184 | + if(!(bool) $col['attnotnull']) { |
|
185 | 185 | $info['AllowNull'] = true; |
186 | 186 | } |
187 | - if (in_array($columnId, $tableInfo->getPrimaryKeys())) { |
|
187 | + if(in_array($columnId, $tableInfo->getPrimaryKeys())) { |
|
188 | 188 | $info['IsPrimaryKey'] = true; |
189 | 189 | } |
190 | - if ($this->isForeignKeyColumn($columnId, $tableInfo)) { |
|
190 | + if($this->isForeignKeyColumn($columnId, $tableInfo)) { |
|
191 | 191 | $info['IsForeignKey'] = true; |
192 | 192 | } |
193 | - if ((int)$col['atttypmod'] > 0) { |
|
193 | + if((int) $col['atttypmod'] > 0) { |
|
194 | 194 | $info['ColumnSize'] = $col['atttypmod']; |
195 | 195 | } // - 4; |
196 | - if ((bool)$col['atthasdef']) { |
|
196 | + if((bool) $col['atthasdef']) { |
|
197 | 197 | $info['DefaultValue'] = $col['adsrc']; |
198 | 198 | } |
199 | 199 | // |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | } |
211 | 211 | */ |
212 | 212 | $matches = []; |
213 | - if (preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches)) { |
|
213 | + if(preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches)) { |
|
214 | 214 | $info['DbType'] = preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']); |
215 | - if ($this->isPrecisionType($info['DbType'])) { |
|
215 | + if($this->isPrecisionType($info['DbType'])) { |
|
216 | 216 | $info['NumericPrecision'] = intval($matches[1]); |
217 | - if (count($matches) > 2) { |
|
217 | + if(count($matches) > 2) { |
|
218 | 218 | $info['NumericScale'] = intval($matches[2]); |
219 | 219 | } |
220 | 220 | } else { |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | protected function getSequenceName($tableInfo, $src) |
233 | 233 | { |
234 | 234 | $matches = []; |
235 | - if (preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches)) { |
|
236 | - if (is_int(strpos($matches[1], '.'))) { |
|
235 | + if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches)) { |
|
236 | + if(is_int(strpos($matches[1], '.'))) { |
|
237 | 237 | return $matches[1]; |
238 | 238 | } else { |
239 | 239 | return $tableInfo->getSchemaName() . '.' . $matches[1]; |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | //$command->bindValue(':schema', $schemaName); |
277 | 277 | $primary = []; |
278 | 278 | $foreign = []; |
279 | - foreach ($command->query() as $row) { |
|
280 | - switch (strtolower($row['contype'])) { |
|
279 | + foreach($command->query() as $row) { |
|
280 | + switch(strtolower($row['contype'])) { |
|
281 | 281 | case 'p': |
282 | 282 | $primary = array_merge($primary, [strtolower($row['consrc'])]); |
283 | 283 | /* |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | break; |
296 | 296 | } |
297 | 297 | } |
298 | - return [$primary,$foreign]; |
|
298 | + return [$primary, $foreign]; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | protected function getPrimaryKeys($src) |
307 | 307 | { |
308 | 308 | $matches = []; |
309 | - if (preg_match('/PRIMARY\s+KEY\s+\(([^\)]+)\)/i', $src, $matches)) { |
|
309 | + if(preg_match('/PRIMARY\s+KEY\s+\(([^\)]+)\)/i', $src, $matches)) { |
|
310 | 310 | return preg_split('/,\s+/', $matches[1]); |
311 | 311 | } |
312 | 312 | return []; |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | $matches = []; |
323 | 323 | $brackets = '\(([^\)]+)\)'; |
324 | 324 | $find = "/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i"; |
325 | - if (preg_match($find, $src, $matches)) { |
|
325 | + if(preg_match($find, $src, $matches)) { |
|
326 | 326 | $keys = preg_split('/,\s+/', $matches[1]); |
327 | 327 | $fkeys = []; |
328 | - foreach (preg_split('/,\s+/', $matches[3]) as $i => $fkey) { |
|
328 | + foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey) { |
|
329 | 329 | $fkeys[$keys[$i]] = $fkey; |
330 | 330 | } |
331 | 331 | return ['table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys]; |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | */ |
340 | 340 | protected function isForeignKeyColumn($columnId, $tableInfo) |
341 | 341 | { |
342 | - foreach ($tableInfo->getForeignKeys() as $fk) { |
|
343 | - if ($fk == $columnId) { |
|
342 | + foreach($tableInfo->getForeignKeys() as $fk) { |
|
343 | + if($fk == $columnId) { |
|
344 | 344 | //if(in_array($columnId, array_keys($fk['keys']))) |
345 | 345 | return true; |
346 | 346 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | */ |
357 | 357 | public function findTableNames($schema = '') |
358 | 358 | { |
359 | - if ($schema === '') { |
|
359 | + if($schema === '') { |
|
360 | 360 | $sql = <<<EOD |
361 | 361 | SELECT table_name, '{$schema}' as table_schema FROM user_tables |
362 | 362 | EOD; |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | |
373 | 373 | $rows = $command->queryAll(); |
374 | 374 | $names = []; |
375 | - foreach ($rows as $row) { |
|
376 | - if ($schema === $this->getDefaultSchema() || $schema === '') { |
|
375 | + foreach($rows as $row) { |
|
376 | + if($schema === $this->getDefaultSchema() || $schema === '') { |
|
377 | 377 | $names[] = $row['TABLE_NAME']; |
378 | 378 | } else { |
379 | 379 | $names[] = $row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME']; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getColumn($name) |
114 | 114 | { |
115 | - if (($column = $this->_columns->itemAt($name)) !== null) { |
|
115 | + if(($column = $this->_columns->itemAt($name)) !== null) { |
|
116 | 116 | return $column; |
117 | 117 | } |
118 | 118 | throw new TDbException('dbtableinfo_invalid_column_name', $name, $this->getTableFullName()); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function getColumnNames() |
126 | 126 | { |
127 | - foreach ($this->getColumns() as $column) { |
|
127 | + foreach($this->getColumns() as $column) { |
|
128 | 128 | $names[] = $column->getColumnName(); |
129 | 129 | } |
130 | 130 | return $names; |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function getLowerCaseColumnNames() |
153 | 153 | { |
154 | - if ($this->_lowercase === null) { |
|
154 | + if($this->_lowercase === null) { |
|
155 | 155 | $this->_lowercase = []; |
156 | - foreach ($this->getColumns()->getKeys() as $key) { |
|
156 | + foreach($this->getColumns()->getKeys() as $key) { |
|
157 | 157 | $this->_lowercase[strtolower($key)] = $key; |
158 | 158 | } |
159 | 159 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | class TOracleTableColumn extends TDbTableColumn |
28 | 28 | { |
29 | 29 | private static $types = [ |
30 | - 'numeric' => [ 'numeric' ] |
|
30 | + 'numeric' => ['numeric'] |
|
31 | 31 | // 'integer' => array('bit', 'bit varying', 'real', 'serial', 'int', 'integer'), |
32 | 32 | // 'boolean' => array('boolean'), |
33 | 33 | // 'float' => array('bigint', 'bigserial', 'double precision', 'money', 'numeric') |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | public function getPHPType() |
41 | 41 | { |
42 | 42 | $dbtype = strtolower($this->getDbType()); |
43 | - foreach (self::$types as $type => $dbtypes) { |
|
44 | - if (in_array($dbtype, $dbtypes)) { |
|
43 | + foreach(self::$types as $type => $dbtypes) { |
|
44 | + if(in_array($dbtype, $dbtypes)) { |
|
45 | 45 | return $type; |
46 | 46 | } |
47 | 47 | } |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | public function getSearchExpression($fields, $keywords) |
37 | 37 | { |
38 | 38 | $columns = []; |
39 | - foreach ($fields as $field) { |
|
40 | - if ($this->isSearchableColumn($this->getTableInfo()->getColumn($field))) { |
|
39 | + foreach($fields as $field) { |
|
40 | + if($this->isSearchableColumn($this->getTableInfo()->getColumn($field))) { |
|
41 | 41 | $columns[] = $field; |
42 | 42 | } |
43 | 43 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function applyLimitOffset($sql, $limit = -1, $offset = -1) |
83 | 83 | { |
84 | - if ((int) $limit <= 0 && (int) $offset <= 0) { |
|
84 | + if((int) $limit <= 0 && (int) $offset <= 0) { |
|
85 | 85 | return $sql; |
86 | 86 | } |
87 | 87 | |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | $nfimDoSelect = (strpos($sql, 'FROM') !== false ? strpos($sql, 'FROM') : $nfimDaSQL); |
95 | 95 | |
96 | 96 | $WhereInSubSelect = ""; |
97 | - if (strpos($sql, 'WHERE') !== false) { |
|
97 | + if(strpos($sql, 'WHERE') !== false) { |
|
98 | 98 | $WhereInSubSelect = "WHERE " . substr($sql, strpos($sql, 'WHERE') + 5, $nfimDoWhere - $niniDoWhere); |
99 | 99 | } |
100 | 100 | |
101 | 101 | $sORDERBY = ''; |
102 | - if (stripos($sql, 'ORDER') !== false) { |
|
102 | + if(stripos($sql, 'ORDER') !== false) { |
|
103 | 103 | $p = stripos($sql, 'ORDER'); |
104 | 104 | $sORDERBY = substr($sql, $p + 8); |
105 | 105 | } |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | $fields = trim(substr($fields, $niniDoSelect)); |
109 | 109 | $aliasedFields = ', '; |
110 | 110 | |
111 | - if (trim($fields) == '*') { |
|
111 | + if(trim($fields) == '*') { |
|
112 | 112 | $aliasedFields = ", {$fieldsALIAS}.{$fields}"; |
113 | 113 | $fields = ''; |
114 | 114 | $arr = $this->getTableInfo()->getColumns(); |
115 | - foreach ($arr as $field) { |
|
115 | + foreach($arr as $field) { |
|
116 | 116 | $fields .= strtolower($field->getColumnName()) . ', '; |
117 | 117 | } |
118 | 118 | $fields = str_replace('"', '', $fields); |
119 | 119 | $fields = trim($fields); |
120 | 120 | $fields = substr($fields, 0, strlen($fields) - 1); |
121 | 121 | } else { |
122 | - if (strpos($fields, ',') !== false) { |
|
122 | + if(strpos($fields, ',') !== false) { |
|
123 | 123 | $arr = $this->getTableInfo()->getColumns(); |
124 | - foreach ($arr as $field) { |
|
124 | + foreach($arr as $field) { |
|
125 | 125 | $field = strtolower($field); |
126 | 126 | $existAS = str_ireplace(' as ', '-as-', $field); |
127 | - if (strpos($existAS, '-as-') === false) { |
|
127 | + if(strpos($existAS, '-as-') === false) { |
|
128 | 128 | $aliasedFields .= "{$fieldsALIAS}." . trim($field) . ", "; |
129 | 129 | } else { |
130 | 130 | $aliasedFields .= "{$field}, "; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $aliasedFields = substr($aliasedFields, 0, strlen($aliasedFields) - 1); |
135 | 135 | } |
136 | 136 | } |
137 | - if ($aliasedFields == ', ') { |
|
137 | + if($aliasedFields == ', ') { |
|
138 | 138 | $aliasedFields = " , $fieldsALIAS.* "; |
139 | 139 | } |
140 | 140 | |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | ") WHERE {$pradoNUMLIN} >= {$offset} "; |
147 | 147 | |
148 | 148 | ************************* */ |
149 | - $offset = (int)$offset; |
|
150 | - $toReg = $offset + $limit ; |
|
149 | + $offset = (int) $offset; |
|
150 | + $toReg = $offset + $limit; |
|
151 | 151 | $fullTableName = $this->getTableInfo()->getTableFullName(); |
152 | - if (empty($sORDERBY)) { |
|
152 | + if(empty($sORDERBY)) { |
|
153 | 153 | $sORDERBY = "ROWNUM"; |
154 | 154 | } |
155 | 155 |