[freetds] Support of SQL_WVARCHAR/nvarchar
James K. Lowden
jklowden at freetds.org
Mon Oct 13 10:49:45 EDT 2008
marko68 GMX wrote:
> I am not an ODBC expert and I can speak from my experience only. May be
> other members of this community know a better way to handle this case.
Undoubtedly. I'm not an expert, either. I just read the documentation
and try to follow along as best I can.
> The MSDN mentions 4 possible return codes for GetSQLTypeInfo(). As I
> see it: the successful call of GetSQLTypeInfo() simply means that the
> function did not fail and the caller may expect to get some data back.
> In my particular case the call of GetSQLTypeInfo() only makes sense
> when it is called in pair with SQLFetch(). Therefore, every time when
> I want to get a list of data types, supported by a particular data
> source, I call that pair of the functions and check the return code of
> SQLFetch(). I am interested to see if the "successful" return code is
> different from SQL_NO_DATA, because SQL_NO_DATA (in my view) means -
> your check did not succeed, the data type you requested is not
> supported, substitution of data types should be used. But this is not
> an error and execution should not be stopped here, substituted data
> types will be used instead of non-existed ones.
The Summary says:
"SQLGetTypeInfo returns information about data types supported by the
data source. The driver returns the information in the form of an SQL
result set. The data types are intended for use in Data Definition
Language (DDL) statements."
IOW, it provides information about the *server*. That's why you get
different answers about different servers. You should get the same answer
about a given server from different drivers. That is, FreeTDS's ODBC
driver should yield the same results as Microsoft's, because the describe
the same server. SQLGetTypeInfo
I'm not saying there's no problem here. Wide character support is a bit
broken, particularly when it comes to parameterized queries. I just don't
see anything wrong with SQLGetTypeInfo.
More information about the FreeTDS