Skip to Content.
Sympa Menu

freetds - how to tell nchar from char

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Mark J. Lilback" <mark AT lilback.com>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: how to tell nchar from char
  • Date: Tue, 26 Jun 2001 18:57:57 -0500


I'm using TDS 4.2 and dblib, and am running into a problem with matching column types.

To start, once my application opens a database connection, it does a query to get a list of supported data types, which I store in an object for each type. When a user executes a query, I then need to figure out the corresponding data type object for each column in the result set. This is where it is getting tricky.

I was using the systype.type (SYS_TYPE) value, which is what dbcoltype() returns. However, this returns 47 for both char and nchar columns.

I have plenty of other values to work with in my data type objects (the odbc data type code, the sql data type code, and the user type code (all of which are different between char and nchar). However, I can't figure out how to get any of these values from a result set.

TDSCOLINFO->column_type has a value of 39 for a char field, which dbcoltype() is conditionalized to return 47 for. But I don't see anyway to get the 39 value from any of the master tables for the char datatype.

Any ideas on what I can do? I'm thinking I'll need to default down to never matching unicode text objects to result set columns, but I'd prefer a better solution.

Thanks.

--

__________________________________________________________________________
"The best assumption to have
Mark J. Lilback is that any commonly held
<mark AT lilback.com> belief is wrong." -- Ken Olsen,
http://www.lilback.com/ founder, Digital Equip. Corp.




Archive powered by MHonArc 2.6.24.

Top of Page