mysql.pas (Version 2015-10-13)

Client API for MySQL AB's SQL Database Server using LibMySql.dll or LibMySqld.dll (Embeeded MYSQL Server). It is a Pascal translation of mysql.h and some other C header files needed for writing clients for the MySQL database server.

The unit is tested with:
Delphi Versions: (3), (4), 5, 6, 2007, 2009, 2010, XE2, XE4(win32/win64).
LibMySql.dll Versions: 3.23, 4.0, 4.1, 5.0, 5.1, 6.0
MySQL-Server Versions: 3.23, 4.0, 4.1, 5.0, 5.1

Download mysql.pas

The contents of the file mysql.pas are used with permission, subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Change log
2009-03-27(so)Page created
2009-03-29(so)Demo application
2009-04-13(so)Improved dynamic loading
2009-04-26(so)Demo Delphi 2009
Added functions: mysql_autocommit, mysql_set_character_set,
mysql_commit, mysql_rollback, mysql_set_server_option,
mysql_sqlstate, mysql_warning_count, MySql_StrLen,
CharSetNameToCodepage, CodepageToCharSetName, MySqlToUTF16,
2009-06-08(so)Added functions: mysql_server_init, mysql_server_end,
Support for prepared statements
2009-06-09(so)Added records: TNET501, TMYSQL501
2009-06-10(so)Added functions mysql_thread_init, mysql_thread_end
2009-06-24(so)Added functions mysql_more_results, mysql_next_result, FormatIdentifier
2009-07-04(so)Added functions EscapeString, EscapeForLike, QuoteString, FullFieldname
Change FormatIdentifier to QuoteName
2009-08-04(so)Bug in GetVersion fixed
2009-09-13(so)ThreadDemo added
2011-07-22(so)Added functions mysql_field_default, mysql_get_client_filename
New comment about using thread_init, mysql_thread_end since 5.0.77
2011-09-15(so)Adaptation to Delphi XE2
2015-10-13(so)Adaptation to FreePascal