@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | case 'datetime': |
| 213 | 213 | 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) |
| 214 | - return 'to_timestamp('. |
|
| 215 | - 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]). |
|
| 214 | + return 'to_timestamp(' . |
|
| 215 | + 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 | 216 | ',\'YYYY-MM-DD HH24:MI:SS\')'; |
| 217 | 217 | else |
| 218 | 218 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -764,10 +764,10 @@ discard block |
||
| 764 | 764 | $returning = ''; |
| 765 | 765 | $with_returning = false; |
| 766 | 766 | // lets build the returning string, mysql allow only in normal mode |
| 767 | - if(!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0) |
|
| 767 | + if (!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0) |
|
| 768 | 768 | { |
| 769 | 769 | // we only take the first key |
| 770 | - $returning = ' RETURNING '.$keys[0]; |
|
| 770 | + $returning = ' RETURNING ' . $keys[0]; |
|
| 771 | 771 | $with_returning = true; |
| 772 | 772 | } |
| 773 | 773 | |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '") |
| 799 | 799 | VALUES |
| 800 | 800 | ' . implode(', |
| 801 | - ', $insertRows).$replace.$returning, |
|
| 801 | + ', $insertRows) . $replace . $returning, |
|
| 802 | 802 | array( |
| 803 | 803 | 'security_override' => true, |
| 804 | 804 | 'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors', |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | if ($returnmode === 2) |
| 812 | 812 | $return_var = array(); |
| 813 | 813 | |
| 814 | - while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
| 814 | + while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
| 815 | 815 | { |
| 816 | 816 | if (is_numeric($row[0])) // try to emulate mysql limitation |
| 817 | 817 | { |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | case 'datetime': |
| 257 | 257 | 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) |
| 258 | - return 'str_to_date('. |
|
| 259 | - 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]). |
|
| 258 | + return 'str_to_date(' . |
|
| 259 | + 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]) . |
|
| 260 | 260 | ',\'%Y-%m-%d %h:%i:%s\')'; |
| 261 | 261 | else |
| 262 | 262 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | $connection |
| 824 | 824 | ); |
| 825 | 825 | |
| 826 | - if(!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0) |
|
| 826 | + if (!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0) |
|
| 827 | 827 | { |
| 828 | 828 | if ($returnmode == 1) |
| 829 | 829 | $return_var = smf_db_insert_id($table, $keys[0]) + count($insertRows) - 1; |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | $return_var = array(); |
| 833 | 833 | $count = count($insertRows); |
| 834 | 834 | $start = smf_db_insert_id($table, $keys[0]); |
| 835 | - for ($i = 0; $i < $count; $i++ ) |
|
| 835 | + for ($i = 0; $i < $count; $i++) |
|
| 836 | 836 | $return_var[] = $start + $i; |
| 837 | 837 | } |
| 838 | 838 | return $return_var; |