Hi I am trying to update a blob column from Ruby script into MySQL DB. The script is running on PC and DB on Linux host. The problem I see is that only 255 bytes of data being stored , is there any way to deal with that problem ? myconnect = Mysql::new(host, user, "", db) f = File.new(file_name,''rb'') data = Mysql.escape_string(f.sysread(f.size)) update_sql = "update SHARE set COMPANY_LOGO = ''"+ data + "'' WHERE ID 8982167534873685924"; stmt = myconnect.prepare(update_sql) stmt.execute() stmt.close myconnect.commit myconnect.close I also tried to leave a - ''?'' mark and than fill it with data, that one is not storing anything. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 23, 8:51 pm, Roman Mandeleil <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi I am trying to update a blob column from Ruby script into MySQL DB. > The script is running on PC and DB on Linux host. > The problem I see is that only 255 bytes of data being stored , > is there any way to deal with that problem ?What''s the type of the column? Fred> > myconnect = Mysql::new(host, user, "", db) > f = File.new(file_name,''rb'') > > data = Mysql.escape_string(f.sysread(f.size)) > > update_sql = "update SHARE set COMPANY_LOGO = ''"+ data + "'' WHERE ID > 8982167534873685924"; > > stmt = myconnect.prepare(update_sql) > stmt.execute() > > stmt.close > myconnect.commit > myconnect.close > > I also tried to leave a - ''?'' mark and than fill it with data, that one > is not storing anything. > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
tinyblob -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Please quote when replying. Roman Mandeleil wrote in post #970391:> tinyblobWell, there''s your problem -- a MySQL TINYBLOB only holds 255 bytes of data! Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yep I got it. So much trouble with the script so I missed the obvious. But, I still don''t understand why the place holder for the update statement doesn''t work: I mean that syntax: update_sql = "update SHARE set COMPANY_LOGO = ? WHERE ID 8982167534873685924"; stmt = myconnect.prepare(update_sql) stmt.execute(data) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.