Skip to Content.
Sympa Menu

freetds - Re: column Type return ?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: column Type return ?
  • Date: Fri, 27 Jul 2001 14:44:58 -0400 (EDT)


The unittests only deals with a small selection of datatypes. you can
look up the types by number in tds.h, and the code to handle them is in
src/tds/convert.c

I would personally not recommend going down this path...All that appears
to be necessary in your case is adding -ltds to the LIBS line of the
Makefile, to get dblib/ctlib working...I'm trying to see if I can dig up a
solaris/86 box to sort out why the libtds objects are not being included
in libsybdb.a and libct.a

Brian


On Fri, 27 Jul 2001, Joe wrote:

> Does anyone know what type is in
>
> Unexpected column_type 37
> Unexpected column_type 38
> Unexpected column_type 52
> Unexpected column_type 61
>
> I aready have STBVARCHAR and SYBINT4 just like in Unittests
> below is the example
> does anyone have the Case made up for the rest?
>
>
> char *value_as_string(
> TDSSOCKET *tds,
> int col_idx)
> {
> 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);
>
> switch(type) {
> case SYBVARCHAR:
> strncpy(result, (char *)value, sizeof(result)-1);
> result[sizeof(result)-1] = '\0';
> break;
> case SYBINT4:
> sprintf(result, "%d", *(int *)value);
> break;
> default:
> sprintf(result, "Unexpected column_type %d", type);
> break;
> }
> return result;
> }
>
>
>







Archive powered by MHonArc 2.6.24.

Top of Page