Bug #2707 MyODBC not ready for MySQL 4.X
Submitted: 11 Feb 2004 10:41 Modified: 14 Feb 2004 11:54
Reporter: Dmitrii Tisnek Email Updates:
Status: Not a Bug Impact on me:
Category:Connector / ODBC Severity:S1 (Critical)
Version:3.51.06 OS:Linux (linux)
Assigned to: CPU Architecture:Any

[11 Feb 2004 10:41] Dmitrii Tisnek
MyODBC compiles (with warnings) and will probably die or report wrong results when it is used compiled against MySQL 4.X

1) mysql type MYSQL_FIELD (declared in mysql/mysql.h) changed from 3.x to 4.x and MyODBC does not reflect that. There are arrays of this type in driver/catalog.c and driver/info.c and they are intialized as if they were 3.x irrespective of MySQL version.

I think the problem will only become visible when advanced functionality (like enumerating supported types or foreign keys) is used through odbc.

2) MyODBC configure script blissfully uses system mysql libraries and/or header files if the directories specified with --with-mysql-libs and/or --with-mysql-includes don't contain usable libs/headers.

How to repeat:
1) compile against mysql 4.x (in my case 4.0.17), make sure it gets compiled against that very version (see point 2). you should see numerous warnings like
../driver/catalog.c:1022: warning: initialization makes pointer from integer without a cast

2) install some version of mysql in system directory (so that you have /usr/include/mysql/mysql.h and /usr/lib/mysql/libmysql.so), then run configure --with-mysql-libs=/XXXX/this/dir/doesnt/exist --with-mysql-includes=/XXXX/this/one/either

you'll see something like

checking if building of thread safe library is enabled... no
checking for mysql_real_query in -lmysqlclient... yes
checking for mysql include files in /XXXX... yes

Suggested fix:
in case of 1), there should be a conditional set by configure script and used in respective C files, and there should be diff. copies of initializations for mentioned arrays depending on mysql version. Alternatively you could use gcc-style named initializers.

in case of 2), configure script should give an error
[14 Feb 2004 11:54] MySQL Verification Team
ODBC 3.52 is dedicated to MySQL 4.1.1 version