Quick Question

Ian Charnas icc at po.cwru.edu
Sat Jan 29 10:21:50 EST 2000


Have you tried casting it to a string and running it through printf? 
Something like...

if the data is characters,

/* Begin */
/* This might work if the data is characters. */
static char  result[256];
const int    type   = tds->res_info->columns[col_idx]->column_type;
const char  *row    = tds->res_info->current_row;
const int    offset = tds->res_info->columns[col_idx]->column_offset;
const void  *value = (row+offset);
strncpy(result, (char *)value, sizeof(result)-1);
result[sizeof(result)-1] = '\0';
printf("%s\n", result);
/* End */

Or, if the data is integer, as I suspect, then

/* Begin */
/* This might work if the data is characters. */
static char  result[256];
const int    type   = tds->res_info->columns[col_idx]->column_type;
const char  *row    = tds->res_info->current_row;
const int    offset = tds->res_info->columns[col_idx]->column_offset;
const void  *value = (row+offset);
sprintf(result, "%d", *(int *)value);
printf("%s\n", result);
/* End */


Hope this helps! 

Ian Charnas.

On 01/27/00, ""Lefebvre, Michael" <mlefebvre at websense.com>" wrote:
> How do I interpret a datatype of SYBDATETIMN
> returned by sqlserver?
> 
> Thanks
> Mike Lefebvre
> mlefebvr at websense.com
> 
> 
> 
> -----Original Message-----
> From: James Cameron [mailto:james.cameron at compaq.com]
> Sent: Wednesday, January 26, 2000 2:50 PM
> To: TDS Development Group
> Subject: [freetds] Re: Minor issues...
> 
> 
> Brian Bruns wrote:
> > There is a change that has to be made to run on alpha (by the way, from
> > my recollection alpha does not bus error on unaligned access but it is
> > simply slower than aligned access) [...]
> 
> Since my company produced the Alpha I can tell you what actually happens
> ... the unaligned access is trapped, causes execution of trap code that
> will look at the instruction that failed, create a set of instructions
> on the fly that will do the same thing, and use them instead.  ;-)
> 
> Using the uac command, the user can change this to a fatal exception. 
> This is usually done in coverage testing to find things that deserve
> being realigned for speed reasons.
> 
> -- 
> James Cameron                                      (cameron at stl.dec.com)
> 
> Not the Director of Titanic, but he had his name before I did.
> 
> ---
> You are currently subscribed to freetds as: mlefebvre at websense.com
> To unsubscribe, forward this message to
> $subst('Email.Unsub')



More information about the FreeTDS mailing list