vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I've found a glaring problem with the latest ODBC connector. Data types have been changed and data is no longer being read correctly. I'm running MySQL 5.1.16 on Netware. My apps are VB6 and VBA using ADO. The following query produces different data types depending on the version of the ODBC driver. SELECT ConCat(21000,'-','a') In 3.51.19 it is a VarChar and in 3.51.22 it's a VarBinary. Concat is supposed to return a string. In C a byte array may be fine but in VB a string should be a VarChar. Is this a bug or is there a server or OBDC setting that can be changed to make sure that it always returns a VarChar Thanks for the help |
| ||||
| On Wed, Dec 12, 2007 at 05:11:43PM -0800, Ed Reed wrote: > I've found a glaring problem with the latest ODBC connector. Data > types have been changed and data is no longer being read correctly. That's not quite correct -- data types are now actually being read correctly. They were wrong before, even if it was what you expected. > I'm running MySQL 5.1.16 on Netware. My apps are VB6 and VBA using > ADO. The following query produces different data types depending on > the version of the ODBC driver. > > SELECT ConCat(21000,'-','a') > > In 3.51.19 it is a VarChar and in 3.51.22 it's a VarBinary. Concat is > supposed to return a string. In C a byte array may be fine but in VB a > string should be a VarChar. > > Is this a bug or is there a server or OBDC setting that can be changed > to make sure that it always returns a VarChar CONCAT() derives its return types from its arguments. The key part from the CONCAT() documentation is: If all arguments are non-binary strings, the result is a non-binary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that, you can use an explicit type cast, as in this example: SELECT CONCAT(CAST(int_col AS CHAR), char_col); That earlier releases of the driver would return a non-binary string in your case was a bug. That a numeric argument is converted to a binary string is an unfortunate server "feature". I hope it will get fixed in a future server release, but I'm not sure when that will be, and it will almost certainly not be in the 5.1 series. Jim |
| Thread Tools | |
| Display Modes | |
|
|