@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if(count($parts = explode('.', str_replace('"', '', $table))) > 1) |
66 | 66 | return [$parts[0], $parts[1]]; |
67 | 67 | else |
68 | - return [$this->getDefaultSchema(),$parts[0]]; |
|
68 | + return [$this->getDefaultSchema(), $parts[0]]; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | $info['ColumnName'] = $columnId; //NOT quote the column names! |
181 | 181 | $info['ColumnId'] = $columnId; |
182 | 182 | $info['ColumnIndex'] = $col['index']; |
183 | - if(! (bool)$col['attnotnull']) $info['AllowNull'] = true; |
|
183 | + if(!(bool) $col['attnotnull']) $info['AllowNull'] = true; |
|
184 | 184 | if(in_array($columnId, $tableInfo->getPrimaryKeys())) $info['IsPrimaryKey'] = true; |
185 | 185 | if($this->isForeignKeyColumn($columnId, $tableInfo)) $info['IsForeignKey'] = true; |
186 | - if((int)$col['atttypmod'] > 0) $info['ColumnSize'] = $col['atttypmod']; // - 4; |
|
187 | - if((bool)$col['atthasdef']) $info['DefaultValue'] = $col['adsrc']; |
|
186 | + if((int) $col['atttypmod'] > 0) $info['ColumnSize'] = $col['atttypmod']; // - 4; |
|
187 | + if((bool) $col['atthasdef']) $info['DefaultValue'] = $col['adsrc']; |
|
188 | 188 | // |
189 | 189 | // For a while Oracle Tables has no associated AutoIncrement Triggers |
190 | 190 | // |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | break; |
288 | 288 | } |
289 | 289 | } |
290 | - return [$primary,$foreign]; |
|
290 | + return [$primary, $foreign]; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function getSearchExpression($fields, $keywords) { |
37 | 37 | $columns = []; |
38 | - foreach ($fields as $field) { |
|
39 | - if ($this->isSearchableColumn($this->getTableInfo()->getColumn($field))) |
|
38 | + foreach($fields as $field) { |
|
39 | + if($this->isSearchableColumn($this->getTableInfo()->getColumn($field))) |
|
40 | 40 | $columns[] = $field; |
41 | 41 | } |
42 | 42 | return parent :: getSearchExpression($columns, $keywords); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return string SQL with limit and offset in Oracle way. |
78 | 78 | */ |
79 | 79 | public function applyLimitOffset($sql, $limit = -1, $offset = -1) { |
80 | - if ((int) $limit <= 0 && (int) $offset <= 0) |
|
80 | + if((int) $limit <= 0 && (int) $offset <= 0) |
|
81 | 81 | return $sql; |
82 | 82 | |
83 | 83 | $pradoNUMLIN = 'pradoNUMLIN'; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $WhereInSubSelect = "WHERE " . substr($sql, strpos($sql, 'WHERE') + 5, $nfimDoWhere - $niniDoWhere); |
94 | 94 | |
95 | 95 | $sORDERBY = ''; |
96 | - if (stripos($sql, 'ORDER') !== false) { |
|
96 | + if(stripos($sql, 'ORDER') !== false) { |
|
97 | 97 | $p = stripos($sql, 'ORDER'); |
98 | 98 | $sORDERBY = substr($sql, $p + 8); |
99 | 99 | } |
@@ -102,23 +102,23 @@ discard block |
||
102 | 102 | $fields = trim(substr($fields, $niniDoSelect)); |
103 | 103 | $aliasedFields = ', '; |
104 | 104 | |
105 | - if (trim($fields) == '*') { |
|
105 | + if(trim($fields) == '*') { |
|
106 | 106 | $aliasedFields = ", {$fieldsALIAS}.{$fields}"; |
107 | 107 | $fields = ''; |
108 | 108 | $arr = $this->getTableInfo()->getColumns(); |
109 | - foreach ($arr as $field) { |
|
109 | + foreach($arr as $field) { |
|
110 | 110 | $fields .= strtolower($field->getColumnName()) . ', '; |
111 | 111 | } |
112 | 112 | $fields = str_replace('"', '', $fields); |
113 | 113 | $fields = trim($fields); |
114 | 114 | $fields = substr($fields, 0, strlen($fields) - 1); |
115 | 115 | } else { |
116 | - if (strpos($fields, ',') !== false) { |
|
116 | + if(strpos($fields, ',') !== false) { |
|
117 | 117 | $arr = $this->getTableInfo()->getColumns(); |
118 | - foreach ($arr as $field) { |
|
118 | + foreach($arr as $field) { |
|
119 | 119 | $field = strtolower($field); |
120 | 120 | $existAS = str_ireplace(' as ', '-as-', $field); |
121 | - if (strpos($existAS, '-as-') === false) |
|
121 | + if(strpos($existAS, '-as-') === false) |
|
122 | 122 | $aliasedFields .= "{$fieldsALIAS}." . trim($field) . ", "; |
123 | 123 | else |
124 | 124 | $aliasedFields .= "{$field}, "; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $aliasedFields = substr($aliasedFields, 0, strlen($aliasedFields) - 1); |
128 | 128 | } |
129 | 129 | } |
130 | - if ($aliasedFields == ', ') |
|
130 | + if($aliasedFields == ', ') |
|
131 | 131 | $aliasedFields = " , $fieldsALIAS.* "; |
132 | 132 | |
133 | 133 | /* ************************ |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | ") WHERE {$pradoNUMLIN} >= {$offset} "; |
139 | 139 | |
140 | 140 | ************************* */ |
141 | - $offset = (int)$offset; |
|
142 | - $toReg = $offset + $limit ; |
|
141 | + $offset = (int) $offset; |
|
142 | + $toReg = $offset + $limit; |
|
143 | 143 | $fullTableName = $this->getTableInfo()->getTableFullName(); |
144 | - if (empty($sORDERBY)) |
|
144 | + if(empty($sORDERBY)) |
|
145 | 145 | $sORDERBY = "ROWNUM"; |
146 | 146 | |
147 | 147 | $newSql = " SELECT $fields FROM " . |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | //remove possible delimiters |
118 | 118 | $result = explode('.', preg_replace('/\[|\]|"/', '', $table)); |
119 | 119 | if(count($result) === 1) |
120 | - return [null,null,$result[0]]; |
|
120 | + return [null, null, $result[0]]; |
|
121 | 121 | if(count($result) === 2) |
122 | - return [null,$result[0],$result[1]]; |
|
122 | + return [null, $result[0], $result[1]]; |
|
123 | 123 | if(count($result) > 2) |
124 | - return [$result[0],$result[1],$result[2]]; |
|
124 | + return [$result[0], $result[1], $result[2]]; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | foreach($command->query()->readAll() as $field) |
200 | 200 | $primary[] = $field['field_name']; |
201 | 201 | $foreign = $this->getForeignConstraints($col); |
202 | - return [$primary,$foreign]; |
|
202 | + return [$primary, $foreign]; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | $command->bindParam(":schema", $schema); |
281 | 281 | $rows = $command->queryAll(); |
282 | 282 | $names = []; |
283 | - foreach ($rows as $row) |
|
283 | + foreach($rows as $row) |
|
284 | 284 | { |
285 | - if ($schema == self::DEFAULT_SCHEMA) |
|
285 | + if($schema == self::DEFAULT_SCHEMA) |
|
286 | 286 | $names[] = $row['TABLE_NAME']; |
287 | 287 | else |
288 | 288 | $names[] = $schema . '.' . $row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME']; |
@@ -85,7 +85,7 @@ |
||
85 | 85 | { |
86 | 86 | $limit = $limit !== null ? intval($limit) : -1; |
87 | 87 | $offset = $offset !== null ? intval($offset) : -1; |
88 | - if ($limit > 0 && $offset <= 0) //just limit |
|
88 | + if($limit > 0 && $offset <= 0) //just limit |
|
89 | 89 | $sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i', "\\1SELECT\\2 TOP $limit", $sql); |
90 | 90 | elseif($limit > 0 && $offset > 0) |
91 | 91 | $sql = $this->rewriteLimitOffsetSql($sql, $limit, $offset); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if(count($parts = explode('.', str_replace('"', '', $table))) > 1) |
94 | 94 | return [$parts[0], $parts[1]]; |
95 | 95 | else |
96 | - return [$this->getDefaultSchema(),$parts[0]]; |
|
96 | + return [$this->getDefaultSchema(), $parts[0]]; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | break; |
353 | 353 | } |
354 | 354 | } |
355 | - return [$primary,$foreign]; |
|
355 | + return [$primary, $foreign]; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -94,7 +94,7 @@ |
||
94 | 94 | */ |
95 | 95 | public function getTableInfo($tableName = null) |
96 | 96 | { |
97 | - $key = $tableName === null?$this->getDbConnection()->getConnectionString():$tableName; |
|
97 | + $key = $tableName === null ? $this->getDbConnection()->getConnectionString() : $tableName; |
|
98 | 98 | if(!isset($this->_tableInfoCache[$key])) |
99 | 99 | { |
100 | 100 | $class = $this->getTableInfoClass(); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $cache = $this->getCache(); |
45 | 45 | $keyname = $this->getBaseKeyKeyName(); |
46 | 46 | $basekey = $cache->get($keyname); |
47 | - if (!$basekey) |
|
47 | + if(!$basekey) |
|
48 | 48 | { |
49 | 49 | $basekey = DxUtil::generateRandomHash(8); |
50 | 50 | $cache->set($keyname, $basekey); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | protected function getCache() |
82 | 82 | { |
83 | - if (!$this->_cache) |
|
83 | + if(!$this->_cache) |
|
84 | 84 | $this->_cache = Prado::getApplication()->getCache(); |
85 | 85 | return $this->_cache; |
86 | 86 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | protected function getKeyListId() |
45 | 45 | { |
46 | 46 | $id = 'keyList'; |
47 | - if ($this->_cacheModel instanceof TSqlMapCacheModel) |
|
47 | + if($this->_cacheModel instanceof TSqlMapCacheModel) |
|
48 | 48 | $id .= '_' . $this->_cacheModel->getId(); |
49 | 49 | return $id; |
50 | 50 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function getKeyList() |
56 | 56 | { |
57 | - if (($keyList = $this->getCache()->get($this->getKeyListId())) === false) |
|
57 | + if(($keyList = $this->getCache()->get($this->getKeyListId())) === false) |
|
58 | 58 | { |
59 | 59 | $keyList = new TList(); |
60 | 60 | $this->getCache()->set($this->getKeyListId(), $keyList); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $keyList = $this->getKeyList(); |
87 | 87 | $cache = $this->getCache(); |
88 | - foreach ($keyList as $key) |
|
88 | + foreach($keyList as $key) |
|
89 | 89 | { |
90 | 90 | $cache->delete($key); |
91 | 91 | } |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | public function get($key) |
100 | 100 | { |
101 | 101 | $result = $this->getCache()->get($key); |
102 | - if ($result === false) |
|
102 | + if($result === false) |
|
103 | 103 | { |
104 | 104 | // if the key has not been found in cache (e.g expired), remove from keylist |
105 | 105 | $keyList = $this->getKeyList(); |
106 | - if ($keyList->contains($key)) |
|
106 | + if($keyList->contains($key)) |
|
107 | 107 | { |
108 | 108 | $keyList->remove($key); |
109 | 109 | $this->setKeyList($keyList); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | { |
122 | 122 | $this->getCache()->set($key, $value, $expire, $dependency); |
123 | 123 | $keyList = $this->getKeyList(); |
124 | - if (!$keyList->contains($key)) |
|
124 | + if(!$keyList->contains($key)) |
|
125 | 125 | { |
126 | 126 | $keyList->add($key); |
127 | 127 | $this->setKeyList($keyList); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | array_shift($args); |
31 | 31 | $n = count($args); |
32 | 32 | $tokens = []; |
33 | - for($i = 0;$i < $n;++$i) |
|
33 | + for($i = 0; $i < $n; ++$i) |
|
34 | 34 | { |
35 | 35 | if($args[$i] instanceof SimpleXMLElement) |
36 | 36 | $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $attributes = []; |
50 | 50 | foreach($node->attributes() as $k => $v) |
51 | - $attributes[] = $k . '="' . (string)$v . '"'; |
|
51 | + $attributes[] = $k . '="' . (string) $v . '"'; |
|
52 | 52 | return '<' . $node->getName() . ' ' . implode(' ', $attributes) . '>'; |
53 | 53 | } |
54 | 54 |