Skip to content

export problem #55

Closed
Closed
@acajic

Description

@acajic

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()

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions