[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

lo_export problem

Andrea Campagna

7/4/2007 10:48:00 AM

Hi,

i'm trying to store a picture from the DB to the filesystem.
i've used the function lo_export like that:


res = conn.query("SELECT nome,physical_image FROM images;")

i=0
while(res[i]!=nil)
conn.lo_export(res[i][1].to_i,'/home/andrea/senior/public/images/#{res[i][0]}.jpg')
i+=1

end


conn.close())

there're not errors, the script run...
The problem is that no files are created and i don't know why.
Can somebody help me??

thanks in advance...

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

1 Answer

John Joyce

7/4/2007 3:08:00 PM

0


On Jul 4, 2007, at 5:48 AM, incoroneta wrote:

> Hi,
>
> i'm trying to store a picture from the DB to the filesystem.
> i've used the function lo_export like that:
>
>
> res = conn.query("SELECT nome,physical_image FROM images;")
>
> i=0
> while(res[i]!=nil)
> conn.lo_export(res[i][1].to_i,'/home/andrea/senior/public/images/#
> {res[i][0]}.jpg')
> i+=1
>
> end
>
>
> conn.close())
>
> there're not errors, the script run...
> The problem is that no files are created and i don't know why.
> Can somebody help me??
>
> thanks in advance...
>
> --
> Posted via http://www.ruby-....
>
Check out the IO and File libraries.
ri File
ri IO
also, in Ruby it's a good idea to put spaces before and after
operators...
i += 1