We're trying to pull data from MS SQL Server using the FreeTDS driver for PDO and inserting it into a MySQL table. However, it seems that one record is being populated with the correct data followed by a string of junk characters and even portions of other queries. We were able to replicate by re-importing the same record and each time it included different junk data.
Has anyone else run into this type of odd behavior? What could cause this?
The code basically boils down to selecting an NVARCHAR fields from SQL Server and inserting it into a VARCHAR fields in MySQL. For example:
SELECT ItemName FROM Items;
INSERT INTO Items (ItemName) VALUES ('gat43C4533');
the result in the MySQL table is
gat43?4533 -*[$%^&^%#$^%&] . CASE WHEN GHYT.Test...
Is there any way PDO could throw some type of error or handle this gracefully without populating the field with junk?
Is there any way this could be a bug in MySQL, or FreeTDS? No one has addressed the fact that random SQL code is showing up. Since it seems to be trying to insert some unreadable data could there be some memory issue where data is being returned from some random memory location? Or there is memory corruption?