Using ActionWebServices, I am returning an ArtifactRevision model that
has a Image column (binary).
Here is the webservice code:
def get_revision(revision_id)
begin
return ArtifactRevision.find(revision_id)
rescue Exception => e
raise e
end
end
The exception it is throwing is this:
private method `gsub'' called for #<Array:0xae06104>
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/sqlserver_adapter.rb:125:in
`binary_to_string''
(eval):1:in `ArtifactData''
-e:4:in `load''
-e:4
I did some sniffing around in sqlserver_adapter.rb. The binary_to_string
method takes a string as a param, it seems ActionWebService is throwing
it an array? Not sure where to go from here. Thanks in advance.
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Bump -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jason Best wrote:> BumpWell it is almost half a year later and I am now running into this problem as well: attachment.filecontent is a binary field in SQL Server. in script/console test_file << attachment.filecontent NoMethodError: private method `gsub'' called for #<Array:0x45decd4> from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/sqlserver_adapter.rb:136:in `binary_to_string'' from (eval):1:in `filecontent'' from (irb):9 from ?:0 I am not sure why binary_to_string is being passed an array. Same issue, gsub being called on an array. Has anyone figured this out? RJ -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
trying test_file.write (attachment.filecontent.read) results in no errors but then the file written is total garbage. Anyone got a tutorial somewhere on how to get Binary data out of SQL server and write a file from it? Thanks RJ -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
RJ wrote:> trying > > test_file.write (attachment.filecontent.read) > > results in no errors but then the file written is total garbage. Anyone > got a tutorial somewhere on how to get Binary data out of SQL server and > write a file from it? > > Thanks > > RJWe had to switch back to .NET web services because of this bug. The SQL Server adapter isn''t maintained very well. I do hope this gets fixed. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 17/04/07, jabskeeterbug <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> We had to switch back to .NET web services because of this bug. The SQL > Server adapter isn''t maintained very well.I''m sorry you feel that way. Storing binary data in the db simply isn''t a priority for me, so I''ve not really looked at this issue. In any case, without any way to stream binary data to/from the database, storing anything other than very small pieces of binary data will be inefficient. Even without proper binary support, you could always Base64 encode/decode any data you have.> I do hope this gets fixed.While there are some reports with suggested fixes, I don''t believe anyone has submitted a tested patch. If I''m mistaken, or if you can provide one, I will take a look at it (assign it to tomafro). However, I don''t have commit rights to the repository so all I can do is suggest any patch gets applied (I''m not moaning though - Jeremy is usually great at doing this promptly). Tom --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Is this bug adressed already ? I am connecting with a ms sql database (which works fine) By using the connection specified in my database.yml adapter: sqlserver i got this private method `gsub'' called for #<Array:0xae06104> exception. But by using DBI::connect i was able to get some data from an image type datafield (which apears to be an array) from the database. And sent it to the browser using send_data(@data,:filename => "test",:type => "image/jpeg") Only this file isnt viewable , so i guess the jpeg is wraped in some kind of package. I ll go looking for the format and how to display it properly, but if anyone of u knos how to do this it could save me some time. Thx -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David De vits wrote:> Is this bug adressed already ? I am connecting with a ms sql database > (which works fine) By using the connection specified in my database.yml > adapter: sqlserver i got this private method `gsub'' called for > #<Array:0xae06104> exception. But by using DBI::connect i was able to > get some data from an image type datafield (which apears to be an array) > from the database. And sent it to the browser using > send_data(@data,:filename => "test",:type => "image/jpeg") > Only this file isnt viewable , so i guess the jpeg is wraped in some > kind of package. I ll go looking for the format and how to display it > properly, but if anyone of u knos how to do this it could save me some > time. ThxThe same problem. And still looking solution... -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
justin.smestad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Mar-07 23:55 UTC
Re: Image field (binary), MS SQL Server
I am required to use MSSQL for a project I am doing. I am running into
the same problem using open_id_authentication plugin which stores the
server_url in binary format.
Anyway, here is the error I recieve:
ActiveRecord::StatementInvalid in SessionsController#create
DBI::DatabaseError: Execute
OLE error code:80040E14 in Microsoft OLE DB Provider for SQL
Server
The data types image and varchar are incompatible in the equal
to operator.
HRESULT error code:0x80020009
Exception occurred.: SELECT * FROM
open_id_authentication_associations WHERE
(open_id_authentication_associations.[server_url] = ''http://
www.myopenid.com/server'')
I am looking into how to fix this. I would assume this would have been
fixed already, but I will try and figure it out :(
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---