Chris Sendall
2006-Jan-17 12:51 UTC
[Rails] Insert blob - rails 1.0.0 mysql 3.23 - sql syntax error
Hi, Experimenting with upload and insert a picture into a MySQL database - using Agile Web Development with Rails p362-3. We have rails 1.0.0 and MySQL 3.23.58. I get an error ''You have an error in your SQL syntax near'' because rails uses the x''ffdbff....'' notation for the blob which is not available until MySQL 4 Is there a way of switching Rails to use the 0xffdbff... notation? Thanks Chris -- Chris Sendall University of Cambridge
Mike Blyth
2006-Jan-29 19:35 UTC
[Rails] Insert blob - rails 1.0.0 mysql 3.23 - sql syntax error
I had the same problem and think I''ve solved it, but only because you
spelled it out so clearly. Caveat: I know essentially zero about the Rails
software or mySQL so be sure to make backups, be cautious, etc. However, I found
that changing line 120 (or so) in
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb
from "x''#{s}''" to "0x#{s}" (all the
quotes are there in the source, I haven''t added any).
The file may of course be located somewhere else on your system. I had to reboot
the system to make the change take effect but if that''s not convenient
for you maybe you can find what process is running that needs to be restarted.
Hope it works for you.
Mike Blyth, MD
ECWA Evangel Hospital
Jos, Nigeria
http://www.ecwaevangel.org
+234-803-385-4268 (mobile/sms)
+234-73-452-980 (home)
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060129/1f0c027f/attachment.html