Download MetaTrader 5

Libraries: MySQL for new MQL4 (tested in build 600)

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
188990
MetaQuotes Software Corp.  

MySQL for new MQL4 (tested in build 600):

Connecting to MySQL server from new MQL4

Author: Sergey

micclly
189
micclly  

Good work!

Include file in MLQ4.zip is at this time older than an attached header file.

So after exctraction of zip, overwrite include file with an attached version is required to make it work.

Sergey Lukin
220
Sergey Lukin  
micclly:

Good work!

Include file in MLQ4.zip is at this time older than an attached header file.

So after exctraction of zip, overwrite include file with an attached version is required to make it work.


Thanks!

While I couldn't find any code difference between the files (I used git diff and unix diff tools.. am I missing something?), I strongly recommend always taking the one from Github repo anyways.

micclly
189
micclly  
lukins:

While I couldn't find any code difference between the files (I used git diff and unix diff tools.. am I missing something?), I strongly recommend always taking the one from Github repo anyways.


I indeed agree with getting from GitHub, but the zip file contains invalid include file, is truth at this time :0


Here how to reproduce:

$ unzip MQL4.zip
Archive:  MQL4.zip
   creating: MQL4/
   creating: MQL4/Include/
  inflating: MQL4/Include/mql4-mysql.mqh
   creating: MQL4/Libraries/
  inflating: MQL4/Libraries/libmySQL.dll
   creating: MQL4/Scripts/
  inflating: MQL4/Scripts/mql4-mysql-example.mq4
$ diff -u MQL4
MQL4/           MQL4.zip        mql4-mysql.mqh
$ diff -u MQL4/Include/mql4-mysql.mqh mql4-mysql.mqh
--- MQL4/Include/mql4-mysql.mqh 2014-02-09 13:50:00.000000000 +0900
+++ mql4-mysql.mqh      2014-02-11 03:50:47.607291800 +0900
@@ -76,7 +76,7 @@
     if ( result != dbConnectId ) {
         int errno = mysql_errno(dbConnectId);
-        string error = mql4-mysql_ansi2unicode(mysql_error(dbConnectId));
+        string error = mql4_mysql_ansi2unicode(mysql_error(dbConnectId));
         Print("init_MySQL: mysql_errno: ", errno,"; mysql_error: ", error);
         return (false);
@@ -96,7 +96,7 @@
 //+----------------------------------------------------------------------------+
 bool MySQL_NoError(int dbConnectId) {
     int errno = mysql_errno(dbConnectId);
-    string error = mql4-mysql_ansi2unicode(mysql_error(dbConnectId));
+    string error = mql4_mysql_ansi2unicode(mysql_error(dbConnectId));
     if ( errno > 0 ) {
         Print("MySQL_NoError: mysql_errno: ", errno,"; mysql_error: ", error);
@@ -202,7 +202,7 @@
 //| Lovely function that helps us to communicate with ANSI DLLs, source:       |
 //| http://forum.mql4.com/60708                                                |
 //+----------------------------------------------------------------------------+
-string mql4-mysql_ansi2unicode(int ptrStringMemory)
+string mql4_mysql_ansi2unicode(int ptrStringMemory)
 {
   int szString = lstrlenA(ptrStringMemory);
   uchar ucValue[];
Sergey Lukin
220
Sergey Lukin  

micclly:

Here how to reproduce:


You're totally right, shame on me. Seems like I didn't upload the correct archive. Sorry for making you rechecking this. I uploaded the updated archive and it will be up after it's approved by a moderator.

Thanks for letting me know!

naphill
9
naphill  

Nice job,

Can anyone give me a pointer as to making this work for 2008 64 bit server? I assume this is my issue, as it says 32 bit only above.

I took the above code and added my old Insert loop from my own MySQL EA and it Inserts first loop fine. It then crashes MT4 with libmysql.dll access violation error.

Any tips would be appreciated.

naphill
9
naphill  
phily:

Nice job,

Can anyone give me a pointer as to making this work for 2008 64 bit server? I assume this is my issue, as it says 32 bit only above.

I took the above code and added my old Insert loop from my own MySQL EA and it Inserts first loop fine. It then crashes MT4 with libmysql.dll access violation error.

Any tips would be appreciated.


I worked it out after a long week of trying :)
Sergey Lukin
220
Sergey Lukin  

phily:


I worked it out after a long week of trying :)


Glad you got it working. Could you share what you had to do in order for it to work on 64 bit environment? Pull request on Github would be even more appreciated.
MQL4 Comments
16316
MQL4 Comments  

Great job!!!

But what have to be changed to work in an 64 bit environment?


THX in advance!


Michael

FxLogic
255
FxLogic  
When I use this I get access violation read to msvcrt.dll, is this normal or is there a way to avoid this error.
Dernie
33
Dernie  
phily:
phily:

Nice job,

Can anyone give me a pointer as to making this work for 2008 64 bit server? I assume this is my issue, as it says 32 bit only above.

I took the above code and added my old Insert loop from my own MySQL EA and it Inserts first loop fine. It then crashes MT4 with libmysql.dll access violation error.

Any tips would be appreciated.


I worked it out after a long week of trying :)


What have you changed? I've got the same problems... . :-(

THX in advance!

To add comments, please log in or register