I have a PHP script that imports sql scripts into a MySQL 5 database. Each script contains only statements UPDATE, each update line 1 in the table (MyISAM).
If the line was not inside one of these scenarios for 2 days, it must be deleted. The table has a timestamp column. However, when the UPDATE statement does not change any columns, the timestamp is not updated, and I cannot say that the line was in the import file or not. Is there a way to force update this timestamp, even if the data does not change?
EDIT:
Further clarification.
Imported files are gzipped files containing about 450,000 lines, each line is 1 UPDATE statement.
Here's the PHP function that processes import files:
private function ImportFile($filename) {
$importfile = gzopen($filename, "r");
if (!$importfile) {
throw new Exception("Could not open Gzip file " . $filename);
}
while (!gzeof($importfile)) {
$line = gzgets($importfile, 4096);
if (!$line) {
throw new Exception("Error reading line number $line Gzip file $filename");
}
if (strlen(trim($line)) > 0) {
$this->DB->Query($line);
}
}
gzclose($importfile);
}
source
share