
G. Miernicki - 2009-02-03 21:06:53 -
In reply to message 1 from G. Miernicki
I did some research and found the source of the problem. In the _sqlBackup() function, there was no check for NULL values in the code. As such, the insert statements where being made like INSERT ... VALUE("NULL") instead of INSERT ... VALUE(NULL). The quotes are what was the problem, it causes the integer and string fields in some cases to use default values instead of the actual value.
I have corrected the code in class.SQLBackup.php around 173 with the following:
foreach ($theDataRow as $theValue)
{
if ( $theValue == NULL )
{
$theData[] = "NULL";
} else {
$theData[] = $theDB->escape_string($theValue) ;
}
}
$theData = '"'. implode('", "', $theData) .'"' ;
$theData = str_replace('"NULL"', 'NULL', $theData);
Inserting this should correct the problem.
Let's hope the author still checks these forums and updates his code!
-Greg