@@ -200,22 +200,22 @@ discard block |
||
200 | 200 | |
201 | 201 | case 'date': |
202 | 202 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) |
203 | - return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]).'::date'; |
|
203 | + return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date'; |
|
204 | 204 | else |
205 | 205 | smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
206 | 206 | break; |
207 | 207 | |
208 | 208 | case 'time': |
209 | 209 | if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) |
210 | - return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]).'::time'; |
|
210 | + return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time'; |
|
211 | 211 | else |
212 | 212 | smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
213 | 213 | break; |
214 | 214 | |
215 | 215 | case 'datetime': |
216 | 216 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
217 | - return 'to_timestamp('. |
|
218 | - sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
|
217 | + return 'to_timestamp(' . |
|
218 | + sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . |
|
219 | 219 | ',\'YYYY-MM-DD HH24:MI:SS\')'; |
220 | 220 | else |
221 | 221 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $query_hints_undo .= 'SET LOCAL join_collapse_limit = default;'; |
478 | 478 | } |
479 | 479 | |
480 | - $db_string = $query_hints_set .' |
|
480 | + $db_string = $query_hints_set . ' |
|
481 | 481 | ' . $db_string; |
482 | 482 | |
483 | 483 | } |
@@ -792,10 +792,10 @@ discard block |
||
792 | 792 | $returning = ''; |
793 | 793 | $with_returning = false; |
794 | 794 | // lets build the returning string, mysql allow only in normal mode |
795 | - if(!empty($keys) && (count($keys) > 0) && ($method === '' || $method === 'insert') && $returnmode > 0) |
|
795 | + if (!empty($keys) && (count($keys) > 0) && ($method === '' || $method === 'insert') && $returnmode > 0) |
|
796 | 796 | { |
797 | 797 | // we only take the first key |
798 | - $returning = ' RETURNING '.$keys[0]; |
|
798 | + $returning = ' RETURNING ' . $keys[0]; |
|
799 | 799 | $with_returning = true; |
800 | 800 | } |
801 | 801 | |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '") |
827 | 827 | VALUES |
828 | 828 | ' . implode(', |
829 | - ', $insertRows).$replace.$returning, |
|
829 | + ', $insertRows) . $replace . $returning, |
|
830 | 830 | array( |
831 | 831 | 'security_override' => true, |
832 | 832 | 'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors', |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | if ($returnmode === 2) |
840 | 840 | $return_var = array(); |
841 | 841 | |
842 | - while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
842 | + while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
843 | 843 | { |
844 | 844 | if (is_numeric($row[0])) // try to emulate mysql limitation |
845 | 845 | { |