You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jSQL is a state and data management tool as well as a robust SQL engine for both Node and the browser. For complete documentation, please see [the jSQL Wiki](https://github.com/Pamblam/jSQL/wiki). For plugins, live demos and other information see the [official website](http://pamblam.github.io/jSQL/).
9
9
10
-
Under the hood, jSQL has 3 layers:
10
+

11
+
12
+
Under the hood, jSQL has 3 layers:
11
13
12
14
-**At the Lowest level**, jSQL automatically chooses the best method of storage to save state and interacts directly with it. This layer exposes a persistence method, [`jSQL.commit()`](https://github.com/Pamblam/jSQL/wiki/Persistence-Management#jsqlcommit), which is called to serialize and store all data currently in the jSQL database on the user's hard drive. While the app is open and loaded in the browser, this data is serialized and stored within reach in the [`jSQL.tables`](https://github.com/Pamblam/jSQL/wiki/Persistence-Management#jsqltables) object where the library is able to perform operations on it.
13
15
@@ -32,7 +34,7 @@ If you're running jSQL in a browser, include it in a script tag.
If you're running jSQL in Node, `require` the jSQL module.
37
39
38
40
var jSQL = require("jSQL.js");
@@ -45,17 +47,17 @@ When the database has loaded into memory, you'll want to make sure you have a ta
45
47
var sql = "create table if not exists users (name varchar(25), age int)";
46
48
jSQL.query(sql).execute();
47
49
});
48
-
50
+
49
51
#### Insert into table
50
52
51
53
At some point, you might want to put some data in that table.
52
54
53
55
jSQL.query("insert into users ('bob', 34)").execute();
54
-
56
+
55
57
Prefer prepared statements? Just replace values with question marks and pass the values to the execute method in an array.
56
-
58
+
57
59
jSQL.query("insert into users (?, ?)").execute(['bob', 34]);
58
-
60
+
59
61
#### Select from table
60
62
61
63
Once you've got the data in there, you're probably going to want to get it back out.
@@ -64,7 +66,7 @@ Once you've got the data in there, you're probably going to want to get it back
64
66
65
67
#### Persisting changes in the browser
66
68
67
-
When you've made changes or additions to the database, call [`jSQL.commit()`](https://github.com/Pamblam/jSQL/wiki/Persistence-Management#jsqlcommit) to commit your changes.
69
+
When you've made changes or additions to the database, call [`jSQL.commit()`](https://github.com/Pamblam/jSQL/wiki/Persistence-Management#jsqlcommit) to commit your changes.
68
70
69
71
For more information and to read about other update, delete and other operations, see the [jSQL Wiki](https://github.com/Pamblam/jSQL/wiki#jsql-docs).
70
72
@@ -91,4 +93,3 @@ Works in all major browsers, even really old ones.
91
93
License info is available [here](https://github.com/Pamblam/jSQL/wiki/License).
0 commit comments