Thx all, tp saya ada masalah saat querinya. Berikut syntaxnya :
SELECTBLOB image_data
INTO :lblb_data
FROM tbl_image
USING sqlca;
Messagebox("image len", len(lblb_data) )
Nah, length dari imagenya 32.765. Padahal di databasenya file length
nya 14.445.568. Sbg informasi sy pake PB 9.0 untuk database sy
menggunakan MicrosoftSQL 2005.
On 12/15/08, I Putu Rawijaya <[email protected]> wrote:
> ====================================================================
> Function untuk write
> ====================================================================
> function of_filewrite (string as_filename, blob ablb_data) return integer
>
> integer li_FileNo, li_Writes, li_Cnt
> long ll_BlobLen, ll_CurrentPos
> blob lblb_Data
>
> li_FileNo = FileOpen(as_FileName, StreamMode!, Write!, LockReadWrite!,
> Replace! )
> If li_FileNo < 0 Then Return -1
>
> ll_BlobLen = Len(ablb_Data)
>
> // Determine the number of writes required to write the entire blob
> If ll_BlobLen > 32765 Then
> If Mod(ll_BlobLen, 32765) = 0 Then
> li_Writes = ll_BlobLen / 32765
> Else
> li_Writes = (ll_BlobLen / 32765) + 1
> End if
> Else
> li_Writes = 1
> End if
>
> ll_CurrentPos = 1
>
> For li_Cnt = 1 To li_Writes
> lblb_Data = BlobMid(ablb_Data, ll_CurrentPos, 32765)
> ll_CurrentPos += 32765
> If FileWrite(li_FileNo, lblb_Data) = -1 Then
> Return -1
> End if
> Next
>
> FileClose(li_FileNo)
>
> Return 1
>
> ====================================================================
> Function untuk read
> ====================================================================
>
>
> function of_fileread (string as_filename, ref blob ablb_data) return integer
>
> integer li_FileNo, li_Reads, li_Cnt
> long ll_FileLen
> blob lblb_Data
>
> ll_FileLen = FileLength(as_FileName)
>
> li_FileNo = FileOpen(as_FileName, StreamMode!, Read!)
> If li_FileNo < 0 Then Return -1
>
> // Determine the number of reads required to read the entire file
> If ll_FileLen > 32765 Then
> If Mod(ll_FileLen, 32765) = 0 Then
> li_Reads = ll_FileLen / 32765
> Else
> li_Reads = (ll_FileLen / 32765) + 1
> End if
> Else
> li_Reads = 1
> End if
>
> // Empty the blob argument
> ablb_Data = lblb_Data
>
> // Read the file and build the blob with data from the file
> For li_Cnt = 1 to li_Reads
> If FileRead(li_FileNo, lblb_Data) = -1 Then
> Return -1
> Else
> ablb_Data = ablb_Data + lblb_Data
> End if
> Next
>
> FileClose(li_FileNo)
>
> Return ll_FileLen
>
> ====================================================================
> Cara Menampilkan
> ====================================================================
> blob imagedata
> string ls_filename
>
>
> //The DataWindow determines the image type based on the
> //filename extension
> ls_filename = 'imagedata.jpg'
>
> SELECTBLOB IMAGEDATA
> INTO :imagedata
> FROM IMAGE_DEMO
> using sqlca;
>
> of_filewrite ( ls_filename, imagedata )
>
> dw_1.object.p_1.FileName = ls_filename
>
> SELAMAT MENCOBA
>
> Putu
>
> Wadi Achmed wrote:
>>
>> Tampungnya ke variable blob juga mas.
>> Misal:
>> Select blobcolumn
>> into :lbl_blobvariable
>> from tabel_blob
>> using transaction;
>>
>> selanjutnya si lbl_blobvariable yang dimainkan. Dengan loop sampai puas.
>>
>> Cheers,
>> Wadi
>>
>> eko prayoga wrote:
>> > Dear all,
>> > langsung aja mau tanya. Gmn cara selectblob yg size nya lebih dr 32765
>> > bytes.
>> >
>> > Regards,
>> > eko prayoga.
>> >
>> > ------------------------------------
>> >
>> > -----------------------------------------------
>> > IndoPB - Indonesia PB User Group
>> > http://groups.yahoo.com/group/indopbYahoo! Groups Links
>> >
>> >
>> >
>> >
>> >
>>
>> ________________________________
>>
>> No virus found in this incoming message.
>> Checked by AVG - http://www.avg.com
>> Version: 8.0.176 / Virus Database: 270.9.18/1848 - Release Date:
>> 12/14/2008 12:28 PM
>>
>>
>
>
>
------------------------------------
-----------------------------------------------
IndoPB - Indonesia PB User Group
http://groups.yahoo.com/group/indopbYahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indopb/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/indopb/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/