Re: Storing and retrieving image data in Oracle
Date: 5 Aug 93 17:40:27 GMT
Message-ID: <1993Aug5.174027.4257_at_psg.com>
Norbert Geissler (norbert.geissler_at_mch.sni.de) wrote:
: In article <1993Aug2.154500.22477_at_template.com>, zurich_at_sae.com (Mark A Zurich) writes:
: >
: > /* 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 ...
The code posted by Mark was done in part by me, Mario Valente. If you're such a smartass why dont you show us some code ? Some fuckers really get up my nose. What do you do, spend the day looking for people to piss ? You have Oracle 7.0. Did it go through your mind that there's a lot of people out there with 6.0 and this version only has 64K LONG RAWs ? Anyway, if you were smart enough you would conclude that in 7.0 its much the same, you just have to allocate more space...
: 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 ???
if(size>65536) ....
: > /* 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]
: 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.
Not necessarily. JPG files for example are mostly less than 64K. And the size of your files depend on what you're storing ( sound, black & white photos, etc )
: ORACLE manual says that up to 2GB are possible. But they don't tell you
: how to manage it with ESQL/C.
2Gb are possible in version 7.0. In 6.0 there's only 64Kb. And they also didnt tell how to manage it but I figured it out.
: How can you get the size of one LargeImage before Retrieving it, so that
: you can allocate enough space for it ??
Some C function like fgetpos or fseek or fstat will tell you that...
: 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 ??
Well, you seem to be the expert....
C U!
By(e)
Mario Valente Received on Thu Aug 05 1993 - 19:40:27 CEST