Re: mySQL and SQLDriverConnect
Igor Korot <[email protected]>
| Newsgroups | gmane.comp.db.unixodbc.devel |
|---|---|
| Message-ID | <19964447.1213977061242.JavaMail.root@mswamui-swiss.atl.sa.earthlink.net> |
Nick, -----Original Message----- >From: Nick Gorham <[email protected]> >Sent: Jun 20, 2008 8:36 AM >To: Igor Korot <[email protected]> >Cc: Development issues and topics for unixODBC <[email protected]> >Subject: Re: [unixODBC-dev] mySQL and SQLDriverConnect > >Igor Korot wrote: > >>>> >>>> >>>By the way, when you say you explicitly call the non unicode function, >>>do you mean you call SQLDriverConnectA, becaue with UNICODE defined >>>SQLDriverConnect becomes SQLDreiverConnectW (as it does in windows) >>> >>> >> >>retcode = SQLDriverConnect( m_hdbc, parentWnd, (SQLTCHAR FAR *)"DSN=test;", ...); >> ^^^^^^^^^^^^^^ >> >>I am doing casting of the parameters. >>In UNICODE version, this would become (SQLWCHAR FAR *). >> >>So, unless the linker is not smart, he should look at the proper signature of the >>function. >> >> >> >Not entirly correct > >(SQLTCHAR FAR *)"DSN=test;" > >when UNICODE is defined, will create a SQLWCHAR * pointer, but the thing it points to will still be a char string; > >I think thats the problem, you are passing the address 8bit string into a function thats expecting a 16bit sequence of values. Casting the pointer to a pointer of another type will not alter the thing thats being pointed to. > >Remember C will do what you tell it to, even if thats not what you want it to do :-) Ok, it is very easy to check. ;-) It is morning here and I'm at work. When I come home, I will enable ODBC logging and run my program. Hopefully you are right, I was just banging my head over nothing and simply passing: "DSN=test;" without casting should fix the issue. Thank you. P.S.: Sometimes it's good to do RTFM ;-) > >-- >Nick > > _______________________________________________ unixODBC-dev mailing list [email protected] http://mail.easysoft.com/mailman/listinfo/unixodbc-dev