@@ -199,22 +199,22 @@ discard block |
||
199 | 199 | |
200 | 200 | case 'date': |
201 | 201 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) |
202 | - return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]).'::date'; |
|
202 | + return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date'; |
|
203 | 203 | else |
204 | 204 | smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
205 | 205 | break; |
206 | 206 | |
207 | 207 | case 'time': |
208 | 208 | if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) |
209 | - return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]).'::time'; |
|
209 | + return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time'; |
|
210 | 210 | else |
211 | 211 | smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
212 | 212 | break; |
213 | 213 | |
214 | 214 | case 'datetime': |
215 | 215 | 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) |
216 | - return 'to_timestamp('. |
|
217 | - 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]). |
|
216 | + return 'to_timestamp(' . |
|
217 | + 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]) . |
|
218 | 218 | ',\'YYYY-MM-DD HH24:MI:SS\')'; |
219 | 219 | else |
220 | 220 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -763,10 +763,10 @@ discard block |
||
763 | 763 | $returning = ''; |
764 | 764 | $with_returning = false; |
765 | 765 | // lets build the returning string, mysql allow only in normal mode |
766 | - if(!empty($keys) && (count($keys) > 0) && ($method === '' || $method === 'insert') && $returnmode > 0) |
|
766 | + if (!empty($keys) && (count($keys) > 0) && ($method === '' || $method === 'insert') && $returnmode > 0) |
|
767 | 767 | { |
768 | 768 | // we only take the first key |
769 | - $returning = ' RETURNING '.$keys[0]; |
|
769 | + $returning = ' RETURNING ' . $keys[0]; |
|
770 | 770 | $with_returning = true; |
771 | 771 | } |
772 | 772 | |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '") |
798 | 798 | VALUES |
799 | 799 | ' . implode(', |
800 | - ', $insertRows).$replace.$returning, |
|
800 | + ', $insertRows) . $replace . $returning, |
|
801 | 801 | array( |
802 | 802 | 'security_override' => true, |
803 | 803 | 'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors', |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | if ($returnmode === 2) |
811 | 811 | $return_var = array(); |
812 | 812 | |
813 | - while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
813 | + while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
814 | 814 | { |
815 | 815 | if (is_numeric($row[0])) // try to emulate mysql limitation |
816 | 816 | { |