Working with sqlite in AsyncTask lazarus / 43-Android ---------------------------------------------------------------------- las · 2019-05-09 21:31 Hi! I'm trying to work with sqlite in AsyncTask. But if I create jSqliteDataAccess in the process of the program, and not put on the form, it does not work. If I pass a link to jSqliteDataAccess, located on the form of a procedure that works in AsyncTask, then a Java exception occurs. After several calls to Sqlite (most likely because from AsyncTask you cannot access objects running in the main thread). How can I work with sqlite in AsyncTask? ---------------------------------------------------------------------- jmpessoa · 2019-05-10 02:09 Hi, las! I can try implement: SelectAsync  DropTableAsync CreateTableAsync InsertIntoTableAsync UpdateTableAsync, ... [and others.... whats?] and  events to  handle/notify  about the  tasks... What about? ---------------------------------------------------------------------- las · 2019-05-10 12:06 I run a procedure that loads several dozen files across the network and puts the data into the sqlite database. The whole procedure lasts about a minute. Implementing one asynchronous database query will not help. It is necessary to change the algorithm of work. It would be very helpful to be able to run several execSQL in one transaction (several thousand queries pass). However, the question remains: why if I create jSqliteDataAccess programmatically, then it does not work if it is not on the form? What is wrong? Like that: db: = jSqliteDataAccess.Create (self); db.init (gApp); db.cursor: = jSqliteCursor.Create (db.Owner); db.cursor.init (gApp); The same situation with jTextFileManager. If I just write as below, then the application falls. And if you put jTextFileManager on the form, then everything works. fm: = jTextFileManager.Create (AndroidModule1); fm.Init (gApp); ---------------------------------------------------------------------- jmpessoa · 2019-05-12 03:22 Quote It would be very helpful to be able to run several execSQL in one transaction.... Done! Added build-in  transaction and boolean result to  "InsertIntoTableBatch"  method Added build-in  transaction and boolean result to  "UpdateTableBatch"  method and Added "ExecSQLBatchAsync" [build-in  transaction] method   [can be used to "Insert" or "Update" ...  etc...] Added  event "OnAsyncPostExecute" to notify Async task result.... Added SetBatchAsyncTaskType to remind  ExecSQLBatchAsync state.... Please, test it! Quotewhy if I create jSqliteDataAccess programmatically, then it does not work if it is not on the form? What is wrong? This is a LAMW limitation ... you need to have at least one component of this type on form for the dynamic/runtime component creation to work....