Discussion of article "How to Access the MySQL Database from MQL5 (MQL4)" - page 11

 

multi-insert get error.

Query =         "INSERT INTO `test_table` (id, code, start_date) VALUES (1,\'EURUSD\',\'2014.01.01 00:00:01\');";
Query = Query + "INSERT INTO `test_table` (id, code, start_date) VALUES (2,\'EURJPY\',\'2014.01.02 00:02:00\');";
Query = Query + "INSERT INTO `test_table` (id, code, start_date) VALUES (3,\'USDJPY\',\'2014.01.03 03:00:00\');";
      

Error of multiple statements: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ...



 
does it support modify sql command?
 
Yu Zhang:

multi-insert get error.

Error of multiple statements: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ...



Make sure you have set multi statement client flag on database connection opening.

int ClientFlag = CLIENT_MULTI_STATEMENTS; // Setting the multi-statements flag
int DB; 

DB = MySqlConnect(Host, User, Password, Database, Port, Socket, ClientFlag); // Connection to the database
 
Yu Zhang:
does it support modify sql command?

it supports DML, DDL, DCL commands of SQL and, of course, SELECT

 
Eugeniy Lugovoy:

Make sure you have MQLMySQL.dll & MQLMySQL.def files located in your folder "C:\Users\Admin\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\MQL5\libraries\"

As you can see if you are running MQL programs in Tester mode, the path to libs would be different (because of UAC)

I'm using the same dll and def files in the agents paths, but the [126] error persists. It wasn't a problem exclusive to the tester.

 

Hello,  Eugeniy!

I use MySql to store tick data. But i can write only 1000 rows. How can i remove this limit? Can you help me?

 
Kirill Rudovich:

Hello,  Eugeniy!

I use MySql to store tick data. But i can write only 1000 rows. How can i remove this limit? Can you help me?

There is no limits, please check your logic to store ticks. if you are uses multistatement mode, there are only limit for command buffer size, so you may split your queries by 100 commands and use transactions.

 
MARCOS DALCIN ALVES DINIZ:

I'm using the same dll and def files in the agents paths, but the [126] error persists. It wasn't a problem exclusive to the tester.

Unfortunately I cannot reproduce this situation right now. but usually error 126 raises when dll cannot be loaded/found. Is it works fine in regular mode (not in tester) ?

 
Eugeniy Lugovoy:

There is no limits, please check your logic to store ticks. if you are uses multistatement mode, there are only limit for command buffer size, so you may split your queries by 100 commands and use transactions.

Thanks for the answer.

 
Eugeniy Lugovoy:

Unfortunately I cannot reproduce this situation right now. but usually error 126 raises when dll cannot be loaded/found. Is it works fine in regular mode (not in tester) ?

It worked after I updated the version of OpenSSL. Thanks for listening.

Reason: