Download MetaTrader 5

Discussion of article "SQL and MQL5: Working with SQLite Database"

To add comments, please log in or register
Sign up for MQL5.community to leave your comments!
MetaQuotes Software Corp.
Moderator
181162
MetaQuotes Software Corp. 2014.04.22 17:25 

New article SQL and MQL5: Working with SQLite Database has been published:

This article is intended for developers who would be interested in using SQL in their projects. It explains the functionality and advantages of SQLite. The article does not require special knowledge of SQLite functions, yet minimum understanding of SQL would be beneficial.


Many developers consider using databases in their projects for data storage purposes and yet they remain hesitant about this, knowing how much extra time the SQL server installation may require. And whereas it may not be so difficult for programmers (if a database management system (DBMS) has already been installed for other purposes), it will certainly be an issue for a common user who might eventually be discouraged to install the software altogether.

So many developers choose not to deal with DBMS realizing that solutions they are currently working on will be used by very few people. As a result, they turn to working with files (often having to deal with more than one file, given the variety of data used): CSV, less often XML or JSON, or binary data files with strict structure size, etc.

However, it turns out there is a great alternative to SQL server! And you do not even need to install additional software as everything is done locally in your project, while still allowing you to use the full power of SQL. We are talking about SQLite.

The purpose of this article is to quickly get you started with SQLite. I will therefore not go into subtleties and all imaginable parameter sets and function flags but instead will create a light connection wrapper to execute SQL commands and will demonstrate its use.

To proceed with the article, you need to:

  • Be in a good mood ;)
  • Extract the archive files attached to the article to the MetaTrader 5 client terminal folder
  • Install any convenient SQLite Viewer (e.g. SQLiteStudio)
  • Add the official documentation on SQLite http://www.sqlite.org to Favorites

Author: o_O

Alain Verleyen
Moderator
30736
Alain Verleyen 2014.04.28 09:20  
Wonderful idea and article, I didn't think to that. It would be great however to have a native support in mql5, so that could be used in Market's product.
dzsoni
25
dzsoni 2014.05.13 09:55  

First of all  warm thanks for your work!

I ported it to mql4 with success! (some #property strict, solve the compilation errors.)

And as I use  32bit platform I had to comment out and delete some 64bit related import functions. The terrminal uses early binding, so 64 bit-dll also try to load during the program load. (altough it is not used, only the 32bit.dll.). It made error. 

But anyway, I like your implementation! ( I wish I colud write so good prog as yours.)

268615
35
268615 2015.01.12 12:33  
I am using a 64 bit version of MetaTrader 5 and am not able to get the code working. I tried removing the references to 32 bit code but still get an error "Sqlite3_32.dll" cannot load. Can you tell is the code referencing this dll anywhere ? I need to get it working for 64 bit.
To add comments, please log in or register