Completed
Push — release-2.1 ( 573aeb...abcd56 )
by Colin
07:34
created
Sources/Subs-Db-postgresql.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 
199 199
 		case 'date':
200 200
 			if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1)
201
-				return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]).'::date';
201
+				return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date';
202 202
 			else
203 203
 				smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
204 204
 		break;
205 205
 
206 206
 		case 'time':
207 207
 			if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1)
208
-				return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]).'::time';
208
+				return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time';
209 209
 			else
210 210
 				smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
211 211
 		break;
212 212
 
213 213
 		case 'datetime':
214 214
 			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)
215
-				return 'to_timestamp('.
216
-					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]).
215
+				return 'to_timestamp(' .
216
+					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 217
 					',\'YYYY-MM-DD HH24:MI:SS\')';
218 218
 			else
219 219
 				smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 		$old_pos = 0;
424 424
 		$pos = -1;
425 425
 		// Remove the string escape for better runtime
426
-		$db_string_1 = str_replace('\'\'','',$db_string);
426
+		$db_string_1 = str_replace('\'\'', '', $db_string);
427 427
 		while (true)
428 428
 		{
429 429
 			$pos = strpos($db_string_1, '\'', $pos + 1);
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	if (!empty($keys) && (count($keys) > 0) && $returnmode > 0)
802 802
 	{
803 803
 		// we only take the first key
804
-		$returning = ' RETURNING '.$keys[0];
804
+		$returning = ' RETURNING ' . $keys[0];
805 805
 		$with_returning = true;
806 806
 	}
807 807
 
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 			INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '")
833 833
 			VALUES
834 834
 				' . implode(',
835
-				', $insertRows).$replace.$returning,
835
+				', $insertRows) . $replace . $returning,
836 836
 			array(
837 837
 				'security_override' => true,
838 838
 				'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors',
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 			if ($returnmode === 2)
846 846
 				$return_var = array();
847 847
 
848
-			while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning)
848
+			while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning)
849 849
 			{
850 850
 				if (is_numeric($row[0])) // try to emulate mysql limitation
851 851
 				{
Please login to merge, or discard this patch.
Sources/Subs-Db-mysql.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 
255 255
 		case 'datetime':
256 256
 			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)
257
-				return 'str_to_date('.
258
-					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]).
257
+				return 'str_to_date(' .
258
+					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]) .
259 259
 					',\'%Y-%m-%d %h:%i:%s\')';
260 260
 			else
261 261
 				smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 		$old_pos = 0;
460 460
 		$pos = -1;
461 461
 		// Remove the string escape for better runtime
462
-		$db_string_1 = str_replace('\\\'','',$db_string);
462
+		$db_string_1 = str_replace('\\\'', '', $db_string);
463 463
 		while (true)
464 464
 		{
465 465
 			$pos = strpos($db_string_1, '\'', $pos + 1);
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 	{
842 842
 		$count = count($insertRows);
843 843
 		$ai = 0;
844
-		for($i = 0; $i < $count; $i++)
844
+		for ($i = 0; $i < $count; $i++)
845 845
 		{
846 846
 			$old_id = $smcFunc['db_insert_id']();
847 847
 			
@@ -867,13 +867,13 @@  discard block
 block discarded – undo
867 867
 				$count2 = count($indexed_columns);
868 868
 				for ($x = 0; $x < $count2; $x++)
869 869
 				{
870
-					$where_string += key($indexed_columns[$x]) . ' = '. $insertRows[$i][$x];
870
+					$where_string += key($indexed_columns[$x]) . ' = ' . $insertRows[$i][$x];
871 871
 					if (($x + 1) < $count2)
872 872
 						$where_string += ' AND ';
873 873
 				}
874 874
 
875
-				$request = $smcFunc['db_query']('','
876
-					SELECT `'. $keys[0] . '` FROM ' . $table .'
875
+				$request = $smcFunc['db_query']('', '
876
+					SELECT `'. $keys[0] . '` FROM ' . $table . '
877 877
 					WHERE ' . $where_string . ' LIMIT 1',
878 878
 					array()
879 879
 				);
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 			$return_var = array();
903 903
 			$count = count($insertRows);
904 904
 			$start = smf_db_insert_id($table, $keys[0]);
905
-			for ($i = 0; $i < $count; $i++ )
905
+			for ($i = 0; $i < $count; $i++)
906 906
 				$return_var[] = $start + $i;
907 907
 		}
908 908
 		return $return_var;
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 	mysqli_stmt_bind_param($mysql_error_data_prep, 'iissssssi', 
1036 1036
 		$error_array[0], $error_array[1], $error_array[2], $error_array[3], $error_array[4], $error_array[5], $error_array[6],
1037 1037
 		$error_array[7], $error_array[8]);
1038
-	mysqli_stmt_execute ($mysql_error_data_prep);
1038
+	mysqli_stmt_execute($mysql_error_data_prep);
1039 1039
 }
1040 1040
 
1041 1041
 ?>
1042 1042
\ No newline at end of file
Please login to merge, or discard this patch.