Skip to Content.
Sympa Menu

freetds - [freetds] dbcoltype() , char and nchar

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: LacaK <lacak AT zoznam.sk>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] dbcoltype() , char and nchar
  • Date: Tue, 24 Aug 2010 08:30:37 +0200

Hi,
there is in db-lib function dbcoltype, which returns result column datatype.
on CHAR column it returns SQLCHAR (SYBCHAR)
on VARCHAR it returns also SQLCHAR
on NCHAR, NVARCHAR it returns also SQLCHAR ... but here I need distinguish between CHAR and NCHAR (NATIONAL CHAR - UNICODE CHAR)
Is there any way how to get this more detailed column info (in example below is it wtype/wsize, column "nchar_field" is defined as nchar(10))?
If not, is there way how to extend (dbcolinfo?) and/or add some function or parameter which will solve this problem ?
(I am writing SQLConnector component for FreePascal project, which is going to use FreeTDS db-lib and I need this info to correctly create Fields in client DataSet)

freetds.log:
IF CLIENT CHARSET IS "ISO-8859-1":
...
token.c:1542:tds7_get_data_info:
colname = nchar_field (11 bytes)
type = 47 (char)
server's type = 239 (x UCS-2 char)
column_varint_size = 2
column_size = 10 (20 on server)
token.c:1612: name size/wsize type/wtype utype token.c:1613: -------------------- --------------- --------------- -------
token.c:1623: nchar_field 10/20 47/239 0
...
IF CLIENT CHARSET IS "UTF-8":
...
token.c:1542:tds7_get_data_info:
colname = nchar_field (11 bytes)
type = 47 (char)
server's type = 239 (x UCS-2 char)
column_varint_size = 2
column_size = 40 (20 on server)
token.c:1612: name size/wsize type/wtype utype token.c:1613: -------------------- --------------- --------------- -------
token.c:1623: nchar_field 40/20 47/239 0
...

Please let me know
Thanks
-Laco.



  • [freetds] dbcoltype() , char and nchar, LacaK, 08/24/2010

Archive powered by MHonArc 2.6.24.

Top of Page