[freetds] Support of SQL_WVARCHAR/nvarchar

marko68 GMX marko68 at gmx.net
Wed Oct 8 22:26:35 EDT 2008


Hello,

I apologize if the question I am going to ask has been already
answered, but that's still unclear to me - I mean the use of
SQL_WVARCHAR type for MS SQL server.

>From the post of Eric Bressler, the subject: "Support for SQL_WVARCHAR"
http://archives.devshed.com/forums/development-94/support-for-sql-wvarchar-1847827.html

I could see that "support of SQL_WVARCHAR is not implemented and not
scheduled."

But on the other hand when I call GetSQLTypeInfo(), requesting info
about SQL_WVARCHAR, I receive it - the data source supports nvarchar
(4000 chars max). After that, I call SQLBindParameter() but it
immediately fails, with the following error message: "[FreeTDS][SQL
Server]Invalid data type (just like in the post, quoted above)":

                EXIT  SQLBindParameter with return code -1 (SQL_ERROR)
                SQLHSTMT          0x209b50
                SQLSMALLINT       1
                SQLSMALLINT       1 (SQL_PARAM_INPUT)
                SQLSMALLINT       -8 (SQL_C_WCHAR)
                SQLSMALLINT       -9 (SQL_WVARCHAR)
                SQLUINTEGER       4000
                SQLSMALLINT       0
                SQLPOINTER        0x4a7000
                SQLLEN            8256
                SQLLEN          * 0x20a280

In my view, it is a bit strange that GetSQLTypeInfo() indicates that
SQL_WVARCHAR is supported and the corresponding MS SQL UNICODE data
type is "nvarchar", because any next attempt to use it immediately
fails. Would not it make more sense for GetSQLTypeInfo() to fail when
the info for SQL_WVARCHAR is requested - by doing that it would let
the application know that this data type should not be used as it is
not supported? Otherwise, how the application can figure out that
SQL_WVARCHAR (for example) is not supported by this particular driver?
>From what I saw, working with other ODBC drivers, the call of
GetSQLTypeInfo() was the very way to determine that. May be I am
missing something here?

-- 
Thanks,
 Marko



More information about the FreeTDS mailing list