You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Market Simulation: First Steps with SQL in MQL5 (II).
In the previous article, Market Simulation: First Steps with SQL in MQL5 (I), we began using SQL alongside MQL5 code. Although many people believe that we can easily embed SQL code within other code, this is usually not the case. The reason is that SQL code is always embedded in the executable as a string. Embedding SQL code as a string, while not a problem for small snippets, can ultimately cause us quite a few headaches.
This happens because if we make a typo when converting SQL code to a string, we most likely won't notice it. There is no simple and effective way to visually check whether the string—that is, the SQL code—is correct, because syntax highlighting is not applied to code inside a string.
This kind of problem can be very frustrating. I myself have run into difficulties trying to figure out why SQL code doesn't work correctly inside an executable. After carefully reviewing the code, I stumbled upon a small typo that was preventing the SQL from establishing the proper relationships between the tables. I wasted quite a bit of time just trying to figure out the cause, and when I finally found it, I felt that I could have put that time to better use. Since then, I have taken a completely different approach when developing more complex code.
Author: Daniel Jose