@@ -474,8 +474,7 @@ discard block |
||
474 | 474 | $this->qb_cache_exists[] = 'from'; |
475 | 475 | } |
476 | 476 | } |
477 | - } |
|
478 | - else |
|
477 | + } else |
|
479 | 478 | { |
480 | 479 | $val = trim($val); |
481 | 480 | |
@@ -518,8 +517,7 @@ discard block |
||
518 | 517 | if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'), TRUE)) |
519 | 518 | { |
520 | 519 | $type = ''; |
521 | - } |
|
522 | - else |
|
520 | + } else |
|
523 | 521 | { |
524 | 522 | $type .= ' '; |
525 | 523 | } |
@@ -556,12 +554,10 @@ discard block |
||
556 | 554 | elseif ($escape === TRUE && preg_match("/([\[\]\w\.'-]+)(\s*[^\"\[`'\w]+\s*)(.+)/i", $cond, $match)) |
557 | 555 | { |
558 | 556 | $cond = ' ON '.$this->protect_identifiers($match[1]).$match[2].$this->protect_identifiers($match[3]); |
559 | - } |
|
560 | - elseif ( ! $this->_has_operator($cond)) |
|
557 | + } elseif ( ! $this->_has_operator($cond)) |
|
561 | 558 | { |
562 | 559 | $cond = ' USING ('.($escape ? $this->escape_identifiers($cond) : $cond).')'; |
563 | - } |
|
564 | - else |
|
560 | + } else |
|
565 | 561 | { |
566 | 562 | $cond = ' ON '.$cond; |
567 | 563 | } |
@@ -666,13 +662,11 @@ discard block |
||
666 | 662 | { |
667 | 663 | $k .= ' = '; |
668 | 664 | } |
669 | - } |
|
670 | - elseif ( ! $this->_has_operator($k)) |
|
665 | + } elseif ( ! $this->_has_operator($k)) |
|
671 | 666 | { |
672 | 667 | // value appears not to have been set, assign the test to IS NULL |
673 | 668 | $k .= ' IS NULL'; |
674 | - } |
|
675 | - elseif (preg_match('/\s*(!?=|<>|IS(?:\s+NOT)?)\s*$/i', $k, $match, PREG_OFFSET_CAPTURE)) |
|
669 | + } elseif (preg_match('/\s*(!?=|<>|IS(?:\s+NOT)?)\s*$/i', $k, $match, PREG_OFFSET_CAPTURE)) |
|
676 | 670 | { |
677 | 671 | $k = substr($k, 0, $match[0][1]).($match[1][0] === '=' ? ' IS NULL' : ' IS NOT NULL'); |
678 | 672 | } |
@@ -801,8 +795,7 @@ discard block |
||
801 | 795 | { |
802 | 796 | $where_in[] = $this->escape($value); |
803 | 797 | } |
804 | - } |
|
805 | - else |
|
798 | + } else |
|
806 | 799 | { |
807 | 800 | $where_in = array_values($values); |
808 | 801 | } |
@@ -944,16 +937,13 @@ discard block |
||
944 | 937 | if ($side === 'none') |
945 | 938 | { |
946 | 939 | $like_statement = "{$prefix} {$k} {$not} LIKE '{$v}'"; |
947 | - } |
|
948 | - elseif ($side === 'before') |
|
940 | + } elseif ($side === 'before') |
|
949 | 941 | { |
950 | 942 | $like_statement = "{$prefix} {$k} {$not} LIKE '%{$v}'"; |
951 | - } |
|
952 | - elseif ($side === 'after') |
|
943 | + } elseif ($side === 'after') |
|
953 | 944 | { |
954 | 945 | $like_statement = "{$prefix} {$k} {$not} LIKE '{$v}%'"; |
955 | - } |
|
956 | - else |
|
946 | + } else |
|
957 | 947 | { |
958 | 948 | $like_statement = "{$prefix} {$k} {$not} LIKE '%{$v}%'"; |
959 | 949 | } |
@@ -1184,12 +1174,10 @@ discard block |
||
1184 | 1174 | $orderby = ctype_digit((string) $orderby) |
1185 | 1175 | ? sprintf($this->_random_keyword[1], $orderby) |
1186 | 1176 | : $this->_random_keyword[0]; |
1187 | - } |
|
1188 | - elseif (empty($orderby)) |
|
1177 | + } elseif (empty($orderby)) |
|
1189 | 1178 | { |
1190 | 1179 | return $this; |
1191 | - } |
|
1192 | - elseif ($direction !== '') |
|
1180 | + } elseif ($direction !== '') |
|
1193 | 1181 | { |
1194 | 1182 | $direction = in_array($direction, array('ASC', 'DESC'), TRUE) ? ' '.$direction : ''; |
1195 | 1183 | } |
@@ -1199,8 +1187,7 @@ discard block |
||
1199 | 1187 | if ($escape === FALSE) |
1200 | 1188 | { |
1201 | 1189 | $qb_orderby[] = array('field' => $orderby, 'direction' => $direction, 'escape' => FALSE); |
1202 | - } |
|
1203 | - else |
|
1190 | + } else |
|
1204 | 1191 | { |
1205 | 1192 | $qb_orderby = array(); |
1206 | 1193 | foreach (explode(',', $orderby) as $field) |
@@ -1646,8 +1633,7 @@ discard block |
||
1646 | 1633 | if ($table !== '') |
1647 | 1634 | { |
1648 | 1635 | $this->qb_from[0] = $table; |
1649 | - } |
|
1650 | - elseif ( ! isset($this->qb_from[0])) |
|
1636 | + } elseif ( ! isset($this->qb_from[0])) |
|
1651 | 1637 | { |
1652 | 1638 | return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; |
1653 | 1639 | } |
@@ -1824,8 +1810,7 @@ discard block |
||
1824 | 1810 | if ($table !== '') |
1825 | 1811 | { |
1826 | 1812 | $this->qb_from = array($this->protect_identifiers($table, TRUE, NULL, FALSE)); |
1827 | - } |
|
1828 | - elseif ( ! isset($this->qb_from[0])) |
|
1813 | + } elseif ( ! isset($this->qb_from[0])) |
|
1829 | 1814 | { |
1830 | 1815 | return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; |
1831 | 1816 | } |
@@ -1995,8 +1980,7 @@ discard block |
||
1995 | 1980 | } |
1996 | 1981 | |
1997 | 1982 | $table = $this->qb_from[0]; |
1998 | - } |
|
1999 | - else |
|
1983 | + } else |
|
2000 | 1984 | { |
2001 | 1985 | $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); |
2002 | 1986 | } |
@@ -2028,8 +2012,7 @@ discard block |
||
2028 | 2012 | } |
2029 | 2013 | |
2030 | 2014 | $table = $this->qb_from[0]; |
2031 | - } |
|
2032 | - else |
|
2015 | + } else |
|
2033 | 2016 | { |
2034 | 2017 | $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); |
2035 | 2018 | } |
@@ -2102,8 +2085,7 @@ discard block |
||
2102 | 2085 | } |
2103 | 2086 | |
2104 | 2087 | $table = $this->qb_from[0]; |
2105 | - } |
|
2106 | - elseif (is_array($table)) |
|
2088 | + } elseif (is_array($table)) |
|
2107 | 2089 | { |
2108 | 2090 | empty($where) && $reset_data = FALSE; |
2109 | 2091 | |
@@ -2113,8 +2095,7 @@ discard block |
||
2113 | 2095 | } |
2114 | 2096 | |
2115 | 2097 | return; |
2116 | - } |
|
2117 | - else |
|
2098 | + } else |
|
2118 | 2099 | { |
2119 | 2100 | $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); |
2120 | 2101 | } |
@@ -2259,16 +2240,14 @@ discard block |
||
2259 | 2240 | if ($select_override !== FALSE) |
2260 | 2241 | { |
2261 | 2242 | $sql = $select_override; |
2262 | - } |
|
2263 | - else |
|
2243 | + } else |
|
2264 | 2244 | { |
2265 | 2245 | $sql = ( ! $this->qb_distinct) ? 'SELECT ' : 'SELECT DISTINCT '; |
2266 | 2246 | |
2267 | 2247 | if (count($this->qb_select) === 0) |
2268 | 2248 | { |
2269 | 2249 | $sql .= '*'; |
2270 | - } |
|
2271 | - else |
|
2250 | + } else |
|
2272 | 2251 | { |
2273 | 2252 | // Cycle through the "select" portion of the query and prep each column name. |
2274 | 2253 | // The reason we protect identifiers here rather than in the select() function |
@@ -2333,8 +2312,7 @@ discard block |
||
2333 | 2312 | if (is_string($this->{$qb_key}[$i])) |
2334 | 2313 | { |
2335 | 2314 | continue; |
2336 | - } |
|
2337 | - elseif ($this->{$qb_key}[$i]['escape'] === FALSE) |
|
2315 | + } elseif ($this->{$qb_key}[$i]['escape'] === FALSE) |
|
2338 | 2316 | { |
2339 | 2317 | $this->{$qb_key}[$i] = $this->{$qb_key}[$i]['condition']; |
2340 | 2318 | continue; |
@@ -2449,8 +2427,7 @@ discard block |
||
2449 | 2427 | } |
2450 | 2428 | |
2451 | 2429 | return $this->qb_orderby = "\nORDER BY ".implode(', ', $this->qb_orderby); |
2452 | - } |
|
2453 | - elseif (is_string($this->qb_orderby)) |
|
2430 | + } elseif (is_string($this->qb_orderby)) |
|
2454 | 2431 | { |
2455 | 2432 | return $this->qb_orderby; |
2456 | 2433 | } |
@@ -2597,15 +2574,16 @@ discard block |
||
2597 | 2574 | if (count($this->qb_cache_exists) === 0) |
2598 | 2575 | { |
2599 | 2576 | return; |
2600 | - } |
|
2601 | - elseif (in_array('select', $this->qb_cache_exists, TRUE)) |
|
2577 | + } elseif (in_array('select', $this->qb_cache_exists, TRUE)) |
|
2602 | 2578 | { |
2603 | 2579 | $qb_no_escape = $this->qb_cache_no_escape; |
2604 | 2580 | } |
2605 | 2581 | |
2606 | - foreach (array_unique($this->qb_cache_exists) as $val) // select, from, etc. |
|
2582 | + foreach (array_unique($this->qb_cache_exists) as $val) { |
|
2583 | + // select, from, etc. |
|
2607 | 2584 | { |
2608 | 2585 | $qb_variable = 'qb_'.$val; |
2586 | + } |
|
2609 | 2587 | $qb_cache_var = 'qb_cache_'.$val; |
2610 | 2588 | $qb_new = $this->$qb_cache_var; |
2611 | 2589 |
@@ -132,12 +132,10 @@ discard block |
||
132 | 132 | if (is_int($this->num_rows)) |
133 | 133 | { |
134 | 134 | return $this->num_rows; |
135 | - } |
|
136 | - elseif (count($this->result_array) > 0) |
|
135 | + } elseif (count($this->result_array) > 0) |
|
137 | 136 | { |
138 | 137 | return $this->num_rows = count($this->result_array); |
139 | - } |
|
140 | - elseif (count($this->result_object) > 0) |
|
138 | + } elseif (count($this->result_object) > 0) |
|
141 | 139 | { |
142 | 140 | return $this->num_rows = count($this->result_object); |
143 | 141 | } |
@@ -158,12 +156,10 @@ discard block |
||
158 | 156 | if ($type === 'array') |
159 | 157 | { |
160 | 158 | return $this->result_array(); |
161 | - } |
|
162 | - elseif ($type === 'object') |
|
159 | + } elseif ($type === 'object') |
|
163 | 160 | { |
164 | 161 | return $this->result_object(); |
165 | - } |
|
166 | - else |
|
162 | + } else |
|
167 | 163 | { |
168 | 164 | return $this->custom_result_object($type); |
169 | 165 | } |
@@ -182,8 +178,7 @@ discard block |
||
182 | 178 | if (isset($this->custom_result_object[$class_name])) |
183 | 179 | { |
184 | 180 | return $this->custom_result_object[$class_name]; |
185 | - } |
|
186 | - elseif ( ! $this->result_id OR $this->num_rows === 0) |
|
181 | + } elseif ( ! $this->result_id OR $this->num_rows === 0) |
|
187 | 182 | { |
188 | 183 | return array(); |
189 | 184 | } |
@@ -193,8 +188,7 @@ discard block |
||
193 | 188 | if (($c = count($this->result_array)) > 0) |
194 | 189 | { |
195 | 190 | $_data = 'result_array'; |
196 | - } |
|
197 | - elseif (($c = count($this->result_object)) > 0) |
|
191 | + } elseif (($c = count($this->result_object)) > 0) |
|
198 | 192 | { |
199 | 193 | $_data = 'result_object'; |
200 | 194 | } |
@@ -334,9 +328,13 @@ discard block |
||
334 | 328 | return $this->row_data[$n]; |
335 | 329 | } |
336 | 330 | |
337 | - if ($type === 'object') return $this->row_object($n); |
|
338 | - elseif ($type === 'array') return $this->row_array($n); |
|
339 | - else return $this->custom_row_object($n, $type); |
|
331 | + if ($type === 'object') { |
|
332 | + return $this->row_object($n); |
|
333 | + } elseif ($type === 'array') { |
|
334 | + return $this->row_array($n); |
|
335 | + } else { |
|
336 | + return $this->custom_row_object($n, $type); |
|
337 | + } |
|
340 | 338 | } |
341 | 339 | |
342 | 340 | // -------------------------------------------------------------------- |
@@ -530,8 +528,7 @@ discard block |
||
530 | 528 | if ($type === 'array') |
531 | 529 | { |
532 | 530 | return $this->_fetch_assoc(); |
533 | - } |
|
534 | - elseif ($type === 'object') |
|
531 | + } elseif ($type === 'object') |
|
535 | 532 | { |
536 | 533 | return $this->_fetch_object(); |
537 | 534 | } |
@@ -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 | } |
@@ -179,8 +179,7 @@ |
||
179 | 179 | if ($v === NULL) |
180 | 180 | { |
181 | 181 | $val_str .= 'NULL'; |
182 | - } |
|
183 | - else |
|
182 | + } else |
|
184 | 183 | { |
185 | 184 | // Escape the data if it's not an integer |
186 | 185 | $val_str .= ($is_int[$i] === FALSE) ? $this->db->escape($v) : $v; |
@@ -176,8 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | $this->dsn = $this->hostname; |
178 | 178 | return; |
179 | - } |
|
180 | - elseif ($this->hostname !== '' && strpos($this->hostname, '/') === FALSE && strpos($this->hostname, ':') === FALSE |
|
179 | + } elseif ($this->hostname !== '' && strpos($this->hostname, '/') === FALSE && strpos($this->hostname, ':') === FALSE |
|
181 | 180 | && (( ! empty($this->port) && ctype_digit($this->port)) OR $this->database !== '')) |
182 | 181 | { |
183 | 182 | /* If the hostname field isn't empty, doesn't contain |
@@ -476,8 +475,7 @@ discard block |
||
476 | 475 | if (strpos($table, '.') !== FALSE) |
477 | 476 | { |
478 | 477 | sscanf($table, '%[^.].%s', $owner, $table); |
479 | - } |
|
480 | - else |
|
478 | + } else |
|
481 | 479 | { |
482 | 480 | $owner = $this->username; |
483 | 481 | } |
@@ -500,8 +498,7 @@ discard block |
||
500 | 498 | if (strpos($table, '.') !== FALSE) |
501 | 499 | { |
502 | 500 | sscanf($table, '%[^.].%s', $owner, $table); |
503 | - } |
|
504 | - else |
|
501 | + } else |
|
505 | 502 | { |
506 | 503 | $owner = $this->username; |
507 | 504 | } |
@@ -561,12 +558,10 @@ discard block |
||
561 | 558 | if (is_resource($this->curs_id)) |
562 | 559 | { |
563 | 560 | return oci_error($this->curs_id); |
564 | - } |
|
565 | - elseif (is_resource($this->stmt_id)) |
|
561 | + } elseif (is_resource($this->stmt_id)) |
|
566 | 562 | { |
567 | 563 | return oci_error($this->stmt_id); |
568 | - } |
|
569 | - elseif (is_resource($this->conn_id)) |
|
564 | + } elseif (is_resource($this->conn_id)) |
|
570 | 565 | { |
571 | 566 | return oci_error($this->conn_id); |
572 | 567 | } |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | if (is_int($this->num_rows)) |
61 | 61 | { |
62 | 62 | return $this->num_rows; |
63 | - } |
|
64 | - elseif (($this->num_rows = odbc_num_rows($this->result_id)) !== -1) |
|
63 | + } elseif (($this->num_rows = odbc_num_rows($this->result_id)) !== -1) |
|
65 | 64 | { |
66 | 65 | return $this->num_rows; |
67 | 66 | } |
@@ -70,8 +69,7 @@ discard block |
||
70 | 69 | if (count($this->result_array) > 0) |
71 | 70 | { |
72 | 71 | return $this->num_rows = count($this->result_array); |
73 | - } |
|
74 | - elseif (count($this->result_object) > 0) |
|
72 | + } elseif (count($this->result_object) > 0) |
|
75 | 73 | { |
76 | 74 | return $this->num_rows = count($this->result_object); |
77 | 75 | } |
@@ -94,16 +94,13 @@ discard block |
||
94 | 94 | $this->hostname = NULL; |
95 | 95 | $this->subdriver = $match[1]; |
96 | 96 | return; |
97 | - } |
|
98 | - elseif (in_array($this->subdriver, array('mssql', 'sybase'), TRUE)) |
|
97 | + } elseif (in_array($this->subdriver, array('mssql', 'sybase'), TRUE)) |
|
99 | 98 | { |
100 | 99 | $this->subdriver = 'dblib'; |
101 | - } |
|
102 | - elseif ($this->subdriver === '4D') |
|
100 | + } elseif ($this->subdriver === '4D') |
|
103 | 101 | { |
104 | 102 | $this->subdriver = '4d'; |
105 | - } |
|
106 | - elseif ( ! in_array($this->subdriver, array('4d', 'cubrid', 'dblib', 'firebird', 'ibm', 'informix', 'mysql', 'oci', 'odbc', 'pgsql', 'sqlite', 'sqlsrv'), TRUE)) |
|
103 | + } elseif ( ! in_array($this->subdriver, array('4d', 'cubrid', 'dblib', 'firebird', 'ibm', 'informix', 'mysql', 'oci', 'odbc', 'pgsql', 'sqlite', 'sqlsrv'), TRUE)) |
|
107 | 104 | { |
108 | 105 | log_message('error', 'PDO: Invalid or non-existent subdriver'); |
109 | 106 | |
@@ -131,8 +128,7 @@ discard block |
||
131 | 128 | try |
132 | 129 | { |
133 | 130 | return new PDO($this->dsn, $this->username, $this->password, $this->options); |
134 | - } |
|
135 | - catch (PDOException $e) |
|
131 | + } catch (PDOException $e) |
|
136 | 132 | { |
137 | 133 | if ($this->db_debug && empty($this->failover)) |
138 | 134 | { |
@@ -161,8 +157,7 @@ discard block |
||
161 | 157 | try |
162 | 158 | { |
163 | 159 | return $this->data_cache['version'] = $this->conn_id->getAttribute(PDO::ATTR_SERVER_VERSION); |
164 | - } |
|
165 | - catch (PDOException $e) |
|
160 | + } catch (PDOException $e) |
|
166 | 161 | { |
167 | 162 | return parent::version(); |
168 | 163 | } |
@@ -60,16 +60,13 @@ discard block |
||
60 | 60 | if (is_int($this->num_rows)) |
61 | 61 | { |
62 | 62 | return $this->num_rows; |
63 | - } |
|
64 | - elseif (count($this->result_array) > 0) |
|
63 | + } elseif (count($this->result_array) > 0) |
|
65 | 64 | { |
66 | 65 | return $this->num_rows = count($this->result_array); |
67 | - } |
|
68 | - elseif (count($this->result_object) > 0) |
|
66 | + } elseif (count($this->result_object) > 0) |
|
69 | 67 | { |
70 | 68 | return $this->num_rows = count($this->result_object); |
71 | - } |
|
72 | - elseif (($num_rows = $this->result_id->rowCount()) > 0) |
|
69 | + } elseif (($num_rows = $this->result_id->rowCount()) > 0) |
|
73 | 70 | { |
74 | 71 | return $this->num_rows = $num_rows; |
75 | 72 | } |
@@ -139,8 +136,7 @@ discard block |
||
139 | 136 | } |
140 | 137 | |
141 | 138 | return $retval; |
142 | - } |
|
143 | - catch (Exception $e) |
|
139 | + } catch (Exception $e) |
|
144 | 140 | { |
145 | 141 | if ($this->db->db_debug) |
146 | 142 | { |