Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: C++ or C sample for OCI wanted
Uwe Hildebrandt wrote:
>
> I started programming with C++ with OCI (on Windows NT and VC++ 5.0)
> and I fight with the DATE type. I am not able to store data with the
> obndnr C-function with the DATE type.
>
> Uwe
Well, I dont know anything about VC++ or windows, but heres how I store
DATE type data
in ASNI C
typedef union _oradate{
char oracle[7];
struct _date date;
};
typedef struct _date{
unsigned char century;
unsigned char year;
unsigned char month;
unsigned char day;
unsigned char hour;
unsigned char minute;
unsigned char second;
};
*So if you wanted to store a date of October 24,1997 21:00:00 you would do this:
oradate.date.century = 100+19 // you have to add 100 oradate.date.year = 100+97; // you have to add 100 oradate.date.month = 10; oradate.date.day = 24; oradate.date.hour = 1+21; // you have to add 1 oradate.date.minute = 1+0; // you have to add 1 oradate.date.second=1+0; // you have to add 1
obndrv(&cda,(text *) ":OBSERVE_DATE",(sword) -1,(ub1 *)oradate->oracle,
(sword)7,(sword) SQLT_DAT,(sword) -1,&indp,(text *) NULL, (sword) -1,(sword) -1));
// SQLT_DAT is defined in 'ocidfn.h' as 12
Hope this helps
-Steve Edwards
-SCDNR
Received on Fri Oct 24 1997 - 00:00:00 CDT