Explorar o código

Fixed a couple of bugs in the database export: tricks work only with selected tables and removed the comma from the last insert

Signed-off-by: emanuele <[email protected]>
emanuele %!s(int64=13) %!d(string=hai) anos
pai
achega
c737fdef5e
Modificáronse 3 ficheiros con 10 adicións e 1 borrados
  1. 4 1
      Sources/DbExtra-mysql.php
  2. 3 0
      Sources/DbExtra-postgresql.php
  3. 3 0
      Sources/DbExtra-sqlite.php

+ 4 - 1
Sources/DbExtra-mysql.php

@@ -267,6 +267,9 @@ function smf_db_insert_sql($tableName, $new_table = false)
 	$data = '';
 	$tableName = str_replace('{db_prefix}', $db_prefix, $tableName);
 
+	if ($tableName != $db_prefix . 'messages' || $tableName != $db_prefix . 'topics')
+		$detected_id = 0;
+
 	// This will be handy...
 	$crlf = "\r\n";
 
@@ -322,7 +325,7 @@ function smf_db_insert_sql($tableName, $new_table = false)
 	}
 
 	$smcFunc['db_free_result']($result);
-	$data .= ';' . $crlf;
+	$data = substr(trim($data), 0, -1) . ';' . $crlf . $crlf;
 
 	$start += $limit;
 

+ 3 - 0
Sources/DbExtra-postgresql.php

@@ -162,6 +162,9 @@ function smf_db_insert_sql($tableName, $new_table = false)
 	$data = '';
 	$tableName = str_replace('{db_prefix}', $db_prefix, $tableName);
 
+	if ($tableName != $db_prefix . 'messages' || $tableName != $db_prefix . 'topics')
+		$detected_id = 0;
+
 	// This will be handy...
 	$crlf = "\r\n";
 

+ 3 - 0
Sources/DbExtra-sqlite.php

@@ -209,6 +209,9 @@ function smf_db_insert_sql($tableName, $new_table = false)
 	$data = '';
 	$tableName = str_replace('{db_prefix}', $db_prefix, $tableName);
 
+	if ($tableName != $db_prefix . 'messages' || $tableName != $db_prefix . 'topics')
+		$detected_id = 0;
+
 	// This will be handy...
 	$crlf = "\r\n";