You are on page 1of 4

Hi Ahmed;

Q1: is there any way to store image already in Hard disk to BLOB field in table (automatically)
A1: NO (not automatically). However, you could use the FileReadEx ( ) method
and UpdateBlob PowerBuilder command to accomplish this in PowerScript code.
Q2: can i do vice versa of the previous point??
A2: Yes, by using the SelectBlob and FileWriteEx ( ) PowerBuilder commands to accomplish this in
PowerScript code.
HTH
Regards ... Chris

A1
No (not automatically). However I could use ..........
could i make script that for each row in table that i store the path (loop) ...
blob pdf_blob
for i = 1 to rowcount()
ls_path = dw_1.object.pdf_path[i]
li_fnum = FileOpen(ls_path , StreamMode!)
ll_bytes = FileReadEx(li_fnum, pdf_blob)
updateblob table1 set ole_image = :pdf_blob
WHERE ..........
next
thus it can be done automatically - or there are some thing wrong?
Q3
If i use data pipeline to copy table that contain Blob to other table(either in the same DB or in
different DB)
is Blob column will be in the new table with data or with no data (images)
Q4
if for now i use column as Blob and enter data on it(images)
later can i modify it to be Blob with filestreaming without need to modify any code in app
Regards

try to create a picture object and put the image inside this, like example:

// Mostra a foto na tela do colaborador


SELECTBLOB imagem INTO :lb_imagem
FROM colaborador
WHERE nr_matricula = :ll_matricula ;

if len(lb_imagem) = 0 or isnull(lb_imagem) then


p_1.PictureName = " "
p_1.visible = false
else
p_1.visible = true
p_1.setpicture(lb_imagem)
end if

maybe this can help you, first you might have to create a temp file from
the blob.

This script is not mine, just can't remeber whre I got it, (probably here)
//start Script
//Obtain Image from DB to be used later
//ll_max = dw_wallpapers.GetItemNumber(dw_wallpapers.RowCount(), 2)
// SelectBlob imagen
// into :lblob_imagen
// from imagenes
// Where imagen_ind = :ll_max;
//
// If SQLCA.SQLCode <> 0 then
// messagebox("","Error al recuperar la imagen")
// return
// End if
//
// FileDelete(is_tempfilename + ls_extension)
//
// ll_aux = FileOpen(is_tempfilename + ls_extension, StreamMode!,
Write!, LockWrite!, Replace!)
//
// if ll_aux < 1 then
// messagebox("","Error al crear archivo temporal")
// return
// End if
//
// if FileWriteEx(ll_aux, lblob_imagen) = -1 then
// messagebox("","Error al escribir el archivo")
// return
// End if
//
// FileClose(ll_aux)
//
// p_preview.PictureName = is_tempfilename + ls_extension // You can sub
this line to fit your needs in you app...
//End Script

A N escribi�:
> I have a table of students
>
> Students
>(
> studentid number(10) not null <pk>,
> studentname varchar2(50) not null,
> ...,
> studentpic blob not null //Stores jpeg/bmp images of students
>)
>
> My requirement is to show all columns including picture in a datawindow so
> that it has picture, studentid, studentname. How do I achieve this?
>

Mayby this will help you


1. use FileOpen() to open your destination file
2. Determine how many times you have to write data. FileWrite can write only
32,766 bytes at a time, which includes the string terminator character.
3. Loop and call FileWrite()
4. Close the file

Happy Coding!

(2).-----------------------------------------------------------

ll_BLen = Len(ablb_Data)

if ll_BLen > 32765 then


if Mod(ll_BLen, 32765) = 0 Then
li_WriteTimes = ll_BLen / 32765
else
li_WriteTimes = (ll_BLen / 32765) + 1
end if
else
li_WriteTimes = 1
end if

You might also like