Skip to content

Commit cb90e3c

Browse files
committed
Working on adding keys
1 parent bd6f89d commit cb90e3c

File tree

5 files changed

+263
-18
lines changed

5 files changed

+263
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# jSQL
2-
v1.6
2+
v2
33

44
jSQL is a state and data management tool as well as a robust SQL engine. For complete documentation, please see [the jSQL Wiki](https://github.com/Pamblam/jSQL/wiki).
55

examples/keys/index.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>jSQL test</title>
6+
</head>
7+
<body>
8+
<script src="../../jSQL.js"></script>
9+
<script>
10+
11+
var data = [
12+
[0, "rob", "hamburger"],
13+
[1, "bob", "fish tacos"],
14+
[2, "ted", "applesauce"]
15+
];
16+
17+
jSQL.load(function(){
18+
19+
//// Create a compound key using low-level syntax
20+
// jSQL.createTable({myTable: [
21+
// { name: "ID", type: "INT", args: [] },
22+
// { name: "Name", type: "VARCHAR", args: [30] },
23+
// { name: "FOOD", type: "VARCHAR", args: [30] }
24+
// ]}, [
25+
// { column: ["ID", "Name"], type: "unique" }
26+
// ]).execute(data);
27+
28+
//// Create a compund key using high level syntax
29+
// jSQL.query("create table if not exists myTable (ID int, Name varchar, FOOD varchar, PRIMARY KEY (ID, Name))").execute(data);
30+
31+
// Create a non-compound key using high-level syntax
32+
jSQL.query("create table if not exists myTable (ID int primary, Name varchar, FOOD varchar)").execute(data);
33+
34+
jSQL.insertInto('myTable').values({ID:0, Name:'Nerd', FOOD: "Bagels"}).ignore().execute();
35+
36+
console.log("done");
37+
});
38+
39+
40+
41+
42+
43+
</script>
44+
</body>
45+
</html>

0 commit comments

Comments
 (0)