Fetching DATETIMES into sqlda
Posted in 1992
A basic question:
If you have a table with a column named "timestamp" of type DATETIME YEAR TO HOUR
and you select it with the following ala unload.ec in the distribution demo...
$ prepare usqlobj from "select timestamp from spoo"
$ describe usqlobj into udesc;
/* Go through udesc->sqlvar , sqlvar + 1 ... and set SQLDTIME to CDTIMETYPE
(is this valid? It works for basic types like float...) */
/* Build a buffer to put the result of the fetch into */
$ declare usqlcurs cursor for usqlobj;
$ open usqlcurs;
$ fetch usqlcurs using descriptor udesc;
while (sqlca.sqlcode!=0)
{ /* Decode each field : Im going to put some particulars here */
for (col=udesc->sqlvar,i=0; i<udesc->sqld; col++,i++)
{
switch (col->sqltype)
{
case CDTIMETYPE:
/* RIGHT HERE:: What do I do with col->sqldata ? */
/* The following bombs :
dttoasc((dtime_t *)col->sqldata,asctime);
What do I need to do to col->sqldata to get my grubby
fingers on the datetime value?
RjS
rjsparks@loanstar.tamu.edu