[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

mssql image field: ado returns an array

David De vits

2/5/2008 9:52:00 AM

Hi,
Im trying to get an image out a mssql image type datafield thru DBI:ADO.
The problem is that the result returned is an array and not a binary
string and thus the image is garbage when i write it to a file. Is there
a way to turn the array into a binary string ? Or some other solution ?

this is the function i use to get the photo out of the database:
def self.get_photo(dbh)
sql = "SELECT p_photo, photoinfo, photo " +
"FROM photos " +
"WHERE p_photo = '0' "
sth = dbh.prepare(sql)
sth.execute()
row = sth.fetch
return row[2]
end
--
Posted via http://www.ruby-....

3 Answers

Simon Vetterli

2/17/2008 3:29:00 PM

0

David De vits wrote:
> Hi,
> Im trying to get an image out a mssql image type datafield thru DBI:ADO.
> The problem is that the result returned is an array and not a binary
> string and thus the image is garbage when i write it to a file. Is there
> a way to turn the array into a binary string ? Or some other solution ?
>
> this is the function i use to get the photo out of the database:
> def self.get_photo(dbh)
> sql = "SELECT p_photo, photoinfo, photo " +
> "FROM photos " +
> "WHERE p_photo = '0' "
> sth = dbh.prepare(sql)
> sth.execute()
> row = sth.fetch
> return row[2]
> end

Hi

Did You get any result? I have the same problem and don't know how to
do.

Kind Regards.
--
Posted via http://www.ruby-....

David De vits

2/20/2008 8:12:00 AM

0

Simon Vetterli wrote:

> Hi
>
> Did You get any result? I have the same problem and don't know how to
> do.
>
> Kind Regards.

Hello,

No, sadly enough i still have the problem and no time to digg deeper in
rails to try and fix this. Maybe some rails guru can help us out.
--
Posted via http://www.ruby-....

Simon Vetterli

2/20/2008 5:54:00 PM

0

David De vits wrote:
> Simon Vetterli wrote:
>
>> Hi
>>
>> Did You get any result? I have the same problem and don't know how to
>> do.
>>
>> Kind Regards.
>
> Hello,
>
> No, sadly enough i still have the problem and no time to digg deeper in
> rails to try and fix this. Maybe some rails guru can help us out.

Hi

I try this week or in start of next how to do it. I made it with MySQL
and noch I have to porting to MSSQL. I will contact You when it's works.

Kind Regards.
--
Posted via http://www.ruby-....