[CLASS] MySQLAPI - MySQL wrapper

Post your working scripts, libraries and tools
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

[CLASS] MySQLAPI - MySQL wrapper

26 Oct 2013, 02:34

From the old forum.

Update on 2015-08-20:
  • libmysql.dll error handling.
Update on 2014-03-10:
  • Moved sources to GitHub.

just me wrote:Some time ago I started a project based on a MySQL database. So I took panofish's script, adapted it to my likings and added a few more functions. It's still rather inclomplete (missing prepared queries, handy blob support, etc.) and only somewhat tested, but it seems to be reasonably stable.
 
The project was cancelled, and currently I havn't time as well as interest to continue the work on the class script. It might be useful anyway, that's why it's here:

I'll try to give support here, as far as I can. ;)

Required wrote:libmysql.dll:
By default, a compatible version of libmysql.dll is expected to be found in the script's folder. Alternatively you can pass the fully qualified path of the DLL when creating the new instance.
You can get the DLL by downloading the compatible (32/64-bit) Connector\C ZIP Archive. Win XP users have to click the button Looking for previous GA versions? and download the Connector/C 6.0.2 instead.


Code: [Select all] [Expand] [Download] (Class_MySQLAPI.ahk)GeSHi © Codebox Plus


:arrow: Demo script by geminbot
You need a running MySQL server and sufficient access rights. Also, you have to include the class script instead of #include mysql2.ahk.

:arrow: Download from GitHub!
Last edited by just me on 18 Feb 2016, 01:48, edited 7 times in total.
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Class_MySQLAPI - MySQL wrapper

26 Oct 2013, 06:41

Very nice!
I've just tested it and It works fine. I must learn how work Listview,ect. Thanks!

Is there any documentation about functions in the class?
Thanks in advance.
Everything is possible!
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class_MySQLAPI - MySQL wrapper

26 Oct 2013, 08:50

You'll find some documentation on the MySQL site. I'll try to write some additional as soon I find the time.
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Class_MySQLAPI - MySQL wrapper

26 Oct 2013, 08:54

OK thanks. But I was referring to the functions of the class.
Greetings!
Everything is possible!
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class_MySQLAPI - MySQL wrapper

27 Oct 2013, 02:59

After some thinking about your question I'm not sure what you are asking for. Most of the class functions simply wrap one MySQL API function call. There's some inline documentation about what they are doing and the parameters (if any), and also the documentation on MySQL.org. So, what kind of additionally documentation do you want?
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Class_MySQLAPI - MySQL wrapper

27 Oct 2013, 10:52

I thought a document/brief that it contains all your procedures/functions of your class.
Don't worry. I'll take a look to your class.
Thanks!
Everything is possible!
newpie
Posts: 37
Joined: 01 Jun 2014, 07:50

Re: [CLASS] MySQLAPI - MySQL wrapper

01 Jun 2014, 07:53

Hello, I get an error that states:
Could not load C:\Users\Owner\Desktop\AHK Demo\libmysql.dll!
Is there a new libmysql.dll that can be posted, if this is the issue? Thanks
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [CLASS] MySQLAPI - MySQL wrapper

06 Jun 2014, 04:14

Which AHK version are you running? You need a 32-bit DLL for AHK 32/x86 or a 64-bit DLL for AHK 64/x64.
Roger

Re: [CLASS] MySQLAPI - MySQL wrapper

05 Jun 2015, 13:37

I am having the same issue. can not load libmysql.dll

What I found is there is no .dll file included in the Github link. Is Github deleting this? I have had several script break because the included dll files were blank or deleted.
Does anyone have the old libmysql.dll file for this? I can't find it anywhere and all GitHub locations it is gone. or blank :P
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [CLASS] MySQLAPI - MySQL wrapper

06 Jun 2015, 03:22

The GitHub repository never included libmysql.dll. You should download and install MySQL.
Edit: At least download Connector/C, extract the DLL from the zip archive and put it into your script's folder. I added the download link to the OP.
bobycom
Posts: 8
Joined: 26 Feb 2015, 07:13

Re: [CLASS] MySQLAPI - MySQL wrapper

18 Aug 2015, 06:42

