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

To add comments, please log in or register
Yu Zhang
8980
Yu Zhang  

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 ...



Yu Zhang
8980
Yu Zhang  
does it support modify sql command?
Eugeniy Lugovoy
2013
Eugeniy Lugovoy  
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
Eugeniy Lugovoy
2013
Eugeniy Lugovoy  
Yu Zhang:
does it support modify sql command?

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

MARCOS DALCIN ALVES DINIZ
229
MARCOS DALCIN ALVES DINIZ  
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.

Kirill Rudovich
120
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?

Eugeniy Lugovoy
2013
Eugeniy Lugovoy  
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.

Eugeniy Lugovoy
2013
Eugeniy Lugovoy  
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) ?

Kirill Rudovich
120
Kirill Rudovich  
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.

MARCOS DALCIN ALVES DINIZ
229
MARCOS DALCIN ALVES DINIZ  
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.

To add comments, please log in or register