Re: Storing and retrieving image data in Oracle

From: Norbert Geissler <norbert.geissler_at_mch.sni.de>
Date: 4 Aug 1993 13:34:53 GMT
Message-ID: <1993Aug4.151046_at_mch.sni.de>


In article <1993Aug2.154500.22477_at_template.com>, zurich_at_sae.com (Mark A Zurich) writes:
> Here is an example of how to insert image data into and retrieve image data
> from a long raw data type in ORACLE:
>
 [Parts of program deleted]
>
> /* allocate space on the descriptors for 64K of data */
> bind_des->L[1] = 65536;
> bind_des->V[1] = (char *) malloc( bind_des->L[1] + 1);
> bind_des->I[1] = (short *) malloc( sizeof( short));
>

Is it right, that you want to tell me that your IMAGE-Data is less than 64k ??? Funny.
Have a try with 2MB (or more, if you want (:-) ), please. In the documentation ORACLE tells you that long raw fields can be up to 2GB !!!
So have a try ...

[Much of the program deleted]

Now let's see how you retireve your data:

>
> /* Reset length and datatypes */
> select_des->L[0] = 65535;
>

uups, normally you don't know how long your data are. WHat if somebody else inserted 2MB in your long raw field ? coredump ???

> /* get the necessary space */
> select_des->V[0] = (char *) malloc( select_des->L[0]);
> select_des->I[0] = (short *) malloc( sizeof( short));
> select_des->T[0] = 24;
>
> select_des->L[1] = 50;
> /* get the necessary space */
> select_des->V[1] = (char *) malloc( select_des->L[1]);
> select_des->I[1] = (short *) malloc( sizeof( short));
> select_des->T[1] = 1;
>
> for( i = 0; i < 65536; i++) {
> select_des->V[0][i] = 0;
> }
  

[rest of program deleted]

So what I want to say:

This was a nice program if your "binary" data are always less than 64KB. I think that the intention of "binary large objects" is that they are LARGE, that is greater (much greater) than 64KB. ORACLE manual says that up to 2GB are possible. But they don't tell you how to manage it with ESQL/C.
Think about a database where LargeImages are stored in long raw fields.

How can you get the size of one LargeImage before Retrieving it, so that you can allocate enough space for it ??
What if there's not enough space and you want to get it in smaller junks ?? ANd also what if there's not enough space and you want to put your data in smaller junks into one field of the database ??

WHO CAN ANSWER THAT QUESTION CORRECT FOR ORACLE V7.0 ?? Norbert

-- 
Norbert Geissler, SNI BU BA BP 23, Otto-Hahn-Ring 6, D-81730 Muenchen, Germany
EMAIL: norbert.geissler_at_mch.sni.de     VOICE: +49 (89) 636-48132   
...for chess, that superb, cold, infinitely satisfying anodyne to life, I feel
the ardour of a lover, the humility of a disciple.  (Herbert Russel Wakefield)
Received on Wed Aug 04 1993 - 15:34:53 CEST

Original text of this message