Re: Dynamic Sql Method 4

From: Brett England <bmenglan_at_seldon.apanix.apana.org.au>
Date: 3 Aug 1994 01:58:10 GMT
Message-ID: <31mtji$hi3_at_cleese.apana.org.au>


Oracle SQLCA struct.

Data when put into char *V is formatted differently depending whether you are returning numbers of characters ie:

data       cp                       data      cp
 v         v	                     V         v
+-+-+-+-+-+-+-+-+-+-+     +-+-+-+-+-+-+-+-+-+-+--
|H|E|L|L|O| | | | | |	  | | | | | |3|4|5|6|7|
+-+-+-+-+-+-+-+-+-+-+     +-+-+-+-+-+-+-+-+-+-+--

If you keep two pointers that move along the data structure you can easily extract the data the you require:

            data = sdp->V[i]; /* Data we are manipulating */

/* Trim trailing spaces

               Character datatypes are left justified in an string
               of sdp->L[i] characters.
               */
            cp = data+sdp->L[i]-1;            /* End of column data */
            while (cp > data && *cp == ' ')
              cp--;
            

/* Loop exit condition is when we don't find a space,
we want this last data character. */ cp++;
/* Trim leading spaces,
Numbers appear as right justified data */ while(data < cp && *data == ' ' ) data++; fwrite(data, cp-data, 1, fd);

I hope this helps.
Cheers Brett.

--
     ._, .      Brett England - Senior Technical Analyst Programmer
   _,' {_]\     email:  bmenglan_at_apanix.apana.org.au
 ,'        \    * - Adelaide (Australian Submarine Corporation)
 \   __*   /    "Just remember, wherever you go there you are"
  "-'  ^--'     Buckaroo Banzai - across the fifth dimension.
Received on Wed Aug 03 1994 - 03:58:10 CEST

Original text of this message