Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export problem #55

Closed
acajic opened this issue Jul 30, 2014 · 0 comments
Closed

export problem #55

acajic opened this issue Jul 30, 2014 · 0 comments
Assignees
Labels

Comments

@acajic
Copy link

acajic commented Jul 30, 2014

I appear to have the same problem as the one posted a couple of years ago
https://github.com/kripken/sql.js/issues/9

My code goes as follows.

// db is initialized using pre-existing .db file, which had 3 rows in 'users' table

// insert a new row in 'users' table

var stmt = db.prepare("SELECT * FROM users;");
while (stmt.step()) { // prints out 4 users in console
    var row = stmt.getAsObject();
    console.log(row);
}

var data = db.export();
db = new SQL.Database(data);

stmt = db.prepare("SELECT * FROM users;");
while (stmt.step()) { // prints out 3 users in console
    var row = stmt.getAsObject();
    console.log(row);
}

So, the problem is:

  • I export the database
  • I create a new database using the data that I got by exporting the original db
  • the new database does not have all the data inside that the original database had.

Why does this happen?
I would like to have an 'export()' method that behaves like:
db <is_equal_to> new SQL.Database(db.export())

The problem is most certainly in db.export()... The modifications I made on the original db object are not taken into consideration when calling db.export()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants