3

我尝试使用 MySQL ODBC 驱动程序,但编译时出现错误。MySQL ODBC 驱动程序适用于 Mariadb 5.5,但不适用于 Mariadb 10。那么 Mariadb 10 是否有 ODBC 驱动程序?

我安装了 MySQL Connector ODBC Driver 源代码版本。

以下是错误信息:

* MySQL Connector ODBC Driver 5.3.4    
    Scanning dependencies of target myodbc5a
    [  6%] Building C object driver/CMakeFiles/myodbc5a.dir/catalog.c.o
    [  7%] Building C object driver/CMakeFiles/myodbc5a.dir/catalog_no_i_s.c.o
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c:1096:69: error: macro "my_init_dynamic_array" requires 5 arguments, but only 4 given
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c: In function 'foreign_keys_no_i_s':
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c:1096: error: 'my_init_dynamic_array' undeclared (first use in this function)
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c:1096: error: (Each undeclared identifier is reported only once
    /myodbc/mysql-connector-odbc-5.3.4-src/driver/catalog_no_i_s.c:1096: error: for each function it appears in.)
    make[2]: *** [driver/CMakeFiles/myodbc5a.dir/catalog_no_i_s.c.o] 오류 1
    make[1]: *** [driver/CMakeFiles/myodbc5a.dir/all] 오류 2
    make: *** [all] 오류 2

* MySQL Conncector ODBC Driver 5.2.7
    [  5%] Built target myodbc-util
    Scanning dependencies of target myodbc5a
    [  6%] Building C object driver/CMakeFiles/myodbc5a.dir/catalog.c.o
    [  8%] Building C object driver/CMakeFiles/myodbc5a.dir/catalog_no_i_s.c.o
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c:1096:69: error: macro "my_init_dynamic_array" requires 5 arguments, but only 4 given
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c: In function 'foreign_keys_no_i_s':
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c:1096: error: 'my_init_dynamic_array' undeclared (first use in this function)
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c:1096: error: (Each undeclared identifier is reported only once
    /myodbc/mysql-connector-odbc-5.2.7-src/driver/catalog_no_i_s.c:1096: error: for each function it appears in.)
    make[2]: *** [driver/CMakeFiles/myodbc5a.dir/catalog_no_i_s.c.o] 오류 1
    make[1]: *** [driver/CMakeFiles/myodbc5a.dir/all] 오류 2
    make: *** [all] 오류 2

* MySQL Conncector ODBC Driver 5.1.13
    [  9%] Building C object driver/CMakeFiles/myodbc5.dir/ansi.c.o
    [ 11%] Building C object driver/CMakeFiles/myodbc5.dir/catalog.c.o
    [ 12%] Building C object driver/CMakeFiles/myodbc5.dir/catalog_no_i_s.c.o
    [ 14%] Building C object driver/CMakeFiles/myodbc5.dir/connect.c.o
    [ 16%] Building C object driver/CMakeFiles/myodbc5.dir/cursor.c.o
    [ 18%] Building C object driver/CMakeFiles/myodbc5.dir/desc.c.o
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:66:66: error: macro "my_init_dynamic_array" requires 5 arguments, but only 4 given
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c: In function 'desc_alloc':
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:66: error: 'my_init_dynamic_array' undeclared (first use in this function)
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:66: error: (Each undeclared identifier is reported only once
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:66: error: for each function it appears in.)
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c: In function 'MySQLSetDescField':
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:778: warning: cast from pointer to integer of different size
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:786: warning: cast from pointer to integer of different size
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:895:57: error: macro "my_init_dynamic_array" requires 5 arguments, but only 4 given
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c: In function 'MySQLCopyDesc':
    /myodbc/mysql-connector-odbc-5.1.13-src/driver/desc.c:893: error: 'my_init_dynamic_array' undeclared (first use in this function)
    make[2]: *** [driver/CMakeFiles/myodbc5.dir/desc.c.o] 오류 1
    make[1]: *** [driver/CMakeFiles/myodbc5.dir/all] 오류 2
    make: *** [all] 오류 2
4

1 回答 1

0

Gentoo 似乎有一个补丁:

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-db/myodbc/files/5.2.7-mariadb-dynamic-array.patch?view=markup

该问题是通过添加每个线程的内存使用统计信息 ( https://mariadb.atlassian.net/browse/MDEV-4011my_init_dynamic_array() ) 引入的,这需要向宏添加额外的参数。此宏未定义为公共客户端 API 的一部分,但my_sys.h仍然在头文件中公开并由 MySQL ODBC 使用,因此此更改在针对最近的 MariaDB 版本编译时破坏了 ODBC 代码。

替代方案是应用上述补丁,或切换到 MariaDB ODBC 驱动程序(尽管仍处于测试阶段):

https://mariadb.com/kb/en/mariadb/client-libraries/mariadb-odbc-driver/

于 2014-11-26T11:11:48.600 回答