@@ -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 | if (array_key_exists('CONSTRAINT', $attributes)) |
| 92 | 92 | { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | { |
| 175 | 175 | $key_name = $this->db->_protect_identifiers(implode('_', $primary_keys)); |
| 176 | 176 | $primary_keys = $this->db->_protect_identifiers($primary_keys); |
| 177 | - $sql .= ",\n\tPRIMARY KEY ".$key_name." (" . implode(', ', $primary_keys) . ")"; |
|
| 177 | + $sql .= ",\n\tPRIMARY KEY ".$key_name." (".implode(', ', $primary_keys).")"; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (is_array($keys) && count($keys) > 0) |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $key = array($key_name); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $sql .= ",\n\tKEY {$key_name} (" . implode(', ', $key) . ")"; |
|
| 195 | + $sql .= ",\n\tKEY {$key_name} (".implode(', ', $key).")"; |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | if ($after_field != '') |
| 245 | 245 | { |
| 246 | - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); |
|
| 246 | + $sql .= ' AFTER '.$this->db->_protect_identifiers($after_field); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | return $sql; |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | return 0; |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
| 384 | + $query = $this->query($this->_count_string.$this->_protect_identifiers('numrows')." FROM ".$this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
| 385 | 385 | |
| 386 | 386 | if ($query->num_rows() == 0) |
| 387 | 387 | { |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | $row = $query->row(); |
| 392 | 392 | $this->_reset_select(); |
| 393 | - return (int) $row->numrows; |
|
| 393 | + return (int)$row->numrows; |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // -------------------------------------------------------------------- |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | { |
| 497 | 497 | if (strpos($item, '.'.$id) !== FALSE) |
| 498 | 498 | { |
| 499 | - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); |
|
| 499 | + $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item); |
|
| 500 | 500 | |
| 501 | 501 | // remove duplicates if the user already included the escape |
| 502 | 502 | return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); |
@@ -613,16 +613,16 @@ discard block |
||
| 613 | 613 | { |
| 614 | 614 | foreach ($values as $key => $val) |
| 615 | 615 | { |
| 616 | - $valstr[] = $key . ' = ' . $val; |
|
| 616 | + $valstr[] = $key.' = '.$val; |
|
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; |
| 620 | 620 | |
| 621 | - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; |
|
| 621 | + $orderby = (count($orderby) >= 1) ? ' ORDER BY '.implode(", ", $orderby) : ''; |
|
| 622 | 622 | |
| 623 | 623 | $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); |
| 624 | 624 | |
| 625 | - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; |
|
| 625 | + $sql .= ($where != '' AND count($where) >= 1) ? " WHERE ".implode(" ", $where) : ''; |
|
| 626 | 626 | |
| 627 | 627 | $sql .= $orderby.$limit; |
| 628 | 628 | |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | function _update_batch($table, $values, $index, $where = NULL) |
| 647 | 647 | { |
| 648 | 648 | $ids = array(); |
| 649 | - $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : ''; |
|
| 649 | + $where = ($where != '' AND count($where) >= 1) ? implode(" ", $where).' AND ' : ''; |
|
| 650 | 650 | |
| 651 | 651 | foreach ($values as $key => $val) |
| 652 | 652 | { |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | { |
| 657 | 657 | if ($field != $index) |
| 658 | 658 | { |
| 659 | - $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; |
|
| 659 | + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; |
|
| 660 | 660 | } |
| 661 | 661 | } |
| 662 | 662 | } |
@@ -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; |
@@ -94,9 +94,9 @@ |
||
| 94 | 94 | $F = new stdClass(); |
| 95 | 95 | $F->name = $field->Field; |
| 96 | 96 | $F->type = $type; |
| 97 | - $F->default = $field->Default; |
|
| 98 | - $F->max_length = $length; |
|
| 99 | - $F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 ); |
|
| 97 | + $F->default = $field->Default; |
|
| 98 | + $F->max_length = $length; |
|
| 99 | + $F->primary_key = ($field->Key == 'PRI' ? 1 : 0); |
|
| 100 | 100 | |
| 101 | 101 | $retval[] = $F; |
| 102 | 102 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $sql .= "\n\t".$this->db->_protect_identifiers($field); |
| 104 | 104 | |
| 105 | - $sql .= ' '.$attributes['TYPE']; |
|
| 105 | + $sql .= ' '.$attributes['TYPE']; |
|
| 106 | 106 | |
| 107 | 107 | if (array_key_exists('CONSTRAINT', $attributes)) |
| 108 | 108 | { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | if (count($primary_keys) > 0) |
| 145 | 145 | { |
| 146 | 146 | $primary_keys = $this->db->_protect_identifiers($primary_keys); |
| 147 | - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; |
|
| 147 | + $sql .= ",\n\tPRIMARY KEY (".implode(', ', $primary_keys).")"; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (is_array($keys) && count($keys) > 0) |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $key = array($this->db->_protect_identifiers($key)); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; |
|
| 163 | + $sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).")"; |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | if ($after_field != '') |
| 235 | 235 | { |
| 236 | - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); |
|
| 236 | + $sql .= ' AFTER '.$this->db->_protect_identifiers($after_field); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | return $sql; |
@@ -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 | } |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | |
| 86 | 86 | try |
| 87 | 87 | { |
| 88 | - for($i = 0; $i < $this->num_fields(); $i++) |
|
| 88 | + for ($i = 0; $i < $this->num_fields(); $i++) |
|
| 89 | 89 | { |
| 90 | 90 | $data[] = $this->result_id->getColumnMeta($i); |
| 91 | 91 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $attributes = array_change_key_case($attributes, CASE_UPPER); |
| 83 | 83 | |
| 84 | - $sql .= "\n\t\"" . $this->db->_protect_identifiers($field) . "\""; |
|
| 84 | + $sql .= "\n\t\"".$this->db->_protect_identifiers($field)."\""; |
|
| 85 | 85 | |
| 86 | 86 | if (array_key_exists('NAME', $attributes)) |
| 87 | 87 | { |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | // If there is a PK defined |
| 186 | 186 | if (count($primary_keys) > 0) |
| 187 | 187 | { |
| 188 | - $key_name = "pk_" . $table . "_" . |
|
| 188 | + $key_name = "pk_".$table."_". |
|
| 189 | 189 | $this->db->_protect_identifiers(implode('_', $primary_keys)); |
| 190 | 190 | |
| 191 | 191 | $primary_keys = $this->db->_protect_identifiers($primary_keys); |
| 192 | - $sql .= ",\n\tCONSTRAINT " . $key_name . " PRIMARY KEY(" . implode(', ', $primary_keys) . ")"; |
|
| 192 | + $sql .= ",\n\tCONSTRAINT ".$key_name." PRIMARY KEY(".implode(', ', $primary_keys).")"; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (is_array($keys) && count($keys) > 0) |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | $key = array($key_name); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - $sql .= ",\n\tKEY \"{$key_name}\" (" . implode(', ', $key) . ")"; |
|
| 210 | + $sql .= ",\n\tKEY \"{$key_name}\" (".implode(', ', $key).")"; |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | if ($after_field != '') |
| 260 | 260 | { |
| 261 | - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); |
|
| 261 | + $sql .= ' AFTER '.$this->db->_protect_identifiers($after_field); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | return $sql; |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | while ($field = cubrid_fetch_field($this->result_id)) |
| 85 | 85 | { |
| 86 | - $F = new stdClass(); |
|
| 86 | + $F = new stdClass(); |
|
| 87 | 87 | $F->name = $field->name; |
| 88 | 88 | $F->type = $field->type; |
| 89 | - $F->default = $field->def; |
|
| 90 | - $F->max_length = $field->max_length; |
|
| 89 | + $F->default = $field->def; |
|
| 90 | + $F->max_length = $field->max_length; |
|
| 91 | 91 | |
| 92 | 92 | // At this moment primary_key property is not returned when |
| 93 | 93 | // cubrid_fetch_field is called. The following code will |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | // The query will search for exact single columns, thus |
| 104 | 104 | // compound PK is not supported. |
| 105 | 105 | $res = cubrid_query($this->conn_id, |
| 106 | - "SELECT COUNT(*) FROM db_index WHERE class_name = '" . $field->table . |
|
| 107 | - "' AND is_primary_key = 'YES' AND index_name = 'pk_" . |
|
| 108 | - $field->table . "_" . $field->name . "'" |
|
| 106 | + "SELECT COUNT(*) FROM db_index WHERE class_name = '".$field->table. |
|
| 107 | + "' AND is_primary_key = 'YES' AND index_name = 'pk_". |
|
| 108 | + $field->table."_".$field->name."'" |
|
| 109 | 109 | ); |
| 110 | 110 | |
| 111 | 111 | if ($res) |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | function free_result() |
| 141 | 141 | { |
| 142 | - if(is_resource($this->result_id) || |
|
| 142 | + if (is_resource($this->result_id) || |
|
| 143 | 143 | get_resource_type($this->result_id) == "Unknown" && |
| 144 | 144 | preg_match('/Resource id #/', strval($this->result_id))) |
| 145 | 145 | { |