nice
thank you
p.s. you should post this to code library or articles
Well, it's still very basic... maybe later on :)
Russell
Here is something you should take a look at:
Thanks, that was the initial code I was using (or something like it)
But it gives lots of problems. MT can't handle MySQL rows or fields very well. Since they are C?? structures.
The wrapper translates these structures to the ones MT can handle (array of strings).
Therefor it is much more relyable; and it's easier to write MySQL queries.
btw. All original functions of libmysql are exported as well
Russell
Tnx, russell
Thanks, that was the initial code I was using (or something like it)
But it gives lots of problems. MT can't handle MySQL rows or fields very well. Since they are C?? structures.
The wrapper translates these structures to the ones MT can handle (array of strings).
Therefor it is much more relyable; and it's easier to write MySQL queries.
btw. All original functions of libmysql are exported as well
Russell
Russel or Red.Line,
if you read this, might you help me please regarding my problem? Thanks a lot! 'MySQL Read from Database'
Hi JT2008,
#include <mysql.mqh> int init(){ Print(MT4_mysql_wrapper_version()); MySQL_Init(); getDB(); return(0); } int deinit(){ MySQL_DeInit(); return(0); } void getDB(){ //-------------v set this to the number of fields you're selecting string lsData[][2]; string lsQuery = "SELECT tableid,some_value FROM `mytable` INNER JOIN .... WHERE ... ORDER BY ..."; MySQL_FetchArray(lsQuery, lsData); for (int i = 0; i < ArrayRange(lsData,0); i++){ for (int j = 0; j < ArrayRange(lsData,1); j++){ Print(i+","+j+": "+lsData[i][j]); } } }
hth
Russell
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi All,
I wrote a small wrapper for fetching row and fields from MySQL.
source and compiled dll in attachment. Futher more a mqh for including the goodies :)