@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * List databases |
29 | 29 | * |
30 | 30 | * @access private |
31 | - * @return bool |
|
31 | + * @return string |
|
32 | 32 | */ |
33 | 33 | function _list_databases() |
34 | 34 | { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @access private |
46 | 46 | * @param string the table name |
47 | - * @return object |
|
47 | + * @return string |
|
48 | 48 | */ |
49 | 49 | function _optimize_table($table) |
50 | 50 | { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @access private |
62 | 62 | * @param string the table name |
63 | - * @return object |
|
63 | + * @return string |
|
64 | 64 | */ |
65 | 65 | function _repair_table($table) |
66 | 66 | { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @access private |
75 | 75 | * @param array Preferences |
76 | - * @return mixed |
|
76 | + * @return false|string |
|
77 | 77 | */ |
78 | 78 | function _backup($params = array()) |
79 | 79 | { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | // Trim off the end comma |
161 | - $field_str = preg_replace( "/, $/" , "" , $field_str); |
|
161 | + $field_str = preg_replace("/, $/", "", $field_str); |
|
162 | 162 | |
163 | 163 | |
164 | 164 | // Build the insert string |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | // Remove the comma at the end of the string |
196 | - $val_str = preg_replace( "/, $/" , "" , $val_str); |
|
196 | + $val_str = preg_replace("/, $/", "", $val_str); |
|
197 | 197 | |
198 | 198 | // Build the INSERT string |
199 | 199 | $output .= 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -173,15 +175,13 @@ discard block |
||
173 | 175 | if ($v === NULL) |
174 | 176 | { |
175 | 177 | $val_str .= 'NULL'; |
176 | - } |
|
177 | - else |
|
178 | + } else |
|
178 | 179 | { |
179 | 180 | // Escape the data if it's not an integer |
180 | 181 | if ($is_int[$i] == FALSE) |
181 | 182 | { |
182 | 183 | $val_str .= $this->db->escape($v); |
183 | - } |
|
184 | - else |
|
184 | + } else |
|
185 | 185 | { |
186 | 186 | $val_str .= $v; |
187 | 187 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @access public |
371 | 371 | * @param string |
372 | - * @return string |
|
372 | + * @return integer |
|
373 | 373 | */ |
374 | 374 | function count_all($table = '') |
375 | 375 | { |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @access public |
440 | 440 | * @param string the table name |
441 | - * @return object |
|
441 | + * @return string |
|
442 | 442 | */ |
443 | 443 | function _field_data($table) |
444 | 444 | { |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * |
524 | 524 | * @access public |
525 | 525 | * @param type |
526 | - * @return type |
|
526 | + * @return string |
|
527 | 527 | */ |
528 | 528 | function _from_tables($tables) |
529 | 529 | { |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | return 0; |
379 | 379 | } |
380 | 380 | |
381 | - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
381 | + $query = $this->query($this->_count_string.$this->_protect_identifiers('numrows')." FROM ".$this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
382 | 382 | |
383 | 383 | if ($query->num_rows() == 0) |
384 | 384 | { |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | $row = $query->row(); |
389 | 389 | $this->_reset_select(); |
390 | - return (int) $row->numrows; |
|
390 | + return (int)$row->numrows; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | // -------------------------------------------------------------------- |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | { |
494 | 494 | if (strpos($item, '.'.$id) !== FALSE) |
495 | 495 | { |
496 | - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); |
|
496 | + $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item); |
|
497 | 497 | |
498 | 498 | // remove duplicates if the user already included the escape |
499 | 499 | return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); |
@@ -614,11 +614,11 @@ discard block |
||
614 | 614 | |
615 | 615 | $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; |
616 | 616 | |
617 | - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; |
|
617 | + $orderby = (count($orderby) >= 1) ? ' ORDER BY '.implode(", ", $orderby) : ''; |
|
618 | 618 | |
619 | 619 | $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); |
620 | 620 | |
621 | - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; |
|
621 | + $sql .= ($where != '' AND count($where) >= 1) ? " WHERE ".implode(" ", $where) : ''; |
|
622 | 622 | |
623 | 623 | $sql .= $orderby.$limit; |
624 | 624 | |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | function _update_batch($table, $values, $index, $where = NULL) |
642 | 642 | { |
643 | 643 | $ids = array(); |
644 | - $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : ''; |
|
644 | + $where = ($where != '' AND count($where) >= 1) ? implode(" ", $where).' AND ' : ''; |
|
645 | 645 | |
646 | 646 | foreach ($values as $key => $val) |
647 | 647 | { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | { |
652 | 652 | if ($field != $index) |
653 | 653 | { |
654 | - $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; |
|
654 | + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; |
|
655 | 655 | } |
656 | 656 | } |
657 | 657 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -70,8 +72,7 @@ discard block |
||
70 | 72 | if ($this->port != '') |
71 | 73 | { |
72 | 74 | return @mysqli_connect($this->hostname, $this->username, $this->password, $this->database, $this->port); |
73 | - } |
|
74 | - else |
|
75 | + } else |
|
75 | 76 | { |
76 | 77 | return @mysqli_connect($this->hostname, $this->username, $this->password, $this->database); |
77 | 78 | } |
@@ -144,8 +145,7 @@ discard block |
||
144 | 145 | if ($this->use_set_names === TRUE) |
145 | 146 | { |
146 | 147 | return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'"); |
147 | - } |
|
148 | - else |
|
148 | + } else |
|
149 | 149 | { |
150 | 150 | return @mysqli_set_charset($this->conn_id, $charset); |
151 | 151 | } |
@@ -314,12 +314,10 @@ discard block |
||
314 | 314 | if (function_exists('mysqli_real_escape_string') AND is_object($this->conn_id)) |
315 | 315 | { |
316 | 316 | $str = mysqli_real_escape_string($this->conn_id, $str); |
317 | - } |
|
318 | - elseif (function_exists('mysql_escape_string')) |
|
317 | + } elseif (function_exists('mysql_escape_string')) |
|
319 | 318 | { |
320 | 319 | $str = mysql_escape_string($str); |
321 | - } |
|
322 | - else |
|
320 | + } else |
|
323 | 321 | { |
324 | 322 | $str = addslashes($str); |
325 | 323 | } |
@@ -503,8 +501,7 @@ discard block |
||
503 | 501 | if (strpos($item, '.') !== FALSE) |
504 | 502 | { |
505 | 503 | $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; |
506 | - } |
|
507 | - else |
|
504 | + } else |
|
508 | 505 | { |
509 | 506 | $str = $this->_escape_char.$item.$this->_escape_char; |
510 | 507 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @access private |
31 | 31 | * @param string the database name |
32 | - * @return bool |
|
32 | + * @return string |
|
33 | 33 | */ |
34 | 34 | function _create_database($name) |
35 | 35 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @access private |
45 | 45 | * @param string the database name |
46 | - * @return bool |
|
46 | + * @return string |
|
47 | 47 | */ |
48 | 48 | function _drop_database($name) |
49 | 49 | { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param mixed primary key(s) |
141 | 141 | * @param mixed key(s) |
142 | 142 | * @param boolean should 'IF NOT EXISTS' be added to the SQL |
143 | - * @return bool |
|
143 | + * @return string |
|
144 | 144 | */ |
145 | 145 | function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) |
146 | 146 | { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @param string the column name |
213 | 213 | * @param array fields |
214 | 214 | * @param string the field after which we should add the new field |
215 | - * @return object |
|
215 | + * @return string |
|
216 | 216 | */ |
217 | 217 | function _alter_table($alter_type, $table, $fields, $after_field = '') |
218 | 218 | { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | if (array_key_exists('TYPE', $attributes)) |
88 | 88 | { |
89 | - $sql .= ' '.$attributes['TYPE']; |
|
89 | + $sql .= ' '.$attributes['TYPE']; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | if (array_key_exists('CONSTRAINT', $attributes)) |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | $key_name = $this->db->_protect_identifiers(implode('_', $primary_keys)); |
161 | 161 | $primary_keys = $this->db->_protect_identifiers($primary_keys); |
162 | - $sql .= ",\n\tPRIMARY KEY ".$key_name." (" . implode(', ', $primary_keys) . ")"; |
|
162 | + $sql .= ",\n\tPRIMARY KEY ".$key_name." (".implode(', ', $primary_keys).")"; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | if (is_array($keys) && count($keys) > 0) |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $key = array($key_name); |
178 | 178 | } |
179 | 179 | |
180 | - $sql .= ",\n\tKEY {$key_name} (" . implode(', ', $key) . ")"; |
|
180 | + $sql .= ",\n\tKEY {$key_name} (".implode(', ', $key).")"; |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | if ($after_field != '') |
230 | 230 | { |
231 | - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); |
|
231 | + $sql .= ' AFTER '.$this->db->_protect_identifiers($after_field); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | return $sql; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -72,8 +74,7 @@ discard block |
||
72 | 74 | if (is_numeric($field)) |
73 | 75 | { |
74 | 76 | $sql .= "\n\t$attributes"; |
75 | - } |
|
76 | - else |
|
77 | + } else |
|
77 | 78 | { |
78 | 79 | $attributes = array_change_key_case($attributes, CASE_UPPER); |
79 | 80 | |
@@ -107,8 +108,7 @@ discard block |
||
107 | 108 | if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) |
108 | 109 | { |
109 | 110 | $sql .= ' NULL'; |
110 | - } |
|
111 | - else |
|
111 | + } else |
|
112 | 112 | { |
113 | 113 | $sql .= ' NOT NULL'; |
114 | 114 | } |
@@ -170,8 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | $key_name = $this->db->_protect_identifiers(implode('_', $key)); |
172 | 172 | $key = $this->db->_protect_identifiers($key); |
173 | - } |
|
174 | - else |
|
173 | + } else |
|
175 | 174 | { |
176 | 175 | $key_name = $this->db->_protect_identifiers($key); |
177 | 176 | $key = array($key_name); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * List databases |
29 | 29 | * |
30 | 30 | * @access private |
31 | - * @return bool |
|
31 | + * @return string |
|
32 | 32 | */ |
33 | 33 | function _list_databases() |
34 | 34 | { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @access private |
46 | 46 | * @param string the table name |
47 | - * @return object |
|
47 | + * @return string |
|
48 | 48 | */ |
49 | 49 | function _optimize_table($table) |
50 | 50 | { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @access private |
62 | 62 | * @param string the table name |
63 | - * @return object |
|
63 | + * @return string |
|
64 | 64 | */ |
65 | 65 | function _repair_table($table) |
66 | 66 | { |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /* |
3 | 5 | | ------------------------------------------------------------------- |
4 | 6 | | AUTO-LOADER |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * Select the database |
117 | 117 | * |
118 | 118 | * @access private called by the base class |
119 | - * @return resource |
|
119 | + * @return boolean |
|
120 | 120 | */ |
121 | 121 | public function db_select() |
122 | 122 | { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @access public |
133 | 133 | * @param string |
134 | 134 | * @param string |
135 | - * @return resource |
|
135 | + * @return boolean |
|
136 | 136 | */ |
137 | 137 | public function db_set_charset($charset, $collation) |
138 | 138 | { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * getCursor. Returns a cursor from the datbase |
210 | 210 | * |
211 | 211 | * @access public |
212 | - * @return cursor id |
|
212 | + * @return resource id |
|
213 | 213 | */ |
214 | 214 | public function get_cursor() |
215 | 215 | { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @access public |
455 | 455 | * @param string |
456 | - * @return string |
|
456 | + * @return integer |
|
457 | 457 | */ |
458 | 458 | public function count_all($table = '') |
459 | 459 | { |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | * |
523 | 523 | * @access public |
524 | 524 | * @param string the table name |
525 | - * @return object |
|
525 | + * @return string |
|
526 | 526 | */ |
527 | 527 | protected function _field_data($table) |
528 | 528 | { |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * |
612 | 612 | * @access protected |
613 | 613 | * @param type |
614 | - * @return type |
|
614 | + * @return string |
|
615 | 615 | */ |
616 | 616 | protected function _from_tables($tables) |
617 | 617 | { |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | $have_cursor = FALSE; |
256 | 256 | foreach ($params as $param) |
257 | 257 | { |
258 | - $sql .= $param['name'] . ","; |
|
258 | + $sql .= $param['name'].","; |
|
259 | 259 | |
260 | 260 | if (array_key_exists('type', $param) && ($param['type'] === OCI_B_CURSOR)) |
261 | 261 | { |
262 | 262 | $have_cursor = TRUE; |
263 | 263 | } |
264 | 264 | } |
265 | - $sql = trim($sql, ",") . "); end;"; |
|
265 | + $sql = trim($sql, ",")."); end;"; |
|
266 | 266 | |
267 | 267 | $this->stmt_id = FALSE; |
268 | 268 | $this->_set_stmt_id($sql); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | // escape LIKE condition wildcards |
409 | 409 | if ($like === TRUE) |
410 | 410 | { |
411 | - $str = str_replace( array('%', '_', $this->_like_escape_chr), |
|
411 | + $str = str_replace(array('%', '_', $this->_like_escape_chr), |
|
412 | 412 | array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), |
413 | 413 | $str); |
414 | 414 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | return 0; |
463 | 463 | } |
464 | 464 | |
465 | - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
465 | + $query = $this->query($this->_count_string.$this->_protect_identifiers('numrows')." FROM ".$this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
466 | 466 | |
467 | 467 | if ($query == FALSE) |
468 | 468 | { |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | |
472 | 472 | $row = $query->row(); |
473 | 473 | $this->_reset_select(); |
474 | - return (int) $row->numrows; |
|
474 | + return (int)$row->numrows; |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | // -------------------------------------------------------------------- |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | { |
582 | 582 | if (strpos($item, '.'.$id) !== FALSE) |
583 | 583 | { |
584 | - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); |
|
584 | + $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item); |
|
585 | 585 | |
586 | 586 | // remove duplicates if the user already included the escape |
587 | 587 | return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | |
662 | 662 | for ($i = 0, $c = count($values); $i < $c; $i++) |
663 | 663 | { |
664 | - $sql .= ' INTO ' . $table . ' (' . $keys . ') VALUES ' . $values[$i] . "\n"; |
|
664 | + $sql .= ' INTO '.$table.' ('.$keys.') VALUES '.$values[$i]."\n"; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | $sql .= 'SELECT * FROM dual'; |
@@ -693,11 +693,11 @@ discard block |
||
693 | 693 | |
694 | 694 | $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; |
695 | 695 | |
696 | - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; |
|
696 | + $orderby = (count($orderby) >= 1) ? ' ORDER BY '.implode(", ", $orderby) : ''; |
|
697 | 697 | |
698 | 698 | $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); |
699 | 699 | |
700 | - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; |
|
700 | + $sql .= ($where != '' AND count($where) >= 1) ? " WHERE ".implode(" ", $where) : ''; |
|
701 | 701 | |
702 | 702 | $sql .= $orderby.$limit; |
703 | 703 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | // ------------------------------------------------------------------------ |
4 | 6 | |
@@ -59,8 +61,7 @@ discard block |
||
59 | 61 | if ($download == "") |
60 | 62 | { |
61 | 63 | return $str; |
62 | - } |
|
63 | - else |
|
64 | + } else |
|
64 | 65 | { |
65 | 66 | echo $str; |
66 | 67 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * result set starts at zero |
126 | 126 | * |
127 | 127 | * @access private |
128 | - * @return array |
|
128 | + * @return boolean |
|
129 | 129 | */ |
130 | 130 | function _data_seek($n = 0) |
131 | 131 | { |
@@ -184,7 +184,8 @@ discard block |
||
184 | 184 | * not available (odbc_fetch_object requires unixODBC) |
185 | 185 | * |
186 | 186 | * @access private |
187 | - * @return object |
|
187 | + * @return boolean |
|
188 | + * @param null|false $odbc_result |
|
188 | 189 | */ |
189 | 190 | function _odbc_fetch_object(& $odbc_result) { |
190 | 191 | $rs = array(); |
@@ -207,6 +208,7 @@ discard block |
||
207 | 208 | * |
208 | 209 | * @access private |
209 | 210 | * @return array |
211 | + * @param null|false $odbc_result |
|
210 | 212 | */ |
211 | 213 | function _odbc_fetch_array(& $odbc_result) { |
212 | 214 | $rs = array(); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $field_names = array(); |
66 | 66 | for ($i = 0; $i < $this->num_fields(); $i++) |
67 | 67 | { |
68 | - $field_names[] = odbc_field_name($this->result_id, $i); |
|
68 | + $field_names[] = odbc_field_name($this->result_id, $i); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | return $field_names; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | $retval = array(); |
87 | 87 | for ($i = 0; $i < $this->num_fields(); $i++) |
88 | 88 | { |
89 | - $F = new stdClass(); |
|
89 | + $F = new stdClass(); |
|
90 | 90 | $F->name = odbc_field_name($this->result_id, $i); |
91 | 91 | $F->type = odbc_field_type($this->result_id, $i); |
92 | - $F->max_length = odbc_field_len($this->result_id, $i); |
|
92 | + $F->max_length = odbc_field_len($this->result_id, $i); |
|
93 | 93 | $F->primary_key = 0; |
94 | - $F->default = ''; |
|
94 | + $F->default = ''; |
|
95 | 95 | |
96 | 96 | $retval[] = $F; |
97 | 97 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $rs_obj = FALSE; |
192 | 192 | if (odbc_fetch_into($odbc_result, $rs)) { |
193 | 193 | foreach ($rs as $k=>$v) { |
194 | - $field_name= odbc_field_name($odbc_result, $k+1); |
|
194 | + $field_name = odbc_field_name($odbc_result, $k + 1); |
|
195 | 195 | $rs_obj->$field_name = $v; |
196 | 196 | } |
197 | 197 | } |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | $rs = array(); |
213 | 213 | $rs_assoc = FALSE; |
214 | 214 | if (odbc_fetch_into($odbc_result, $rs)) { |
215 | - $rs_assoc=array(); |
|
215 | + $rs_assoc = array(); |
|
216 | 216 | foreach ($rs as $k=>$v) { |
217 | - $field_name= odbc_field_name($odbc_result, $k+1); |
|
217 | + $field_name = odbc_field_name($odbc_result, $k + 1); |
|
218 | 218 | $rs_assoc[$field_name] = $v; |
219 | 219 | } |
220 | 220 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -471,8 +473,7 @@ discard block |
||
471 | 473 | if (strpos($item, '.') !== FALSE) |
472 | 474 | { |
473 | 475 | $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; |
474 | - } |
|
475 | - else |
|
476 | + } else |
|
476 | 477 | { |
477 | 478 | $str = $this->_escape_char.$item.$this->_escape_char; |
478 | 479 | } |
@@ -627,8 +628,7 @@ discard block |
||
627 | 628 | if ($offset == 0) |
628 | 629 | { |
629 | 630 | $offset = ''; |
630 | - } |
|
631 | - else |
|
631 | + } else |
|
632 | 632 | { |
633 | 633 | $offset .= ", "; |
634 | 634 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * Non-persistent database connection |
90 | 90 | * |
91 | 91 | * @access private called by the base class |
92 | - * @return resource |
|
92 | + * @return PDO |
|
93 | 93 | */ |
94 | 94 | function db_connect() |
95 | 95 | { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * Persistent database connection |
105 | 105 | * |
106 | 106 | * @access private called by the base class |
107 | - * @return resource |
|
107 | + * @return PDO |
|
108 | 108 | */ |
109 | 109 | function db_pconnect() |
110 | 110 | { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * Select the database |
141 | 141 | * |
142 | 142 | * @access private called by the base class |
143 | - * @return resource |
|
143 | + * @return boolean |
|
144 | 144 | */ |
145 | 145 | function db_select() |
146 | 146 | { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @access public |
157 | 157 | * @param string |
158 | 158 | * @param string |
159 | - * @return resource |
|
159 | + * @return boolean |
|
160 | 160 | */ |
161 | 161 | function db_set_charset($charset, $collation) |
162 | 162 | { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @access public |
396 | 396 | * @param string |
397 | - * @return string |
|
397 | + * @return integer |
|
398 | 398 | */ |
399 | 399 | function count_all($table = '') |
400 | 400 | { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @access public |
466 | 466 | * @param string the table name |
467 | - * @return object |
|
467 | + * @return string |
|
468 | 468 | */ |
469 | 469 | function _field_data($table) |
470 | 470 | { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $this->_like_escape_chr = ''; |
60 | 60 | |
61 | 61 | //Prior to this version, the charset can't be set in the dsn |
62 | - if(is_php('5.3.6')) |
|
62 | + if (is_php('5.3.6')) |
|
63 | 63 | { |
64 | 64 | $this->hostname .= ";charset={$this->char_set}"; |
65 | 65 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | // Reset the transaction failure flag. |
244 | 244 | // If the $test_mode flag is set to TRUE transactions will be rolled back |
245 | 245 | // even if the queries produce a successful result. |
246 | - $this->_trans_failure = (bool) ($test_mode === TRUE); |
|
246 | + $this->_trans_failure = (bool)($test_mode === TRUE); |
|
247 | 247 | |
248 | 248 | return $this->conn_id->beginTransaction(); |
249 | 249 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | // escape LIKE condition wildcards |
333 | 333 | if ($like === TRUE) |
334 | 334 | { |
335 | - $str = str_replace( array('%', '_', $this->_like_escape_chr), |
|
335 | + $str = str_replace(array('%', '_', $this->_like_escape_chr), |
|
336 | 336 | array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), |
337 | 337 | $str); |
338 | 338 | } |
@@ -361,18 +361,18 @@ discard block |
||
361 | 361 | * @access public |
362 | 362 | * @return integer |
363 | 363 | */ |
364 | - function insert_id($name=NULL) |
|
364 | + function insert_id($name = NULL) |
|
365 | 365 | { |
366 | 366 | //Convenience method for postgres insertid |
367 | 367 | if (strpos($this->hostname, 'pgsql') !== FALSE) |
368 | 368 | { |
369 | 369 | $v = $this->_version(); |
370 | 370 | |
371 | - $table = func_num_args() > 0 ? func_get_arg(0) : NULL; |
|
371 | + $table = func_num_args() > 0 ? func_get_arg(0) : NULL; |
|
372 | 372 | |
373 | 373 | if ($table == NULL && $v >= '8.1') |
374 | 374 | { |
375 | - $sql='SELECT LASTVAL() as ins_id'; |
|
375 | + $sql = 'SELECT LASTVAL() as ins_id'; |
|
376 | 376 | } |
377 | 377 | $query = $this->query($sql); |
378 | 378 | $row = $query->row(); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | return 0; |
404 | 404 | } |
405 | 405 | |
406 | - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
406 | + $query = $this->query($this->_count_string.$this->_protect_identifiers('numrows')." FROM ".$this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
407 | 407 | |
408 | 408 | if ($query->num_rows() == 0) |
409 | 409 | { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | |
413 | 413 | $row = $query->row(); |
414 | 414 | $this->_reset_select(); |
415 | - return (int) $row->numrows; |
|
415 | + return (int)$row->numrows; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | // -------------------------------------------------------------------- |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | { |
521 | 521 | if (strpos($item, '.'.$id) !== FALSE) |
522 | 522 | { |
523 | - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); |
|
523 | + $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item); |
|
524 | 524 | |
525 | 525 | // remove duplicates if the user already included the escape |
526 | 526 | return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); |
@@ -623,11 +623,11 @@ discard block |
||
623 | 623 | |
624 | 624 | $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; |
625 | 625 | |
626 | - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; |
|
626 | + $orderby = (count($orderby) >= 1) ? ' ORDER BY '.implode(", ", $orderby) : ''; |
|
627 | 627 | |
628 | 628 | $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); |
629 | 629 | |
630 | - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; |
|
630 | + $sql .= ($where != '' AND count($where) >= 1) ? " WHERE ".implode(" ", $where) : ''; |
|
631 | 631 | |
632 | 632 | $sql .= $orderby.$limit; |
633 | 633 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | function _update_batch($table, $values, $index, $where = NULL) |
651 | 651 | { |
652 | 652 | $ids = array(); |
653 | - $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : ''; |
|
653 | + $where = ($where != '' AND count($where) >= 1) ? implode(" ", $where).' AND ' : ''; |
|
654 | 654 | |
655 | 655 | foreach ($values as $key => $val) |
656 | 656 | { |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | { |
661 | 661 | if ($field != $index) |
662 | 662 | { |
663 | - $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; |
|
663 | + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; |
|
664 | 664 | } |
665 | 665 | } |
666 | 666 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -66,13 +68,11 @@ discard block |
||
66 | 68 | |
67 | 69 | //Set the charset with the connection options |
68 | 70 | $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}"; |
69 | - } |
|
70 | - else if (strpos($this->hostname, 'odbc') !== FALSE) |
|
71 | + } else if (strpos($this->hostname, 'odbc') !== FALSE) |
|
71 | 72 | { |
72 | 73 | $this->_like_escape_str = " {escape '%s'} "; |
73 | 74 | $this->_like_escape_chr = '!'; |
74 | - } |
|
75 | - else |
|
75 | + } else |
|
76 | 76 | { |
77 | 77 | $this->_like_escape_str = " ESCAPE '%s' "; |
78 | 78 | $this->_like_escape_chr = '!'; |
@@ -194,8 +194,7 @@ discard block |
||
194 | 194 | if (is_object($result_id)) |
195 | 195 | { |
196 | 196 | $this->affect_rows = $result_id->rowCount(); |
197 | - } |
|
198 | - else |
|
197 | + } else |
|
199 | 198 | { |
200 | 199 | $this->affect_rows = 0; |
201 | 200 | } |
@@ -377,8 +376,7 @@ discard block |
||
377 | 376 | $query = $this->query($sql); |
378 | 377 | $row = $query->row(); |
379 | 378 | return $row->ins_id; |
380 | - } |
|
381 | - else |
|
379 | + } else |
|
382 | 380 | { |
383 | 381 | return $this->conn_id->lastInsertId($name); |
384 | 382 | } |
@@ -531,8 +529,7 @@ discard block |
||
531 | 529 | { |
532 | 530 | $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; |
533 | 531 | |
534 | - } |
|
535 | - else |
|
532 | + } else |
|
536 | 533 | { |
537 | 534 | $str = $this->_escape_char.$item.$this->_escape_char; |
538 | 535 | } |
@@ -759,15 +756,13 @@ discard block |
||
759 | 756 | if ($offset == 0) |
760 | 757 | { |
761 | 758 | $offset = ''; |
762 | - } |
|
763 | - else |
|
759 | + } else |
|
764 | 760 | { |
765 | 761 | $offset .= ", "; |
766 | 762 | } |
767 | 763 | |
768 | 764 | return $sql."LIMIT ".$offset.$limit; |
769 | - } |
|
770 | - else |
|
765 | + } else |
|
771 | 766 | { |
772 | 767 | $sql .= "LIMIT ".$limit; |
773 | 768 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param mixed primary key(s) |
74 | 74 | * @param mixed key(s) |
75 | 75 | * @param boolean should 'IF NOT EXISTS' be added to the SQL |
76 | - * @return bool |
|
76 | + * @return string |
|
77 | 77 | */ |
78 | 78 | function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) |
79 | 79 | { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param string the default value |
204 | 204 | * @param boolean should 'NOT NULL' be added |
205 | 205 | * @param string the field after which we should add the new field |
206 | - * @return object |
|
206 | + * @return string |
|
207 | 207 | */ |
208 | 208 | function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') |
209 | 209 | { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | $sql .= "\n\t".$this->db->_protect_identifiers($field); |
105 | 105 | |
106 | - $sql .= ' '.$attributes['TYPE']; |
|
106 | + $sql .= ' '.$attributes['TYPE']; |
|
107 | 107 | |
108 | 108 | if (array_key_exists('CONSTRAINT', $attributes)) |
109 | 109 | { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if (count($primary_keys) > 0) |
146 | 146 | { |
147 | 147 | $primary_keys = $this->db->_protect_identifiers($primary_keys); |
148 | - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; |
|
148 | + $sql .= ",\n\tPRIMARY KEY (".implode(', ', $primary_keys).")"; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if (is_array($keys) && count($keys) > 0) |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $key = array($this->db->_protect_identifiers($key)); |
162 | 162 | } |
163 | 163 | |
164 | - $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; |
|
164 | + $sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).")"; |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | if ($after_field != '') |
218 | 218 | { |
219 | - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); |
|
219 | + $sql .= ' AFTER '.$this->db->_protect_identifiers($after_field); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return $sql; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -96,8 +98,7 @@ discard block |
||
96 | 98 | if (is_numeric($field)) |
97 | 99 | { |
98 | 100 | $sql .= "\n\t$attributes"; |
99 | - } |
|
100 | - else |
|
101 | + } else |
|
101 | 102 | { |
102 | 103 | $attributes = array_change_key_case($attributes, CASE_UPPER); |
103 | 104 | |
@@ -123,8 +124,7 @@ discard block |
||
123 | 124 | if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) |
124 | 125 | { |
125 | 126 | $sql .= ' NULL'; |
126 | - } |
|
127 | - else |
|
127 | + } else |
|
128 | 128 | { |
129 | 129 | $sql .= ' NOT NULL'; |
130 | 130 | } |
@@ -155,8 +155,7 @@ discard block |
||
155 | 155 | if (is_array($key)) |
156 | 156 | { |
157 | 157 | $key = $this->db->_protect_identifiers($key); |
158 | - } |
|
159 | - else |
|
158 | + } else |
|
160 | 159 | { |
161 | 160 | $key = array($this->db->_protect_identifiers($key)); |
162 | 161 | } |
@@ -208,8 +207,7 @@ discard block |
||
208 | 207 | if ($null === NULL) |
209 | 208 | { |
210 | 209 | $sql .= ' NULL'; |
211 | - } |
|
212 | - else |
|
210 | + } else |
|
213 | 211 | { |
214 | 212 | $sql .= ' NOT NULL'; |
215 | 213 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * Select the database |
125 | 125 | * |
126 | 126 | * @access private called by the base class |
127 | - * @return resource |
|
127 | + * @return boolean |
|
128 | 128 | */ |
129 | 129 | function db_select() |
130 | 130 | { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @access public |
141 | 141 | * @param string |
142 | 142 | * @param string |
143 | - * @return resource |
|
143 | + * @return boolean |
|
144 | 144 | */ |
145 | 145 | function db_set_charset($charset, $collation) |
146 | 146 | { |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @access public |
370 | 370 | * @param string |
371 | - * @return string |
|
371 | + * @return integer |
|
372 | 372 | */ |
373 | 373 | function count_all($table = '') |
374 | 374 | { |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @access public |
439 | 439 | * @param string the table name |
440 | - * @return object |
|
440 | + * @return string |
|
441 | 441 | */ |
442 | 442 | function _field_data($table) |
443 | 443 | { |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * The error message number |
464 | 464 | * |
465 | 465 | * @access private |
466 | - * @return integer |
|
466 | + * @return string |
|
467 | 467 | */ |
468 | 468 | function _error_number() |
469 | 469 | { |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | * |
523 | 523 | * @access public |
524 | 524 | * @param type |
525 | - * @return type |
|
525 | + * @return string |
|
526 | 526 | */ |
527 | 527 | function _from_tables($tables) |
528 | 528 | { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | // escape LIKE condition wildcards |
297 | 297 | if ($like === TRUE) |
298 | 298 | { |
299 | - $str = str_replace( array('%', '_', $this->_like_escape_chr), |
|
299 | + $str = str_replace(array('%', '_', $this->_like_escape_chr), |
|
300 | 300 | array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), |
301 | 301 | $str); |
302 | 302 | } |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | $v = $this->_version(); |
331 | 331 | $v = $v['server']; |
332 | 332 | |
333 | - $table = func_num_args() > 0 ? func_get_arg(0) : NULL; |
|
334 | - $column = func_num_args() > 1 ? func_get_arg(1) : NULL; |
|
333 | + $table = func_num_args() > 0 ? func_get_arg(0) : NULL; |
|
334 | + $column = func_num_args() > 1 ? func_get_arg(1) : NULL; |
|
335 | 335 | |
336 | 336 | if ($table == NULL && $v >= '8.1') |
337 | 337 | { |
338 | - $sql='SELECT LASTVAL() as ins_id'; |
|
338 | + $sql = 'SELECT LASTVAL() as ins_id'; |
|
339 | 339 | } |
340 | 340 | elseif ($table != NULL && $column != NULL && $v >= '8.0') |
341 | 341 | { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | return 0; |
378 | 378 | } |
379 | 379 | |
380 | - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
380 | + $query = $this->query($this->_count_string.$this->_protect_identifiers('numrows')." FROM ".$this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
381 | 381 | |
382 | 382 | if ($query->num_rows() == 0) |
383 | 383 | { |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | $row = $query->row(); |
388 | 388 | $this->_reset_select(); |
389 | - return (int) $row->numrows; |
|
389 | + return (int)$row->numrows; |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | // -------------------------------------------------------------------- |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | { |
493 | 493 | if (strpos($item, '.'.$id) !== FALSE) |
494 | 494 | { |
495 | - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); |
|
495 | + $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item); |
|
496 | 496 | |
497 | 497 | // remove duplicates if the user already included the escape |
498 | 498 | return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); |
@@ -594,11 +594,11 @@ discard block |
||
594 | 594 | |
595 | 595 | $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; |
596 | 596 | |
597 | - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; |
|
597 | + $orderby = (count($orderby) >= 1) ? ' ORDER BY '.implode(", ", $orderby) : ''; |
|
598 | 598 | |
599 | 599 | $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); |
600 | 600 | |
601 | - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; |
|
601 | + $sql .= ($where != '' AND count($where) >= 1) ? " WHERE ".implode(" ", $where) : ''; |
|
602 | 602 | |
603 | 603 | $sql .= $orderby.$limit; |
604 | 604 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -336,20 +338,17 @@ discard block |
||
336 | 338 | if ($table == NULL && $v >= '8.1') |
337 | 339 | { |
338 | 340 | $sql='SELECT LASTVAL() as ins_id'; |
339 | - } |
|
340 | - elseif ($table != NULL && $column != NULL && $v >= '8.0') |
|
341 | + } elseif ($table != NULL && $column != NULL && $v >= '8.0') |
|
341 | 342 | { |
342 | 343 | $sql = sprintf("SELECT pg_get_serial_sequence('%s','%s') as seq", $table, $column); |
343 | 344 | $query = $this->query($sql); |
344 | 345 | $row = $query->row(); |
345 | 346 | $sql = sprintf("SELECT CURRVAL('%s') as ins_id", $row->seq); |
346 | - } |
|
347 | - elseif ($table != NULL) |
|
347 | + } elseif ($table != NULL) |
|
348 | 348 | { |
349 | 349 | // seq_name passed in table parameter |
350 | 350 | $sql = sprintf("SELECT CURRVAL('%s') as ins_id", $table); |
351 | - } |
|
352 | - else |
|
351 | + } else |
|
353 | 352 | { |
354 | 353 | return pg_last_oid($this->result_id); |
355 | 354 | } |
@@ -502,8 +501,7 @@ discard block |
||
502 | 501 | if (strpos($item, '.') !== FALSE) |
503 | 502 | { |
504 | 503 | $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; |
505 | - } |
|
506 | - else |
|
504 | + } else |
|
507 | 505 | { |
508 | 506 | $str = $this->_escape_char.$item.$this->_escape_char; |
509 | 507 | } |