mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-01-12 06:41:14 +01:00
Bugfix MysqlCopyRow NULL values are converted to empty string
This commit is contained in:
parent
623b041a5f
commit
c0a9156f0e
@ -1424,7 +1424,7 @@ class DB{
|
|||||||
if(empty($TableName) || empty($IDFieldName) || empty($IDToDuplicate)) {
|
if(empty($TableName) || empty($IDFieldName) || empty($IDToDuplicate)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
$sql = "SELECT * FROM $TableName WHERE $IDFieldName = $IDToDuplicate";
|
$sql = "SELECT * FROM $TableName WHERE $IDFieldName = $IDToDuplicate";
|
||||||
$result = @mysqli_query($this->connection,$sql);
|
$result = @mysqli_query($this->connection,$sql);
|
||||||
if(empty($result)) {
|
if(empty($result)) {
|
||||||
@ -1442,6 +1442,23 @@ class DB{
|
|||||||
}
|
}
|
||||||
$sql .= $RowKeys[$i] . " = '" . $this->real_escape_string($RowValues[$i]) . "'";
|
$sql .= $RowKeys[$i] . " = '" . $this->real_escape_string($RowValues[$i]) . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mysqli_query($this->connection,$sql);
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sql = "INSERT INTO ".$TableName." SELECT ";
|
||||||
|
$fields = $this->GetColAssocArray($TableName);
|
||||||
|
$comma = "";
|
||||||
|
foreach ($fields as $field => $value) {
|
||||||
|
if ($field != $IDFieldName) {
|
||||||
|
$sql .= $comma."`".$field."`";
|
||||||
|
} else {
|
||||||
|
$sql .= "NULL";
|
||||||
|
}
|
||||||
|
$comma = ", ";
|
||||||
|
}
|
||||||
|
$sql .= " FROM ".$TableName." WHERE id = ".$IDToDuplicate;
|
||||||
|
|
||||||
@mysqli_query($this->connection,$sql);
|
@mysqli_query($this->connection,$sql);
|
||||||
|
|
||||||
$id = $this->GetInsertID();
|
$id = $this->GetInsertID();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user