Jan 21, 2015, 7:02 AM
Old DBD:DBI:CSV program on a Linux host has been working for (15+?) years. Now need to port it to a newer AIX box.
WHERE has changed to Numeric Comparison - SOLVED (or, at least a good work-around)
The old (working) WHERE clause, . . . if it saw "5151" for a key, ONLY matched/updated "5151" in the master. But the latest CSV modules on the AIX host . . . "5151" matches "5151", but it ALSO (wrongly) matches "0005151".
Its as if the functionality of the WHERE comparison has changed from String/Textual to Numerical comparison.
I can't find (and I've looked hard) a way to "declare" (as string to force string comparison) or "quote" to force string comparison.
Has anyone found a way around this issue?
For an original/Master table like :
An update entry like :
Should update ONLY the 5151 line in the master. (And on the old Linux app it does.) Like :
But on the new AIX (newer DBD/DBI/CSV modules) . . . it updates both lines, like :
Which is wrong (or at least very undesirable). Its as if the comparison has flipped over the years from literal string, to numerical and it sees 0005151 as equal to 5151.
$XMASTER_db->do("UPDATE XMASTER \
SET DateTime='$DateTime', LifeHours='$LifeHours' \
WHERE ( SerialNumber='$SerialNumber' AND \
LifeHours<'$LifeHours' AND \
DateTime<'$DateTime' ) ");
On the old-original code, it was escaped double quotes (like \" ) around the \"$SerialNumber\"
Had to switch to single quotes '$SerialNumber' on the new host/modules or I get stupid errors (like "Can't find column 5151").
Is there any way to FORCE String/Textual and non Numerical comparisons in a WHERE?
(This post was edited by jhumkey on Jan 23, 2015, 7:21 AM)