I have the same issue :(

Could not load D:\boby\libmysql.dll!


I'm on a Windows Xp 32-bit machine and downloaded the correct 32-bit libmysql.dll file.
Could it be because I have not installed MySQL Server on my PC?
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [CLASS] MySQLAPI - MySQL wrapper

18 Aug 2015, 08:01

All happening before the "Could not load ..." error is reported is:

Code: [Select all] [Download] GeSHi © Codebox Plus

If !(MySQLM := DllCall("Kernel32.dll\LoadLibrary", "Str", LibMySQL, "UPtr"))
So, if the error is reported, the dll file
  • could not be found at the location reported by the MsgBox,
  • is corrupt,
  • has the wrong bitness.
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [CLASS] MySQLAPI - MySQL wrapper

18 Aug 2015, 09:44

Maybe this could be a reason, too:
April 8, 2014

Support EOL for Microsoft Windows XP

Per the MySQL Support Lifecycle policy regarding ending support for OS versions that are obsolete or have reached end of life, we plan to discontinue supporting all MySQL binaries for Microsoft Windows XP as of April 8, 2014.

Source
bobycom
Posts: 8
Joined: 26 Feb 2015, 07:13

Re: [CLASS] MySQLAPI - MySQL wrapper

18 Aug 2015, 09:52

just me, thank you for the reply.

I might be very stupid or blind or I don't know what else.
  • The file is in the location reported by the MsgBox
  • I downloaded the Connector/C 6.1.6 .zip archive, also the msi installer and the full MySQLServer Installer. None of them work.
  • I'm sure I'm downloading the 32-bit (x86) version of the dll.

In my desperation I even replaced the "UPtr" with a "UInt" in the LoadLibrary call, but the result is still the same.
Just for the record I have previous experience with using external functions from .dll files and have dealt with wrong bitness issues.

What I haven't tried is to run this on a x64 Windows. I will download the appropriate .dll version and will try ;)
bobycom
Posts: 8
Joined: 26 Feb 2015, 07:13

Re: [CLASS] MySQLAPI - MySQL wrapper

18 Aug 2015, 09:55

The install shields had no warnings about me using inappropriate OS version. Anyway I will try with Windows 7 32-bit and 64-bit.

Edit

It successfully loaded the library on both 32-bit and 64-bit Windows 7. grrrrrrrrrrrrrrrrrrrrrr.

Thank you very much for the help, just me!!!
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [CLASS] MySQLAPI - MySQL wrapper

18 Aug 2015, 10:43

On the Connector/C download page you find a button "Looking for previous GA versions" which will lead you to Connector/C 6.0.2. It might work on Win XP.

Edit: It should work on Win XP.
bobycom
Posts: 8
Joined: 26 Feb 2015, 07:13

Re: [CLASS] MySQLAPI - MySQL wrapper

19 Aug 2015, 03:36

just me, you are absolutely right. I downloaded the older version of the C connector and now the script is working on Windows XP as well.

Do you want me to do OS version check inside the Class_MySQLAPI.ahk or at least add more info for possible reasons to not be able to load the library?

Thank you for the help, again. You are great!
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [CLASS] MySQLAPI - MySQL wrapper

19 Aug 2015, 05:01

Thanks for reporting.

If you can give me unambiguuos information, I'll try to implement a check.
bobycom
Posts: 8
Joined: 26 Feb 2015, 07:13

Re: [CLASS] MySQLAPI - MySQL wrapper

19 Aug 2015, 05:19

What I was thinking is to add more info about the possible reasons for not being able to load the library in the message box. Something like this:

Code: [Select all] [Download] GeSHi © Codebox Plus

If !(MySQLM := DllCall("Kernel32.dll\LoadLibrary", "Str", LibMySQL, "UPtr")) {
MsgBox, 16, MySQL Error!, Could not load %LibMySQL%!`n`nPlease check if the file really exists, if it is with the correct bitness or if it is not corrupted.`n`nAlso bear in mind that the latest Connector C version is not supporting some old OS versions.
Return False
}


If you are asking for unambiguous information about OS support, you already have it in the link you posted. Or have I misunderstood you.
just me
Posts: 5460
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [CLASS] MySQLAPI - MySQL wrapper

19 Aug 2015, 05:48

No, I though about a special error code which could be retrieved via A_LastError or similar.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 13 guests