Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8581

Re: Using Tableblob

$
0
0

Yes, 12.5 Classic.DBMS is SQL Server 2012 and column type is image. This is a very old app so I suspect some of this blob code could be overhauled (but it works!).

 

lblob_pic = f_blobcreate(p_photo.picturename)

 

SQLCA.AutoCommit   =   True

UPDATEBLOB member_fdi_photo SET photo = :lblob_pic WHERE member_fdi_record_id = :ll_recordid;

SQLCA.AutoCommit   =   False

 

 

f_blobcreate:

 

Long   l_file_len, l_bytes_read , l_new_pos , l_key

int    i_file_open , i_loops , i_cnt

blob   b_invoice, b_temp

 

l_file_len  = FileLength(as_filename)

i_file_open = FileOpen(as_filename, StreamMode!, Read!, LockRead!)

 

IF i_file_open < 1 THEN

   Return b_temp

END IF     // file open

 

IF l_file_len > 32765 THEN

   IF Mod(l_file_len,32765) = 0 THEN

        i_loops = l_file_len / 32765

   ELSE

      i_loops = (l_file_len / 32765) + 1

   END IF

ELSE

    i_loops = 1

END IF

 

/* if file len is more then 32765 bytes loop thru it */

l_new_pos = 1

 

FOR i_cnt = 1 TO i_loops

    l_bytes_read = FileRead(i_file_open, b_temp)

    b_invoice = b_invoice + b_temp

    l_new_pos += l_bytes_read

    Fileseek(i_file_open,l_new_pos,FromBeginning!)                   

NEXT

 

FileClose(i_file_open)

 

Return b_invoice


Viewing all articles
Browse latest Browse all 8581

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>