Hi,

when using the Firebird ODBC driver with unixODBC, the Wide-Functions
like SQLExecDirectW fails.

UnixODBC defines SQLWCHAR as a 2-Byte value. I've transformed my
wchar_t* strings to UCS2 and call SQLExecDirectW() with them.

Here is the trace (debug version):

----
SQLExecDirectW
Preparing statement:
        INSERT INTO FOO VALUES(NU
Preparing statement:
        INSERT INTO FOO VALUES(NU

HY000:1:-104:[ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Unexpected end of command - line 1, column 24
----

It seems that something in the ODBC driver truncates the
statement to the half. A short look into the code shows this function
inside the ConvertingString template (MainUnicode.cpp):


        SQLCHAR * convUnicodeToString( SQLWCHAR *wcString, int length )
        {
                size_t bytesNeeded;
                wchar_t *ptEndWC = NULL;
                wchar_t saveWC;

                if ( length == SQL_NTS )
                        length = (int)wcslen( (const wchar_t*)wcString );
        ...


I think the problem is that wcslen() expects a whar_t (4 bytes) sequence,
while SQLWCHAR is 2 bytes long.


Because I'm unsure if my code is correct, I've tested the same with
python3 and pyodbc (which uses the wide-functions, too).
This results in the same issue, so using the firebird odbc driver
with pyodbc/python3 is impossible for the moment.


Could anyone confirm this issue?


-- 
     Daniel Vogelbacher
     www.chaospixel.com
     cytrinox@freenode/ircnet/quakenet

Attachment: pgp4uMffoxvSz.pgp
Description: PGP signature

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Firebird-odbc-devel mailing list
Firebird-odbc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-odbc-devel

Reply via email to