Hammer2001 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to use MySQL's LOAD_FILE() function to SQL UPDATE existing records in a table. I am getting a SQL syntax error I suspect because the file contains, single and double quotes as well as slashes. I have also tried reading the file in binary mode using Perl's binmode into a scalar and using MySQL UPDATE....SET, but that also bombs when the SQL is executed with a syntax error.
I am at a loss, as I know INSERT will also be a pain since the data contains quotes which are needed as field separators. Anyone have any ideas on other approaches I might try?
The actual SQL:
is successful when executed from mysql client, so I know the MySQL requirements are met.UPDATE artists SET page=LOAD_FILE('/tmp/left.txt') where code='aname';
In Perl:
is what bombs. I have checked values of the scalars before SQL execution and they seem fine.UPDATE artistsfull SET page=LOAD_FILE($infile) where code='$code';
Any Spiritual guidance much appreciated.
Back to
Seekers of Perl Wisdom