@@ -74,12 +74,10 @@ discard block |
||
74 | 74 | if ($type === 'double') |
75 | 75 | { |
76 | 76 | $column_key = (int) $column_key; |
77 | - } |
|
78 | - elseif ($type === 'object' && method_exists($column_key, '__toString')) |
|
77 | + } elseif ($type === 'object' && method_exists($column_key, '__toString')) |
|
79 | 78 | { |
80 | 79 | $column_key = (string) $column_key; |
81 | - } |
|
82 | - else |
|
80 | + } else |
|
83 | 81 | { |
84 | 82 | trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING); |
85 | 83 | return FALSE; |
@@ -91,12 +89,10 @@ discard block |
||
91 | 89 | if ($type === 'double') |
92 | 90 | { |
93 | 91 | $index_key = (int) $index_key; |
94 | - } |
|
95 | - elseif ($type === 'object' && method_exists($index_key, '__toString')) |
|
92 | + } elseif ($type === 'object' && method_exists($index_key, '__toString')) |
|
96 | 93 | { |
97 | 94 | $index_key = (string) $index_key; |
98 | - } |
|
99 | - else |
|
95 | + } else |
|
100 | 96 | { |
101 | 97 | trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING); |
102 | 98 | return FALSE; |
@@ -109,12 +105,10 @@ discard block |
||
109 | 105 | if ($column_key === NULL) |
110 | 106 | { |
111 | 107 | $value = $a; |
112 | - } |
|
113 | - elseif (is_array($a) && array_key_exists($column_key, $a)) |
|
108 | + } elseif (is_array($a) && array_key_exists($column_key, $a)) |
|
114 | 109 | { |
115 | 110 | $value = $a[$column_key]; |
116 | - } |
|
117 | - else |
|
111 | + } else |
|
118 | 112 | { |
119 | 113 | continue; |
120 | 114 | } |
@@ -122,8 +116,7 @@ discard block |
||
122 | 116 | if ($index_key === NULL OR ! array_key_exists($index_key, $a)) |
123 | 117 | { |
124 | 118 | $result[] = $value; |
125 | - } |
|
126 | - else |
|
119 | + } else |
|
127 | 120 | { |
128 | 121 | $result[$a[$index_key]] = $value; |
129 | 122 | } |
@@ -158,8 +151,7 @@ discard block |
||
158 | 151 | if ($type === 'object' && method_exists($data, '__toString')) |
159 | 152 | { |
160 | 153 | $data = (string) $data; |
161 | - } |
|
162 | - else |
|
154 | + } else |
|
163 | 155 | { |
164 | 156 | trigger_error('hex2bin() expects parameter 1 to be string, '.$type.' given', E_USER_WARNING); |
165 | 157 | return NULL; |
@@ -170,8 +162,7 @@ discard block |
||
170 | 162 | { |
171 | 163 | trigger_error('Hexadecimal input string must have an even length', E_USER_WARNING); |
172 | 164 | return FALSE; |
173 | - } |
|
174 | - elseif ( ! preg_match('/^[0-9a-f]*$/i', $data)) |
|
165 | + } elseif ( ! preg_match('/^[0-9a-f]*$/i', $data)) |
|
175 | 166 | { |
176 | 167 | trigger_error('Input string must be hexadecimal string', E_USER_WARNING); |
177 | 168 | return FALSE; |
@@ -206,8 +197,7 @@ discard block |
||
206 | 197 | { |
207 | 198 | trigger_error('array_replace() expects at least 1 parameter, 0 given', E_USER_WARNING); |
208 | 199 | return NULL; |
209 | - } |
|
210 | - elseif ($c === 1) |
|
200 | + } elseif ($c === 1) |
|
211 | 201 | { |
212 | 202 | if ( ! is_array($arrays[0])) |
213 | 203 | { |
@@ -227,8 +217,7 @@ discard block |
||
227 | 217 | { |
228 | 218 | trigger_error('array_replace(): Argument #'.($i + 2).' is not an array', E_USER_WARNING); |
229 | 219 | return NULL; |
230 | - } |
|
231 | - elseif (empty($arrays[$i])) |
|
220 | + } elseif (empty($arrays[$i])) |
|
232 | 221 | { |
233 | 222 | continue; |
234 | 223 | } |
@@ -261,8 +250,7 @@ discard block |
||
261 | 250 | { |
262 | 251 | trigger_error('array_replace_recursive() expects at least 1 parameter, 0 given', E_USER_WARNING); |
263 | 252 | return NULL; |
264 | - } |
|
265 | - elseif ($c === 1) |
|
253 | + } elseif ($c === 1) |
|
266 | 254 | { |
267 | 255 | if ( ! is_array($arrays[0])) |
268 | 256 | { |
@@ -282,8 +270,7 @@ discard block |
||
282 | 270 | { |
283 | 271 | trigger_error('array_replace_recursive(): Argument #'.($i + 2).' is not an array', E_USER_WARNING); |
284 | 272 | return NULL; |
285 | - } |
|
286 | - elseif (empty($arrays[$i])) |
|
273 | + } elseif (empty($arrays[$i])) |
|
287 | 274 | { |
288 | 275 | continue; |
289 | 276 | } |
@@ -316,14 +303,12 @@ discard block |
||
316 | 303 | if (strlen($str) === 0) |
317 | 304 | { |
318 | 305 | return ''; |
319 | - } |
|
320 | - elseif (in_array($type = gettype($str), array('array', 'object'), TRUE)) |
|
306 | + } elseif (in_array($type = gettype($str), array('array', 'object'), TRUE)) |
|
321 | 307 | { |
322 | 308 | if ($type === 'object' && method_exists($str, '__toString')) |
323 | 309 | { |
324 | 310 | $str = (string) $str; |
325 | - } |
|
326 | - else |
|
311 | + } else |
|
327 | 312 | { |
328 | 313 | trigger_error('quoted_printable_encode() expects parameter 1 to be string, '.$type.' given', E_USER_WARNING); |
329 | 314 | return NULL; |
@@ -73,8 +73,7 @@ discard block |
||
73 | 73 | if (file_exists($file_path = $path.'config/'.ENVIRONMENT.'/database.php')) |
74 | 74 | { |
75 | 75 | include($file_path); |
76 | - } |
|
77 | - elseif (file_exists($file_path = $path.'config/database.php')) |
|
76 | + } elseif (file_exists($file_path = $path.'config/database.php')) |
|
78 | 77 | { |
79 | 78 | include($file_path); |
80 | 79 | } |
@@ -95,15 +94,13 @@ discard block |
||
95 | 94 | if ( ! isset($active_group)) |
96 | 95 | { |
97 | 96 | show_error('You have not specified a database connection group via $active_group in your config/database.php file.'); |
98 | - } |
|
99 | - elseif ( ! isset($db[$active_group])) |
|
97 | + } elseif ( ! isset($db[$active_group])) |
|
100 | 98 | { |
101 | 99 | show_error('You have specified an invalid database connection group ('.$active_group.') in your config/database.php file.'); |
102 | 100 | } |
103 | 101 | |
104 | 102 | $params = $db[$active_group]; |
105 | - } |
|
106 | - elseif (is_string($params)) |
|
103 | + } elseif (is_string($params)) |
|
107 | 104 | { |
108 | 105 | /** |
109 | 106 | * Parse the URL from the DSN string |
@@ -181,8 +178,7 @@ discard block |
||
181 | 178 | */ |
182 | 179 | class CI_DB extends CI_DB_query_builder { } |
183 | 180 | } |
184 | - } |
|
185 | - elseif ( ! class_exists('CI_DB', FALSE)) |
|
181 | + } elseif ( ! class_exists('CI_DB', FALSE)) |
|
186 | 182 | { |
187 | 183 | /** |
188 | 184 | * @ignore |
@@ -185,7 +185,7 @@ |
||
185 | 185 | elseif ( ! class_exists('CI_DB', FALSE)) |
186 | 186 | { |
187 | 187 | /** |
188 | - * @ignore |
|
188 | + * @ignore |
|
189 | 189 | */ |
190 | 190 | class CI_DB extends CI_DB_driver { } |
191 | 191 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @var string |
94 | 94 | */ |
95 | - public $dbdriver = 'mysqli'; |
|
95 | + public $dbdriver = 'mysqli'; |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Sub-driver |
@@ -107,63 +107,63 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @var string |
109 | 109 | */ |
110 | - public $dbprefix = ''; |
|
110 | + public $dbprefix = ''; |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Character set |
114 | 114 | * |
115 | 115 | * @var string |
116 | 116 | */ |
117 | - public $char_set = 'utf8'; |
|
117 | + public $char_set = 'utf8'; |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Collation |
121 | 121 | * |
122 | 122 | * @var string |
123 | 123 | */ |
124 | - public $dbcollat = 'utf8_general_ci'; |
|
124 | + public $dbcollat = 'utf8_general_ci'; |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Encryption flag/data |
128 | 128 | * |
129 | 129 | * @var mixed |
130 | 130 | */ |
131 | - public $encrypt = FALSE; |
|
131 | + public $encrypt = FALSE; |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Swap Prefix |
135 | 135 | * |
136 | 136 | * @var string |
137 | 137 | */ |
138 | - public $swap_pre = ''; |
|
138 | + public $swap_pre = ''; |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Database port |
142 | 142 | * |
143 | 143 | * @var int |
144 | 144 | */ |
145 | - public $port = ''; |
|
145 | + public $port = ''; |
|
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Persistent connection flag |
149 | 149 | * |
150 | 150 | * @var bool |
151 | 151 | */ |
152 | - public $pconnect = FALSE; |
|
152 | + public $pconnect = FALSE; |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Connection ID |
156 | 156 | * |
157 | 157 | * @var object|resource |
158 | 158 | */ |
159 | - public $conn_id = FALSE; |
|
159 | + public $conn_id = FALSE; |
|
160 | 160 | |
161 | 161 | /** |
162 | 162 | * Result ID |
163 | 163 | * |
164 | 164 | * @var object|resource |
165 | 165 | */ |
166 | - public $result_id = FALSE; |
|
166 | + public $result_id = FALSE; |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Debug flag |
@@ -172,21 +172,21 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @var bool |
174 | 174 | */ |
175 | - public $db_debug = FALSE; |
|
175 | + public $db_debug = FALSE; |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Benchmark time |
179 | 179 | * |
180 | 180 | * @var int |
181 | 181 | */ |
182 | - public $benchmark = 0; |
|
182 | + public $benchmark = 0; |
|
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Executed queries count |
186 | 186 | * |
187 | 187 | * @var int |
188 | 188 | */ |
189 | - public $query_count = 0; |
|
189 | + public $query_count = 0; |
|
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Bind marker |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @var string |
197 | 197 | */ |
198 | - public $bind_marker = '?'; |
|
198 | + public $bind_marker = '?'; |
|
199 | 199 | |
200 | 200 | /** |
201 | 201 | * Save queries flag |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @var bool |
206 | 206 | */ |
207 | - public $save_queries = TRUE; |
|
207 | + public $save_queries = TRUE; |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Queries list |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @see CI_DB_driver::$save_queries |
213 | 213 | * @var string[] |
214 | 214 | */ |
215 | - public $queries = array(); |
|
215 | + public $queries = array(); |
|
216 | 216 | |
217 | 217 | /** |
218 | 218 | * Query times |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @var array |
223 | 223 | */ |
224 | - public $query_times = array(); |
|
224 | + public $query_times = array(); |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Data cache |
@@ -230,28 +230,28 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @var array |
232 | 232 | */ |
233 | - public $data_cache = array(); |
|
233 | + public $data_cache = array(); |
|
234 | 234 | |
235 | 235 | /** |
236 | 236 | * Transaction enabled flag |
237 | 237 | * |
238 | 238 | * @var bool |
239 | 239 | */ |
240 | - public $trans_enabled = TRUE; |
|
240 | + public $trans_enabled = TRUE; |
|
241 | 241 | |
242 | 242 | /** |
243 | 243 | * Strict transaction mode flag |
244 | 244 | * |
245 | 245 | * @var bool |
246 | 246 | */ |
247 | - public $trans_strict = TRUE; |
|
247 | + public $trans_strict = TRUE; |
|
248 | 248 | |
249 | 249 | /** |
250 | 250 | * Transaction depth level |
251 | 251 | * |
252 | 252 | * @var int |
253 | 253 | */ |
254 | - protected $_trans_depth = 0; |
|
254 | + protected $_trans_depth = 0; |
|
255 | 255 | |
256 | 256 | /** |
257 | 257 | * Transaction status flag |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @var bool |
262 | 262 | */ |
263 | - protected $_trans_status = TRUE; |
|
263 | + protected $_trans_status = TRUE; |
|
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Transaction failure flag |
@@ -269,28 +269,28 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @var bool |
271 | 271 | */ |
272 | - protected $_trans_failure = FALSE; |
|
272 | + protected $_trans_failure = FALSE; |
|
273 | 273 | |
274 | 274 | /** |
275 | 275 | * Cache On flag |
276 | 276 | * |
277 | 277 | * @var bool |
278 | 278 | */ |
279 | - public $cache_on = FALSE; |
|
279 | + public $cache_on = FALSE; |
|
280 | 280 | |
281 | 281 | /** |
282 | 282 | * Cache directory path |
283 | 283 | * |
284 | 284 | * @var bool |
285 | 285 | */ |
286 | - public $cachedir = ''; |
|
286 | + public $cachedir = ''; |
|
287 | 287 | |
288 | 288 | /** |
289 | 289 | * Cache auto-delete flag |
290 | 290 | * |
291 | 291 | * @var bool |
292 | 292 | */ |
293 | - public $cache_autodel = FALSE; |
|
293 | + public $cache_autodel = FALSE; |
|
294 | 294 | |
295 | 295 | /** |
296 | 296 | * DB Cache object |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @var bool |
307 | 307 | */ |
308 | - protected $_protect_identifiers = TRUE; |
|
308 | + protected $_protect_identifiers = TRUE; |
|
309 | 309 | |
310 | 310 | /** |
311 | 311 | * List of reserved identifiers |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @var string[] |
316 | 316 | */ |
317 | - protected $_reserved_identifiers = array('*'); |
|
317 | + protected $_reserved_identifiers = array('*'); |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Identifier escape character |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | } |
712 | 712 | |
713 | 713 | // Load and instantiate the result driver |
714 | - $driver = $this->load_rdriver(); |
|
715 | - $RES = new $driver($this); |
|
714 | + $driver = $this->load_rdriver(); |
|
715 | + $RES = new $driver($this); |
|
716 | 716 | |
717 | 717 | // Is query caching enabled? If so, we'll serialize the |
718 | 718 | // result object and save it to a cache file. |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | // result object, so we'll have to compile the data |
726 | 726 | // and save it) |
727 | 727 | $CR = new CI_DB_result($this); |
728 | - $CR->result_object = $RES->result_object(); |
|
729 | - $CR->result_array = $RES->result_array(); |
|
730 | - $CR->num_rows = $RES->num_rows(); |
|
728 | + $CR->result_object = $RES->result_object(); |
|
729 | + $CR->result_array = $RES->result_array(); |
|
730 | + $CR->num_rows = $RES->num_rows(); |
|
731 | 731 | |
732 | 732 | // Reset these since cached objects can not utilize resource IDs. |
733 | - $CR->conn_id = NULL; |
|
734 | - $CR->result_id = NULL; |
|
733 | + $CR->conn_id = NULL; |
|
734 | + $CR->result_id = NULL; |
|
735 | 735 | |
736 | 736 | $this->CACHE->write($sql, $CR); |
737 | 737 | } |
@@ -1553,17 +1553,17 @@ discard block |
||
1553 | 1553 | ? '\s+'.preg_quote(trim(sprintf($this->_like_escape_str, $this->_like_escape_chr)), '/') |
1554 | 1554 | : ''; |
1555 | 1555 | $_operators = array( |
1556 | - '\s*(?:<|>|!)?=\s*', // =, <=, >=, != |
|
1557 | - '\s*<>?\s*', // <, <> |
|
1558 | - '\s*>\s*', // > |
|
1559 | - '\s+IS NULL', // IS NULL |
|
1560 | - '\s+IS NOT NULL', // IS NOT NULL |
|
1561 | - '\s+EXISTS\s*\([^\)]+\)', // EXISTS(sql) |
|
1562 | - '\s+NOT EXISTS\s*\([^\)]+\)', // NOT EXISTS(sql) |
|
1563 | - '\s+BETWEEN\s+', // BETWEEN value AND value |
|
1564 | - '\s+IN\s*\([^\)]+\)', // IN(list) |
|
1565 | - '\s+NOT IN\s*\([^\)]+\)', // NOT IN (list) |
|
1566 | - '\s+LIKE\s+\S.*('.$_les.')?', // LIKE 'expr'[ ESCAPE '%s'] |
|
1556 | + '\s*(?:<|>|!)?=\s*', // =, <=, >=, != |
|
1557 | + '\s*<>?\s*', // <, <> |
|
1558 | + '\s*>\s*', // > |
|
1559 | + '\s+IS NULL', // IS NULL |
|
1560 | + '\s+IS NOT NULL', // IS NOT NULL |
|
1561 | + '\s+EXISTS\s*\([^\)]+\)', // EXISTS(sql) |
|
1562 | + '\s+NOT EXISTS\s*\([^\)]+\)', // NOT EXISTS(sql) |
|
1563 | + '\s+BETWEEN\s+', // BETWEEN value AND value |
|
1564 | + '\s+IN\s*\([^\)]+\)', // IN(list) |
|
1565 | + '\s+NOT IN\s*\([^\)]+\)', // NOT IN (list) |
|
1566 | + '\s+LIKE\s+\S.*('.$_les.')?', // LIKE 'expr'[ ESCAPE '%s'] |
|
1567 | 1567 | '\s+NOT LIKE\s+\S.*('.$_les.')?' // NOT LIKE 'expr'[ ESCAPE '%s'] |
1568 | 1568 | ); |
1569 | 1569 | |
@@ -1731,7 +1731,7 @@ discard block |
||
1731 | 1731 | */ |
1732 | 1732 | public function display_error($error = '', $swap = '', $native = FALSE) |
1733 | 1733 | { |
1734 | - $LANG =& load_class('Lang', 'core'); |
|
1734 | + $LANG = & load_class('Lang', 'core'); |
|
1735 | 1735 | $LANG->load('db'); |
1736 | 1736 | |
1737 | 1737 | $heading = $LANG->line('db_error_heading'); |
@@ -1769,7 +1769,7 @@ discard block |
||
1769 | 1769 | } |
1770 | 1770 | } |
1771 | 1771 | |
1772 | - $error =& load_class('Exceptions', 'core'); |
|
1772 | + $error = & load_class('Exceptions', 'core'); |
|
1773 | 1773 | echo $error->show_error($heading, $message, 'error_db'); |
1774 | 1774 | exit(8); // EXIT_DATABASE |
1775 | 1775 | } |
@@ -599,8 +599,7 @@ discard block |
||
599 | 599 | { |
600 | 600 | log_message('error', 'Invalid query: '.$sql); |
601 | 601 | return ($this->db_debug) ? $this->display_error('db_invalid_query') : FALSE; |
602 | - } |
|
603 | - elseif ( ! is_bool($return_object)) |
|
602 | + } elseif ( ! is_bool($return_object)) |
|
604 | 603 | { |
605 | 604 | $return_object = ! $this->is_write_type($sql); |
606 | 605 | } |
@@ -975,13 +974,11 @@ discard block |
||
975 | 974 | if (empty($binds) OR empty($this->bind_marker) OR strpos($sql, $this->bind_marker) === FALSE) |
976 | 975 | { |
977 | 976 | return $sql; |
978 | - } |
|
979 | - elseif ( ! is_array($binds)) |
|
977 | + } elseif ( ! is_array($binds)) |
|
980 | 978 | { |
981 | 979 | $binds = array($binds); |
982 | 980 | $bind_count = 1; |
983 | - } |
|
984 | - else |
|
981 | + } else |
|
985 | 982 | { |
986 | 983 | // Make sure we're using numeric keys |
987 | 984 | $binds = array_values($binds); |
@@ -1005,8 +1002,7 @@ discard block |
||
1005 | 1002 | { |
1006 | 1003 | return $sql; |
1007 | 1004 | } |
1008 | - } |
|
1009 | - elseif (($c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bind_count) |
|
1005 | + } elseif (($c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bind_count) |
|
1010 | 1006 | { |
1011 | 1007 | return $sql; |
1012 | 1008 | } |
@@ -1093,16 +1089,13 @@ discard block |
||
1093 | 1089 | { |
1094 | 1090 | $str = array_map(array(&$this, 'escape'), $str); |
1095 | 1091 | return $str; |
1096 | - } |
|
1097 | - elseif (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))) |
|
1092 | + } elseif (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))) |
|
1098 | 1093 | { |
1099 | 1094 | return "'".$this->escape_str($str)."'"; |
1100 | - } |
|
1101 | - elseif (is_bool($str)) |
|
1095 | + } elseif (is_bool($str)) |
|
1102 | 1096 | { |
1103 | 1097 | return ($str === FALSE) ? 0 : 1; |
1104 | - } |
|
1105 | - elseif ($str === NULL) |
|
1098 | + } elseif ($str === NULL) |
|
1106 | 1099 | { |
1107 | 1100 | return 'NULL'; |
1108 | 1101 | } |
@@ -1253,12 +1246,10 @@ discard block |
||
1253 | 1246 | if (isset($row['table_name'])) |
1254 | 1247 | { |
1255 | 1248 | $key = 'table_name'; |
1256 | - } |
|
1257 | - elseif (isset($row['TABLE_NAME'])) |
|
1249 | + } elseif (isset($row['TABLE_NAME'])) |
|
1258 | 1250 | { |
1259 | 1251 | $key = 'TABLE_NAME'; |
1260 | - } |
|
1261 | - else |
|
1252 | + } else |
|
1262 | 1253 | { |
1263 | 1254 | /* We have no other choice but to just get the first element's key. |
1264 | 1255 | * Due to array_shift() accepting its argument by reference, if |
@@ -1321,12 +1312,10 @@ discard block |
||
1321 | 1312 | if (isset($row['column_name'])) |
1322 | 1313 | { |
1323 | 1314 | $key = 'column_name'; |
1324 | - } |
|
1325 | - elseif (isset($row['COLUMN_NAME'])) |
|
1315 | + } elseif (isset($row['COLUMN_NAME'])) |
|
1326 | 1316 | { |
1327 | 1317 | $key = 'COLUMN_NAME'; |
1328 | - } |
|
1329 | - else |
|
1318 | + } else |
|
1330 | 1319 | { |
1331 | 1320 | // We have no other choice but to just get the first element's key. |
1332 | 1321 | $key = key($row); |
@@ -1382,8 +1371,7 @@ discard block |
||
1382 | 1371 | if ($this->_escape_char === '' OR empty($item) OR in_array($item, $this->_reserved_identifiers)) |
1383 | 1372 | { |
1384 | 1373 | return $item; |
1385 | - } |
|
1386 | - elseif (is_array($item)) |
|
1374 | + } elseif (is_array($item)) |
|
1387 | 1375 | { |
1388 | 1376 | foreach ($item as $key => $value) |
1389 | 1377 | { |
@@ -1410,8 +1398,7 @@ discard block |
||
1410 | 1398 | $this->_escape_char[0], |
1411 | 1399 | $this->_escape_char[1] |
1412 | 1400 | ); |
1413 | - } |
|
1414 | - else |
|
1401 | + } else |
|
1415 | 1402 | { |
1416 | 1403 | $preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char, '/'); |
1417 | 1404 | $preg_ec[2] = $preg_ec[3] = $this->_escape_char; |
@@ -1679,8 +1666,7 @@ discard block |
||
1679 | 1666 | if ( ! class_exists('CI_DB_Cache', FALSE)) |
1680 | 1667 | { |
1681 | 1668 | require_once(BASEPATH.'database/DB_cache.php'); |
1682 | - } |
|
1683 | - elseif (is_object($this->CACHE)) |
|
1669 | + } elseif (is_object($this->CACHE)) |
|
1684 | 1670 | { |
1685 | 1671 | return TRUE; |
1686 | 1672 | } |
@@ -1739,8 +1725,7 @@ discard block |
||
1739 | 1725 | if ($native === TRUE) |
1740 | 1726 | { |
1741 | 1727 | $message = (array) $error; |
1742 | - } |
|
1743 | - else |
|
1728 | + } else |
|
1744 | 1729 | { |
1745 | 1730 | $message = is_array($error) ? $error : array(str_replace('%s', $swap, $LANG->line($error))); |
1746 | 1731 | } |
@@ -1843,15 +1828,13 @@ discard block |
||
1843 | 1828 | ? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4)) |
1844 | 1829 | : substr($item, $offset); |
1845 | 1830 | $item = substr($item, 0, $offset); |
1846 | - } |
|
1847 | - elseif ($offset = strrpos($item, ' ')) |
|
1831 | + } elseif ($offset = strrpos($item, ' ')) |
|
1848 | 1832 | { |
1849 | 1833 | $alias = ($protect_identifiers) |
1850 | 1834 | ? ' '.$this->escape_identifiers(substr($item, $offset + 1)) |
1851 | 1835 | : substr($item, $offset); |
1852 | 1836 | $item = substr($item, 0, $offset); |
1853 | - } |
|
1854 | - else |
|
1837 | + } else |
|
1855 | 1838 | { |
1856 | 1839 | $alias = ''; |
1857 | 1840 | } |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * |
452 | 452 | * This is just a dummy method that all drivers will override. |
453 | 453 | * |
454 | - * @return mixed |
|
454 | + * @return boolean |
|
455 | 455 | */ |
456 | 456 | public function db_connect() |
457 | 457 | { |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | /** |
464 | 464 | * Persistent database connection |
465 | 465 | * |
466 | - * @return mixed |
|
466 | + * @return boolean |
|
467 | 467 | */ |
468 | 468 | public function db_pconnect() |
469 | 469 | { |
@@ -520,6 +520,7 @@ discard block |
||
520 | 520 | * Set client character set |
521 | 521 | * |
522 | 522 | * @param string |
523 | + * @param string $charset |
|
523 | 524 | * @return bool |
524 | 525 | */ |
525 | 526 | public function db_set_charset($charset) |
@@ -780,6 +781,7 @@ discard block |
||
780 | 781 | * not require all the features of the main query() function. |
781 | 782 | * |
782 | 783 | * @param string the sql query |
784 | + * @param string $sql |
|
783 | 785 | * @return mixed |
784 | 786 | */ |
785 | 787 | public function simple_query($sql) |
@@ -980,6 +982,7 @@ discard block |
||
980 | 982 | * |
981 | 983 | * @param string the sql statement |
982 | 984 | * @param array an array of bind data |
985 | + * @param string $sql |
|
983 | 986 | * @return string |
984 | 987 | */ |
985 | 988 | public function compile_binds($sql, $binds) |
@@ -1180,6 +1183,7 @@ discard block |
||
1180 | 1183 | * Platform-dependant string escape |
1181 | 1184 | * |
1182 | 1185 | * @param string |
1186 | + * @param string $str |
|
1183 | 1187 | * @return string |
1184 | 1188 | */ |
1185 | 1189 | protected function _escape_str($str) |
@@ -1473,6 +1477,7 @@ discard block |
||
1473 | 1477 | * @param string the table name |
1474 | 1478 | * @param array the insert keys |
1475 | 1479 | * @param array the insert values |
1480 | + * @param string $table |
|
1476 | 1481 | * @return string |
1477 | 1482 | */ |
1478 | 1483 | protected function _insert($table, $keys, $values) |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @var string |
62 | 62 | */ |
63 | - protected $_list_databases = FALSE; |
|
63 | + protected $_list_databases = FALSE; |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * OPTIMIZE TABLE statement |
67 | 67 | * |
68 | 68 | * @var string |
69 | 69 | */ |
70 | - protected $_optimize_table = FALSE; |
|
70 | + protected $_optimize_table = FALSE; |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * REPAIR TABLE statement |
74 | 74 | * |
75 | 75 | * @var string |
76 | 76 | */ |
77 | - protected $_repair_table = FALSE; |
|
77 | + protected $_repair_table = FALSE; |
|
78 | 78 | |
79 | 79 | // -------------------------------------------------------------------- |
80 | 80 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function __construct(&$db) |
88 | 88 | { |
89 | - $this->db =& $db; |
|
89 | + $this->db = & $db; |
|
90 | 90 | log_message('info', 'Database Utility Class Initialized'); |
91 | 91 | } |
92 | 92 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | } |
405 | 405 | |
406 | 406 | // Load the Zip class and output it |
407 | - $CI =& get_instance(); |
|
407 | + $CI = & get_instance(); |
|
408 | 408 | $CI->load->library('zip'); |
409 | 409 | $CI->zip->add_data($prefs['filename'], $this->_backup($prefs)); |
410 | 410 | return $CI->zip->get_zip(); |
@@ -103,8 +103,7 @@ discard block |
||
103 | 103 | if (isset($this->db->data_cache['db_names'])) |
104 | 104 | { |
105 | 105 | return $this->db->data_cache['db_names']; |
106 | - } |
|
107 | - elseif ($this->_list_databases === FALSE) |
|
106 | + } elseif ($this->_list_databases === FALSE) |
|
108 | 107 | { |
109 | 108 | return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; |
110 | 109 | } |
@@ -387,8 +386,7 @@ discard block |
||
387 | 386 | { |
388 | 387 | $prefs['filename'] = (count($prefs['tables']) === 1 ? $prefs['tables'] : $this->db->database) |
389 | 388 | .date('Y-m-d_H-i', time()).'.sql'; |
390 | - } |
|
391 | - else |
|
389 | + } else |
|
392 | 390 | { |
393 | 391 | // If they included the .zip file extension we'll remove it |
394 | 392 | if (preg_match('|.+?\.zip$|', $prefs['filename'])) |
@@ -408,15 +406,17 @@ discard block |
||
408 | 406 | $CI->load->library('zip'); |
409 | 407 | $CI->zip->add_data($prefs['filename'], $this->_backup($prefs)); |
410 | 408 | return $CI->zip->get_zip(); |
411 | - } |
|
412 | - elseif ($prefs['format'] === 'txt') // Was a text file requested? |
|
409 | + } elseif ($prefs['format'] === 'txt') { |
|
410 | + // Was a text file requested? |
|
413 | 411 | { |
414 | 412 | return $this->_backup($prefs); |
415 | 413 | } |
416 | - elseif ($prefs['format'] === 'gzip') // Was a Gzip file requested? |
|
414 | + } elseif ($prefs['format'] === 'gzip') { |
|
415 | + // Was a Gzip file requested? |
|
417 | 416 | { |
418 | 417 | return gzencode($this->_backup($prefs)); |
419 | 418 | } |
419 | + } |
|
420 | 420 | |
421 | 421 | return; |
422 | 422 | } |
@@ -100,8 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | $this->auto_commit = FALSE; |
102 | 102 | } |
103 | - } |
|
104 | - else |
|
103 | + } else |
|
105 | 104 | { |
106 | 105 | // If no port is defined by the user, use the default value |
107 | 106 | empty($this->port) OR $this->port = 33000; |
@@ -194,8 +193,7 @@ discard block |
||
194 | 193 | if (($autocommit = cubrid_get_autocommit($this->conn_id)) === NULL) |
195 | 194 | { |
196 | 195 | return FALSE; |
197 | - } |
|
198 | - elseif ($autocommit === TRUE) |
|
196 | + } elseif ($autocommit === TRUE) |
|
199 | 197 | { |
200 | 198 | return cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_FALSE); |
201 | 199 | } |
@@ -153,16 +153,16 @@ |
||
153 | 153 | $retval = array(); |
154 | 154 | for ($i = 0, $c = count($query); $i < $c; $i++) |
155 | 155 | { |
156 | - $retval[$i] = new stdClass(); |
|
157 | - $retval[$i]->name = $query[$i]->Field; |
|
156 | + $retval[$i] = new stdClass(); |
|
157 | + $retval[$i]->name = $query[$i]->Field; |
|
158 | 158 | |
159 | 159 | sscanf($query[$i]->Type, '%[a-z](%d)', |
160 | 160 | $retval[$i]->type, |
161 | 161 | $retval[$i]->max_length |
162 | 162 | ); |
163 | 163 | |
164 | - $retval[$i]->default = $query[$i]->Default; |
|
165 | - $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI'); |
|
164 | + $retval[$i]->default = $query[$i]->Default; |
|
165 | + $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | return $retval; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @var string |
53 | 53 | */ |
54 | - protected $_create_database = FALSE; |
|
54 | + protected $_create_database = FALSE; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * CREATE TABLE keys flag |
@@ -61,28 +61,28 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @var bool |
63 | 63 | */ |
64 | - protected $_create_table_keys = TRUE; |
|
64 | + protected $_create_table_keys = TRUE; |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * DROP DATABASE statement |
68 | 68 | * |
69 | 69 | * @var string |
70 | 70 | */ |
71 | - protected $_drop_database = FALSE; |
|
71 | + protected $_drop_database = FALSE; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * CREATE TABLE IF statement |
75 | 75 | * |
76 | 76 | * @var string |
77 | 77 | */ |
78 | - protected $_create_table_if = FALSE; |
|
78 | + protected $_create_table_if = FALSE; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * UNSIGNED support |
82 | 82 | * |
83 | 83 | * @var array |
84 | 84 | */ |
85 | - protected $_unsigned = array( |
|
85 | + protected $_unsigned = array( |
|
86 | 86 | 'SHORT' => 'INTEGER', |
87 | 87 | 'SMALLINT' => 'INTEGER', |
88 | 88 | 'INT' => 'BIGINT', |
@@ -116,8 +116,7 @@ discard block |
||
116 | 116 | if ($field[$i]['_literal'] !== FALSE) |
117 | 117 | { |
118 | 118 | $sqls[] = $sql.' CHANGE '.$field[$i]['_literal']; |
119 | - } |
|
120 | - else |
|
119 | + } else |
|
121 | 120 | { |
122 | 121 | $alter_type = empty($field[$i]['new_name']) ? ' MODIFY ' : ' CHANGE '; |
123 | 122 | $sqls[] = $sql.$alter_type.$this->_process_column($field[$i]); |
@@ -206,8 +205,7 @@ discard block |
||
206 | 205 | continue; |
207 | 206 | } |
208 | 207 | } |
209 | - } |
|
210 | - elseif ( ! isset($this->fields[$this->keys[$i]])) |
|
208 | + } elseif ( ! isset($this->fields[$this->keys[$i]])) |
|
211 | 209 | { |
212 | 210 | unset($this->keys[$i]); |
213 | 211 | continue; |
@@ -51,28 +51,28 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @var string |
53 | 53 | */ |
54 | - protected $_create_table_if = FALSE; |
|
54 | + protected $_create_table_if = FALSE; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * RENAME TABLE statement |
58 | 58 | * |
59 | 59 | * @var string |
60 | 60 | */ |
61 | - protected $_rename_table = FALSE; |
|
61 | + protected $_rename_table = FALSE; |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * DROP TABLE IF statement |
65 | 65 | * |
66 | 66 | * @var string |
67 | 67 | */ |
68 | - protected $_drop_table_if = FALSE; |
|
68 | + protected $_drop_table_if = FALSE; |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * UNSIGNED support |
72 | 72 | * |
73 | 73 | * @var array |
74 | 74 | */ |
75 | - protected $_unsigned = array( |
|
75 | + protected $_unsigned = array( |
|
76 | 76 | 'SMALLINT' => 'INTEGER', |
77 | 77 | 'INTEGER' => 'INT64', |
78 | 78 | 'FLOAT' => 'DOUBLE PRECISION' |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @var string |
85 | 85 | */ |
86 | - protected $_null = 'NULL'; |
|
86 | + protected $_null = 'NULL'; |
|
87 | 87 | |
88 | 88 | // -------------------------------------------------------------------- |
89 | 89 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | * Create database |
78 | 78 | * |
79 | 79 | * @param string $db_name |
80 | - * @return string |
|
80 | + * @return boolean |
|
81 | 81 | */ |
82 | 82 | public function create_database($db_name) |
83 | 83 | { |
@@ -95,8 +95,7 @@ |
||
95 | 95 | if ( ! file_exists($this->db->database) OR ! @unlink($this->db->database)) |
96 | 96 | { |
97 | 97 | return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; |
98 | - } |
|
99 | - elseif ( ! empty($this->db->data_cache['db_names'])) |
|
98 | + } elseif ( ! empty($this->db->data_cache['db_names'])) |
|
100 | 99 | { |
101 | 100 | $key = array_search(strtolower($this->db->database), array_map('strtolower', $this->db->data_cache['db_names']), TRUE); |
102 | 101 | if ($key !== FALSE) |
@@ -95,10 +95,10 @@ |
||
95 | 95 | { |
96 | 96 | $info = ibase_field_info($this->result_id, $i); |
97 | 97 | |
98 | - $retval[$i] = new stdClass(); |
|
98 | + $retval[$i] = new stdClass(); |
|
99 | 99 | $retval[$i]->name = $info['name']; |
100 | 100 | $retval[$i]->type = $info['type']; |
101 | - $retval[$i]->max_length = $info['length']; |
|
101 | + $retval[$i]->max_length = $info['length']; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | return $retval; |
@@ -111,10 +111,10 @@ |
||
111 | 111 | { |
112 | 112 | $field = mssql_fetch_field($this->result_id, $i); |
113 | 113 | |
114 | - $retval[$i] = new stdClass(); |
|
114 | + $retval[$i] = new stdClass(); |
|
115 | 115 | $retval[$i]->name = $field->name; |
116 | 116 | $retval[$i]->type = $field->type; |
117 | - $retval[$i]->max_length = $field->max_length; |
|
117 | + $retval[$i]->max_length = $field->max_length; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return $retval; |