Delphi6/7连接MySQL5.0.X/5.1.X

来源:互联网 发布:c语言布尔类型怎么输出 编辑:程序博客网 时间:2024/05/29 03:52

DBExpress drivers for MySQL 5.0

可于 http://www.justsoftwaresolutions.co.uk/delphi/dbexpress_and_mysql_5.html 下载 源码 和 DLL文件。

 

 

Features

  • Works with Delphi 6, Delphi 7, and Borland Developer Studio 2006.
  • Works with MySQL V5.0.
  • Available(可用的) as a DLL, or as source code for static linking.
  • Supports all MySQL Data types.
  • Supports transactions(Transaction Processing:事务处理) for MySQL tables with appropriate storage engines (i.e. InnoDB or BDB).
  • Support for alternate(候补、替代者) character sets using the ServerCharSet(服务器字符集) connection parameter (even on BDS2006, despite the bug in the BDS2006 runtime).
  • Large BLOB support.
  • Supports TSQLTable.
  • Supports design-time table access(访问) within the IDE.
  • Works when DecimalSeparator(小数点分隔符、十进制分隔符) is set to something other than '.', as is common in non-English locales.

Installation instructions

For full instructions see the install.txt file in each .zip.

Copy the DLL somewhere on your path. You will also need an appropriate (V5.0) libmysql.dll on the path.

If you're setting your dbexpress stuff up in the IDE, append the contents of the .ini files to the existing ones of the same name in your Delphi installation.

If you're setting up the dbexpress stuff programmatically, then you need something like:

Acknowledgements

Thanks to challge for developing the original OpenDbx driver for MySQL 4.1, on which this is based.

Thanks also to Bob Marietta, who has helped me iron out problems by providing simple, repeatable test cases that demonstrated the bugs he found.

 

上面一段中可以看到这个程序时基于“OpenDbx driver for MySQL 4.1”的。

 

**********************************************************************************************

 

上面都是 for MySQL5.0 的。

 

当将上面的DLL用于MySQL5.1时,会有错误(sometimes)。

 

比较了 MySQL5.0、MySQL5.1中的include文件夹中的文件 和 PlainMysql50.pas 中的内容,发现5.1中的某些结构体比5.0中多了一些内容,对照 PlainMysql50.pas 将需要加内容的结构体加入相关内容。(记得在mysql.h和mysql_com.h中某些结构体中多了“void *extension;”,则在PlainMysql50.pas中相应添加“extension:pointer;”。可能还有其他地方要改,记不得了)

这样编译出来的新DLL用于MySQL5.1,经测试,基本的select、insert、delete都没错误。(D6、D7都行)

 

环境:XP home + professional ,Delphi6 + 7,mysql-5.0.88-win32.zip + mysql-5.1.41-win32.msi

原创粉丝点击