
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
And question #2:
Trying to use the ATTACH/DETACH functions to transfer data between databases using SQLite's built-in mechanism, the result is a transaction error 5601...
When running the same transaction in SQLiteStudio, everything is fine.
Is this done on purpose or is something not working?
Unfortunately, the DatabaseExport function has not received the functionality to export the table (although this functionality was originally intended) and currently supports only queries.
On the error 4022, do you get it during testing, if yes, the tester has a limitation on the export file size - 1GB total size of data written to disc ?
When executing the same transaction in SQLiteStudio, everything is fine.
Is this done on purpose or is something not working?
Unfortunately, the DatabaseExport function never got the table export functionality (although this functionality was originally intended) and currently only supports queries.
On the error 4022, do you get it during testing, if yes, the tester has a limitation on the export file size - 1GB total size of data written to disc ?
Error 4022 appears without tester, if you specify query instead of table name in DatabaseExport function.
The size of the database is less than 10 Mb, I was planning to use this functionality to copy data from the database on disc to the database in memory.The query should work, check if the paths are correct
Thanks, I will try to provide the path differently, but in fact in SQLiteStudio the query at the specified path works, I output the query to the terminal log and then copied and executed in SQLiteStudio without problems.
I will write about the result.
Test for multi-threaded writing to the database, run multiple copies of the script, each copy can be labelled with the expert_id parameter.
Everything is written correctly:
But I get errors about blocking:
How to be? There should be a mechanism of conditional record insertion without returning an error.
The query should work, make sure the paths are correct
1. Checked ATTACH DATABASE does work!
The problem was in the following, I tried to attach to the base created in RAM, the physical base in this case ATTACH DATABASE does not work, but if we attach the RAM base to the physical base, it works!
This is quite enough for me to create a copy of the base in RAM, which speeds up calculations)))
2. I decided to go further... and check one more possibility, namely:
ATTACH DATABASE 'file:memdb1?mode=memory&cache=shared' AS M;
According to the idea, the database should be created in RAM and cease to exist after the thread is closed, but its behaviour is different...
In 1, I can join it from any MQL5 programme, Expert Advisor, indicator, script, service,
In 2 the data in it are saved forever, even after rebooting, I already thought ... that maybe the database is created physically, but a search by the name *memdb1*did not find anything
P.S. Perhaps because I created the base from the indicator, and it works in a common thread?
This is a cool feature, but I would like to know if it will remain in the terminal in the next updates and after my message about it:)))).
In this case, you can easily transfer large amounts of data between programs, without problems and delays, and do not use global variables limited by name length....
In this execution it is deleted after the MQL5 programme is finished:
ATTACH DATABASE ':memory:?cache=shared' AS M;
ATTACH DATABASE ':memory:' AS M;
Good afternoon!
Question to MT developers, is it possible to disable the Shared attribute of the SQLite library, by experience in other projects determined that this is the cause of the error: database error , database is locked.
If you are accessing the database from different threads, it is all solved at the level of the database itself, namely by executing these two queries immediately after opening the database:
1. PRAGMA journal_mode = WAL;
2. PRAGMA busy_timeout = 1000;
but the locking error will go away only after you make the base not Shared, you can 't do it with queries.
If access is from different threads to the database, it is all solved at the level of the database itself, namely by executing these two queries immediately after opening the database:
1. PRAGMA journal_mode = WAL;
2. PRAGMA busy_timeout = 1000;
but the locking error will go away only after you make the base not Shared, you can 't do it with queries.
In this case the speed of queries will drop and memory requirements will increase....
but everything is OK :-)
SQLite is designed for one thread or one writer and many readers. Many writers are not about it, about it other bases that are not "light".
it's not about MQL - it's just the way it is really and everywhere.