How to open a export database file?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, php, sqlite
Research direction
Start with the JavaScript export and XMLHttpRequest loading snippets, then inspect how saveDb.php writes the posted data to sqlite.db. Verify that the fetched file contains the exported database bytes and that it can be passed to SQL.Database without the file error.
Written by the indexing model from the issue text.
Description
I exported the database from memory and save it on server.The next time,when i re-open the exported file via XMLHttpRequest,it said the file is not a database file.How can I re-use the saved data?
The code to export and post to server:
var data = db.export();
db.close();
$.post("saveDb.php",{
data:data
},function(result){
console.log(result);
});
On the server,I used the http_put_contents() to save the data to file "sqlite.db".
The code to load the saved db file is as below:
var xhr = new XMLHttpRequest();
xhr.open('GET', 'sqlite.db', true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
var uInt8Array = new Uint8Array(this.response);
db = new SQL.Database(uInt8Array);
//......
};
xhr.send();
Then it raise an error:Uncaught Error: file is not a database
Thank you.
- Dominant language
- JavaScript
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sql-js/sql.js
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100