mercredi 6 avril 2016

Laravel - Read an SQLite file dynamically

I am trying to work on a project that accepts an SQLite file via upload, saves it, and parses the data in the SQLite database. I am finding that when I use a smaller DB file the "-wal" and "-shm" files are not being created but when using a larger DB (at least 2mb) they are.

Here is the code that I am using:

$destination = storage_path().'/tempDir/databases/'.$userId.'/';

//store the file in the directory
$request->file('database')->move($destination .'database/database.db');

$destination = $destination.'database/database.db';
Config::set('database.connections.sqlite.database', $dbLocation);
$sqliteDbConnection = \DB::connection('sqlite');
$getUsers = $sqliteDbConnection->table("users")->get();

Whenever I try and do this, I am getting the following error: "SQLSTATE[HY000]: General error: 10 disk I/O error (SQL: select * from \"users\")"

Does anyone have an idea why that might be? I can confirm that the file being saved to the server is in good standing, I am able to open it with other SQLite viewers.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire