Anyone have libmysql.dll functions description?

 

I want to use the dll but need the syntax for the result function. Can someone please help me find a tutorial with the proper calls to the dll?



in this code 'TicksInMySQL' are used some calls to make and run a query but i want to read the results also.



Any help or a poit where i can get it will be much help.

Thanks!

 
the api docs are here: http://dev.mysql.com/doc/refman/5.0/en/apis.html


hth



btw: the C syntax is probably best regards MQL4...
24.2. MySQL C API

 
Liliput:

I want to use the dll but need the syntax for the result function. Can someone please help me find a tutorial with the proper calls to the dll?



in this code 'TicksInMySQL' are used some calls to make and run a query but i want to read the results also.



Any help or a poit where i can get it will be much help.

Thanks!

We do it many times, if you whant we can help you but only for money

 
ukt:
the api docs are here: http://dev.mysql.com/doc/refman/5.0/en/apis.html


hth



btw: the C syntax is probably best regards MQL4...
24.2. MySQL C API



Thanks ukt! It realy helped a lot.

Mike no budget, but thanks for the offer!



So to show others this is how it works. The result must be sorted but it returns the data propertly. Some play with StringFind() must be done. I do not like the way but it is the only one i have got working...



#import "libmysql.dll"
int mysql_init(int db);
int mysql_errno(int TMYSQL);
int mysql_real_connect(int TMYSQL, string host, string user, string password, 
                       string DB,int port,int socket,int clientflag);
int mysql_real_query(int TMSQL, string query, int length);
void mysql_close(int TMSQL);
 
int mysql_store_result(int TMSQL);
string mysql_fetch_row(int result);
int mysql_num_rows(int result);
void mysql_free_result(int result);
 
#import
int mysql;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
   mysql = mysql_init(mysql);
   if(mysql != 0) 
       Print("allocated");
   string host = "localhost";
   string user = "";
   string password = "";
   string DB = "forex";
   int clientflag = 0;
   int port = 3306;
   string socket = "";
   int res = mysql_real_connect(mysql,host,user,password,DB,port,socket,clientflag);
   int err = GetLastError();
   if(res == mysql) 
       Print("connected");
   else 
       Print("error=", mysql, " ", mysql_errno(mysql), " ");
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
   mysql_close(mysql);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   string query = "";
   string row;   
   int length = 0;
   query = "Select TickPrice from gbpusd;";
   length = StringLen(query);
   mysql_real_query(mysql, query, length);
   int result = mysql_store_result(mysql);
   int numOfRows = mysql_num_rows(result);
   for (int i=0;i<numOfRows;i++) {
      row = mysql_fetch_row(result);
      Print(row);                             //--- Here in row is the result as string typo at the end of the string. In front are some symbols.
   }
   mysql_free_result(result);
   int myerr = mysql_errno(mysql);
   if(myerr > 0)
       Print("error=",myerr);
  }
//+------------------------------------------------------------------+
 

Liliput - is great when see fruits of someones labors! Finally... some interesting code.

If have time/inclination... would you mind offering enlightenment regards runtime environment?

eg, OS type, what does forex DB hold, oh yes... why need a db -> MT?

and how might I think in terms/uses of db's to aid my MT work/research etc?


I can see that my one dimensional mind not 'get it' - but db's are inherently interesting simply because are resources/sinks and the employment of a db in this arena really does wake me up so need more data to understand.

Should you feel able would appreciate some education...

;o)

 

ukt,

you link helped me to find the syntax i needed. It requares some mods to work with MQL. MYSQL has data types not supported by MQL that is why some convertions must be done.

Forex is a mysql DB. It can hold as many tables you want. The organizations of the tables and the links between them also. Why db -> MT, saving data to DB is much better than to files. Complex organization is possible. I want to use it to save everything like ticks,trades parameters etc. If you want you can retrieve the MQL code from a DB or part of the code. Think of the big advantages all this is giving. For instance one can put the code of the EA in the DB. Then no debuging will crack the code :) But all this is future music. Anyway thanks...

 

Sir,

Can we update data in mysql using libmysql.dll ???

Liliput:

Thanks ukt! It realy helped a lot.

Mike no budget, but thanks for the offer!



So to show others this is how it works. The result must be sorted but it returns the data propertly. Some play with StringFind() must be done. I do not like the way but it is the only one i have got working...




 
vkarthikeyenv:

Sir,

Can we update data in mysql using libmysql.dll ???

Why are you replying to a post that is 4 years old ? do you really expect an answer ?
Reason: