|
==================================================================== 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:
__._,_.___ ----------------------------------------------- IndoPB - Indonesia PB User Group http://groups.yahoo.com/group/indopb
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___ |
- [indopb] Tanya selectblob eko prayoga
- Re: [indopb] Tanya selectblob Wadi Achmed
- Re: [indopb] Tanya selectblob I Putu Rawijaya
- Re: [indopb] Tanya selectblob I Putu Rawijaya
- Re: [indopb] Tanya selectblob eko prayoga
- Re: [indopb] Tanya selectblob wanoro seto
- Re: [indopb] Tanya selectblob Wadi Achmed
