Need help coercing datatypes
Date: Thu, 2 Sep 1993 14:48:58 GMT
Message-ID: <1993Sep2.144858.27489_at_template.com>
I am looking for a way to get the actual datatype out of ORACLE without coercing it to a CHAR using the Pro C* interface. Does anyone have any good ideas?
I am going to provide more info. I have asked this question in the past and I never seem to get the answer that I am looking for. The question must be confusing. Here is a sample subroutine that demonstrates the problem.
/*----------------------------------------------------------------------------*/ /* INTERNAL DATA ============================================================ */#define RowIdLengthCN 18
#define OracleLenCN 50
#define DateLengthCN 11 /* Date picture is 'DD-MON-YYYY' */
#define PrecisionCN 40
#define LineLengthCN 132
#define RawLengthCN 240
#define LongLengthCN 2000
/* Based on the returned type, alloc room for the value from the
data base and coerce the type of the value to be a char *. */
static void
GetOracleSpace( sel)
SQLDA * sel;
{
int i = 0;
int prec = 0;
int scale = 0;
for( i = 0; i < sel->F; ++i) {
/* Mask out high bit if set. The high bit is set if field can be NULL */
if( sel->T[i] < 0) {
sel->T[i] = (sel->T[i] ^ 0x8000);
}
switch( (int) sel->T[i]) {
case 1:
break;
case 2:
sqlprc( &sel->L[i], &prec, &scale);
if( prec == 0)
prec = PrecisionCN;
sel->L[i] = prec + 2;
break;
case 8:
sel->L[i] = LongLengthCN;
break;
case 11:
sel->L[i] = RowIdLengthCN;
break;
case 12:
sel->L[i] = DateLengthCN;
break;
case 23:
break;
case 24:
sel->L[i] = RawLengthCN;
break;
default:
break;
}
sel->V[i] = (char *) malloc( sel->L[i]);
sel->I[i] = (short *) malloc( sizeof( short));
sel->T[i] = 1;
}
}
/*----------------------------------------------------------------------------*/
It is the line sel->T[i] = 1; that I am interested in. I do not want to have to coerce this to a CHAR which is the '1'. I want to get/set the real datatype. Is there a way around this in ORACLE. Please respond to the e-mail address provided below. Thanks in advance.
/*----------------------------------------------------------------------------*/
________
Mark A. Zurich \ / Template Software
zurich_at_template.com \ / 13100 Worldgate Drive, Suite 340
uunet!template!zurich \ / Herndon, VA 22070-4382
voice: 703-318-1000 \/ fax:703-318-7378
Received on Thu Sep 02 1993 - 16:48:58 CEST
