Is there any way to execute queries (SQLite3) in an asynchronous task? This is what I have tried: PHP: class that extends AsyncTask{ private $dbpath; private $query; public function __construct(string $query){ $this->dbpath = Main::getDatabasePath(); //returns "plugins/Test/Test.db" $this->query = $query; } public function onRun(){ $sql = new SQLite3($this->dbpath); $sql->exec($this->query); //^ERROR -> SQLite3::exec(): The SQLite3 object has not been correctly initialised }} EDIT: Solved. The database was being closed in one of the class's __destruct(). My bad. That should work^ flawlessly.
https://www.sqlite.org/wal.html Though that may help you, do remember SQLite3 is a flat file database, not a server. SQLite3 locks the database so no other processes can use it simultaneously. But I think you can pipeline the queries.