mssql image field: ado returns an array

D

David De vits

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
 
S

Simon Vetterli

David said:
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.
 
D

David De vits

Simon said:
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.
 
S

Simon Vetterli

David said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top