Connect to MySql 8.3? lazarus / 16-Databases ---------------------------------------------------------------------- Kepsz · 2024-03-12 11:15 Hi, Is there a way to connect MySql 8.3 database at this time? The TMyesql80Connection component in Lazarus can only connect to 8.0 The ZeosDBO can only connect up to 5.7, it's the same with the current trunk r8099 version too. So far I managed to handle the Windows platfrom specific issues on Win10 x64 to get the needed dll files, thanx to "Dependencies" https://github.com/lucasg/Dependencies program to figure out the needs of libmysql.dll: -download the MySql .zip https://dev.mysql.com/downloads/shell/ to get libmysql.dll file and put that next to the app .exe file. -install Visual C++ Redistributable for Visual Studio 2015 x64 https://www.microsoft.com/en-us/download/details.aspx?id=48145 -download OpenSSL .zip https://kb.firedaemon.com/support/solutions/articles/4000121705 to get these files: libcrypto-3-x64.dll libssl-3-x64.dll and put those next to the app .exe file. But I see no way forward to connect to a MySql 8.3 database. ---------------------------------------------------------------------- rvk · 2024-03-12 11:20 Quote from: Kepsz on March 12, 2024, 12:15:34 pmIs there a way to connect MySql 8.3 database at this time? The TMyesql80Connection component in Lazarus can only connect to 8.0You can check SkipLibraryVersionCheck. I'm still puzzled as to why there isn't just a generic TMySQLConnection. I can't imagine the version differences are that high, and if there are, they can be handled by a version check of the library. Now the developer always needs to make sure the correct library is installed. Nuts? ---------------------------------------------------------------------- Zvoni · 2024-03-12 11:48 Probably because of this: https://dev.mysql.com/doc/relnotes/mysql/8.3/en/news-8-3-0.html Scroll down to Section "API" QuoteThe following deprecated C API functions have been removed:     mysql_kill(): Use mysql_real_query() or mysql_query() to execute a KILL statement instead. ... more C-API's following Just looked into the mysql.inc-File in C:\lazarus\fpc\3.2.2\source\packages\mysql\src\mysql.inc e.g. mysql_kill is still there No idea about main/trunk ---------------------------------------------------------------------- rvk · 2024-03-12 11:52 Quote from: Zvoni on March 12, 2024, 12:48:06 pmProbably because of this: https://dev.mysql.com/doc/relnotes/mysql/8.3/en/news-8-3-0.html Scroll down to Section "API" QuoteThe following deprecated C API functions have been removed:     mysql_kill(): Use mysql_real_query() or mysql_query() to execute a KILL statement instead. ... more C-API's following Just looked into the mysql.inc-File in C:\lazarus\fpc\3.2.2\source\packages\mysql\src\mysql.inc e.g. mysql_kill is still there No idea about main/trunk Ok, So there are differences. But wouldn't it have been better that those were handled by a generic TMySQLConnection. It can query which library is used and act accordingly. If a developer has several different client and servers, it would be a pain to program them all in with different connections. Using one TMySQLConnection would be so much more convenient. I don't use MySQL so I don't really care, but for instance... Firebird also has different libraries and they are handled in one IBX component (I assume the same goes for TIBConnection). But ok. I guess that's the reason the SkipLibraryVersionCheck was created... a decade too late ---------------------------------------------------------------------- Zvoni · 2024-03-12 12:01 Quote from: rvk on March 12, 2024, 12:52:42 pmQuote from: Zvoni on March 12, 2024, 12:48:06 pmProbably because of this: https://dev.mysql.com/doc/relnotes/mysql/8.3/en/news-8-3-0.html Scroll down to Section "API" QuoteThe following deprecated C API functions have been removed:     mysql_kill(): Use mysql_real_query() or mysql_query() to execute a KILL statement instead. ... more C-API's following Just looked into the mysql.inc-File in C:\lazarus\fpc\3.2.2\source\packages\mysql\src\mysql.inc e.g. mysql_kill is still there No idea about main/trunk Ok, So there are differences. But wouldn't it have been better that those were handled by a generic TMySQLConnection. It can query which library is used and act accordingly. If a developer has several different client and servers, it would be a pain to program them all in with different connections. Using one TMySQLConnection would be so much more convenient. I don't use MySQL so I don't really care, but for instance... Firebird also has different libraries and they are handled in one IBX component (I assume the same goes for TIBConnection). But ok. I guess that's the reason the SkipLibraryVersionCheck was created... a decade too late  The funny thing is: There IS only one mysql.inc, though smattered with a lots of {$IFDEF MySQLVersion} blabla Yes, there are the "different" mysqlX.Xconn.pas files, but those are (more or less) just placeholders, which import the inc-file with setting the Defines beforehand Funfact 2: Excerpt from mysql.inc Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$IFDEF Unix}  {$DEFINE extdecl:=cdecl}  const    mysqllib = 'libmysqlclient.'+sharedsuffix;  {$IF DEFINED(mysql80)}    mysqlvlib = mysqllib+'.21';  {$ELSEIF DEFINED(mysql57)}    mysqlvlib = mysqllib+'.20';  {$ELSEIF DEFINED(mysql55) or DEFINED(mysql56)}    mysqlvlib = mysqllib+'.18';  {$ELSEIF DEFINED(mysql51)}    mysqlvlib = mysqllib+'.16';  {$ELSEIF DEFINED(mysql50)}    mysqlvlib = mysqllib+'.15';  {$ELSEIF DEFINED(mysql41)}    mysqlvlib = mysqllib+'.14';  {$ELSE}    mysqlvlib = mysqllib+'.12';  {$ENDIF}{$ENDIF}{$IFDEF Windows}  {$DEFINE extdecl:=stdcall}  const  mysqllib = 'libmysql.dll';    mysqlvlib = 'libmysql.dll';{$ENDIF} The API-declares all call on mysqllib (the one WITHOUT Version-Info on Linux) mysqlvlib (The one WITH Version-Info on Linux) is only needed when trying to initialize MySQL (Just did a CTRL+F in Geany) QuoteFunction InitialiseMysql(argc: cint; argv: PPchar; groups: PPchar) : Integer; begin   Result := 0;   if (RefCount<>0) then     // pretend to load whatever is already loaded, so we do not get a library name conflict.     Inc(RefCount)   else     If (TryInitialiseMysql(mysqllib,argc,argv,groups)=0)        and (TryInitialiseMysql(mysqlvlib,argc,argv,groups)=0) then       Raise EInOutError.CreateFmt(SErrDefaultsFailed,[mysqlvlib,mysqllib]);   Result := RefCount; end; That said: Just looked at some source-files of Mysql in the Dev-Zone of their page: They don't offer an exported function to read out the library-version?!?!? ---------------------------------------------------------------------- rvk · 2024-03-12 12:30 Quote from: Zvoni on March 12, 2024, 01:01:25 pmThe funny thing is: There IS only one mysql.inc, though smattered with a lots of {$IFDEF MySQLVersion} blabla Yes, there are the "different" mysqlX.Xconn.pas files, but those are (more or less) just placeholders, which import the inc-file with setting the Defines beforehandYeah, if only those IFDEFs were done like if/else depending on the loaded library, like with all other connection components for other databases  Quote from: Zvoni on March 12, 2024, 01:01:25 pmThat said: Just looked at some source-files of Mysql in the Dev-Zone of their page: They don't offer an exported function to read out the library-version?!?!? Yikes? At least on Windows they have version information in the properties. But you would really like a exported version for it to be sure. Doesn't mysql_get_client_info() or mysql_get_client_version() give the client info? https://dev.mysql.com/doc/c-api/8.0/en/c-api-function-reference.html https://dev.mysql.com/doc/c-api/8.0/en/mysql-get-client-info.html https://dev.mysql.com/doc/c-api/8.0/en/mysql-get-client-version.html It's even used in function TConnectionName.GetConnectionInfo() So, all those different TMySQLXXConnections could be rewritten to one TMySQLConnection. The older ones can stay a wrapper for backwards compatibility. They would even work with newer clients in that case No need to make newer ones because that can be done dynamically in the new TMySQLConnection. ---------------------------------------------------------------------- Zvoni · 2024-03-12 12:55 Quote from: rvk on March 12, 2024, 01:30:02 pmYikes? At least on Windows they have version information in the properties. But you would really like a exported version for it to be sure. Doesn't mysql_get_client_info() or mysql_get_client_version() give the client info? https://dev.mysql.com/doc/c-api/8.0/en/c-api-function-reference.html https://dev.mysql.com/doc/c-api/8.0/en/mysql-get-client-info.html https://dev.mysql.com/doc/c-api/8.0/en/mysql-get-client-version.html It's even used in function TConnectionName.GetConnectionInfo() So, all those different TMySQLXXConnections could be rewritten to one TMySQLConnection. The older ones can stay a wrapper for backwards compatibility. They would even work with newer clients in that case No need to make newer ones because that can be done dynamically in the new TMySQLConnection. You're right. Missed those. And both are available in 8.3 Just looked again in mysql.inc - InitialiseMySQL Both "Tries" must be satisfied (And condition). Haven't looked too closely: is the libmysqlclient.so a symlink to libmysqlclient.so.21 (or whatever suffix) or the other way round? Because if the so is a symlink to the so.xx then the second try should not be neccessary. Just read out the client-version AND THEN set the Defines incl. the second try? If that's even possible....... IIRC, defines are constants at compile-time, no? ---------------------------------------------------------------------- Kepsz · 2024-03-12 12:59 Quote from: rvk on March 12, 2024, 12:20:18 pmQuote from: Kepsz on March 12, 2024, 12:15:34 pmIs there a way to connect MySql 8.3 database at this time? The TMyesql80Connection component in Lazarus can only connect to 8.0You can check SkipLibraryVersionCheck. Oh, I did not know about that property. Thank you!