-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSQLite Manager.html
258 lines (236 loc) · 13.8 KB
/
SQLite Manager.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SQLite Manager</title>
<link rel="stylesheet" href="SQLite%20Manager_files/index.css">
</head>
<body data-mode="drag" vbox="">
<input type="file">
<div hbox="" id="tools">
<div data-id="commands">
<div class="list">
<span>File</span>
<ul>
<li data-cmd="query.file -> click">Open a Database</li>
<li data-cmd="api.emit -> db.file">Create a new Database</li>
<li data-cmd="sql.export">Download active Database</li>
<li class="separator"></li>
<li data-cmd="close">Close window</li>
<li class="separator"></li>
<li data-cmd="faqs">Open FAQs page</li>
<li data-cmd="sqlite -> help">Open SQLite help</li>
<li data-cmd="math.js -> help">Open Math.js help</li>
</ul>
</div>
<div class="list">
<span>Manage</span>
<ul>
<li data-cmd="box.clean">Clear Window</li>
<li class="separator"></li>
<li data-value="db_new("my_database.sqlite")">Create a new database<span>db_new</span></li>
<li data-value="db_download(%id%)">Download selected database<span>db_download</span></li>
<li data-value="db_remove(%id%)">Close an existing database<span>db_remove</span></li>
<li class="separator"></li>
<li data-value="SELECT name FROM sqlite_master WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' ORDER BY 1">Inspect selected database<span>SELECT</span></li>
<li data-value="PRAGMA table_info(table_name)">Inspect table structure<span>PRAGMA</span></li>
<li data-value="PRAGMA freelist_count;
PRAGMA page_count;
PRAGMA page_size;">Database info<span>PRAGMA</span></li>
<li data-value="VACUUM">Optimize the database<span>VACUUM</span></li>
<li class="separator"></li>
<li data-cmd="open.js.editor">Open JavaScript editor</li>
</ul>
</div>
<div class="list" data-disabled="false">
<span>History</span>
<ul id="history">
<li data-value="kdkf" title="kdkf">kdkf</li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li data-value="" title=""></li><li class="separator"></li>
<li data-cmd="history.clear">Clear history</li>
</ul>
</div>
<div class="list">
<span>SQLite</span>
<ul>
<li class="disabled">Export</li>
<li data-value="SELECT * from table_name limit 10 | import as var_name">Export to math.js as a matrix<span>SELECT</span></li>
<li class="disabled">Managing Tables</li>
<li data-value="CREATE TABLE [IF NOT EXISTS] table_name(
primary_key INTEGER PRIMARY KEY,
column_name type NOT NULL,
column_name type NULL,
...
)">Create a new table<span>CREATE</span></li>
<li data-value="ALTER TABLE table_name RENAME TO new_name">Rename a table<span>ALTER</span></li>
<li data-value="ALTER TABLE table ADD COLUMN column_definition">Add a new column to a table<span>ALTER</span></li>
<li data-value="ALTER TABLE table DROP COLUMN column_name">Drop an existing column in a table<span>ALTER</span></li>
<li data-value="DROP TABLE [IF EXISTS] table_name;">Drop a table and its data<span>DROP</span></li>
<li class="disabled">Managing Indexes</li>
<li data-value="CREATE [UNIQUE] INDEX index_name
ON table_name (c1,c2,...)">Creating an index<span>CREATE</span></li>
<li data-value="CREATE INDEX index_name ON table_name(expression)">Create an expression index<span>CREATE</span></li>
<li class="disabled">Querying Data</li>
<li data-value="SELECT * FROM table_name limit 100">Query all data from a table<span>SELECT</span></li>
<li data-value="SELECT c1, c2
FROM table_name">Query data from the specified column<span>SELECT</span></li>
<li data-value="SELECT DISTINCT (c1)
FROM table_name">Query unique rows<span>SELECT</span></li>
<li data-value="SELECT *
FROM table_name
WHERE condition">Query rows using a WHERE clause<span>SELECT</span></li>
<li data-value="SELECT c1 AS new_name
FROM table_name">Rename column in the query’s output<span>SELECT</span></li>
<li data-value="SELECT *
FROM table_name_1
INNER JOIN table_name_2 ON condition">Query data from multiple tables<span>SELECT</span></li>
<li data-value="SELECT COUNT (*)
FROM table_name">Count rows returned by a query<span>SELECT</span></li>
<li data-value="SELECT c1, c2
FROM table_name
ORDER BY c1 ASC [DESC], c2 ASC [DESC],...">Sort rows using ORDER BY clause<span>SELECT</span></li>
<li data-value="SELECT *
FROM table_name
GROUP BY c1, c2, ...">Group rows using GROUP BY clause<span>SELECT</span></li>
<li data-value="SELECT c1, aggregate(c2)
FROM table_name
GROUP BY c1
HAVING condition">Filter group of rows using HAVING clause<span>SELECT</span></li>
<li class="disabled">Changing Data</li>
<li data-value="INSERT INTO table_name(column1,column2,...)
VALUES(value_1,value_2,...)">Insert a row into a table<span>INSERT</span></li>
<li data-value="INSERT INTO table_name(column1,column2,...)
VALUES(value_1,value_2,...),
(value_1,value_2,...),
(value_1,value_2,...)...">Insert multiple rows into a table<span>INSERT</span></li>
<li data-value="UPDATE table_name
SET c1 = v1,
...">Update all rows in a table<span>UPDATE</span></li>
<li data-value="UPDATE table_name
SET c1 = v1,
...
WHERE condition">Update rows that match with a condition<span>UPDATE</span></li>
<li data-value="DELETE FROM table">Delete all rows in a table<span>DELETE</span></li>
<li data-value="DELETE FROM table
WHERE condition">Delete rows specified by a condition<span>DELETE</span></li>
<li class="disabled">Search</li>
<li data-value="SELECT * FROM table
WHERE column LIKE '%value%\">Search using LIKE operator<span>SELECT</span></li>
<li data-value="SELECT *
FROM table
WHERE table MATCH 'search_query'">Search using full-text search<span>SELECT</span></li>
</ul>
</div>
<div class="list">
<span>Math.js</span>
<ul>
<li data-value="array = [[2, 0], [-1, 3]]
matrix = matrix([[7, 1], [-2, 3]])
square(array)
square(matrix)
add(array, matrix)
multiply(array, matrix)
ones(2, 3)">Arrays and matrices<span>matrix</span></li>
<li data-value="map(1:10, f(x) = x + 2)">Use functions<span>map</span></li>
<li data-value="sql('SELECT * from table_name WHERE column=value')">Use SQL function<span>sql</span></li>
<li data-value="sql('SELECT * from table_name WHERE column=:v', {':v': 'test'})">Use SQL function (parametric)<span>sql</span></li>
<li data-value="sql('SELECT * from table_name WHERE column=:v', [{':v': 'test-1'}, {':v': 'test-2'}])">Use SQL function (parametric array)<span>sql</span></li>
<li data-value="zeros(3)
zeros(3, 2)
zeros(3, "dense")
A = [[1, 2, 3], [4, 5, 6]]
zeros(size(A))">Zeros function<span>zeros</span></li>
<li data-value="ones(3)
ones(3, 2)
ones(3, 2, "dense")
A = [[1, 2, 3], [4, 5, 6]]
ones(size(A))">Ones function<span>ones</span></li>
<li data-value="range(0, 4)
range(0, 8, 2)
range(3, -1, -1)">Range function<span>range</span></li>
<li data-value="size(2.4)
size(complex(3, 2))
size(unit("5.3 mm"))
size([0, 1, 2, 3])
size("hello world")
a = [[0, 1, 2, 3]]
b = matrix([[0, 1, 2], [3, 4, 5]])
size(a)
size(b)
b.size()
c = [[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]]
size(c)">Size and Dimensions<span>size</span></li>
</ul>
</div>
<div class="list">
<span>Chart.js</span>
<ul>
<li data-value="plot(sin(1:10))
plot(sin(1:10), "steppedLine=after&backgroundColor=transparent&borderColor=gray&borderWidth=2&label=Step Function")">Line chart<span>plot</span></li>
<li data-value="#time formats supported by parse are as defined in https://momentjs.com/docs/#/parsing/
plot(["2018-10-01T01:00:00Z","2018-10-01T01:10:00Z","2018-10-02T01:30:00Z","2018-11-01T01:50:00Z"], [1,2,3,4], "type=line&parser=YYYY-MM-DD[T]HH:mm:ss[Z]")">Time chart<span>plot</span></li>
<li data-value="plot(1:10, sin(1:10), "type=scatter&showLine=false&borderColor=red&borderWidth=5")">Scatter chart<span>plot</span></li>
<li data-value="plot(["group a", "group b", "group c"], [100, 50, 0], "type=bar")
plot([10, 20, 30], "type=bar")
plot([60, 20, 100], "type=bar")">Bar chart<span>plot</span></li>
<li data-value="plot(["part 1", "part 2", "part 3"], [10, 20, 30], "type=pie")
plot([30, 30, 30], "type=pie")">Pie chart<span>plot</span></li>
<li data-value="plot(["part 1", "part 2", "part 3"], [10, 20, 30], "type=doughnut")
plot([30, 30, 30], "type=doughnut")">Doughnut chart<span>plot</span></li>
</ul>
</div>
</div>
<span flex="1"></span>
<div>Database <select id="dbs">
<option disabled="disabled">Drop a Database</option>
<option value="0">0 -> my_database.sqlite</option><option value="1" selected="selected">1 -> my_database.sqlite</option></select></div>
</div>
<div id="viewer" flex="1">
<template id="command-box">
<div data-id="command-box" hbox="" data-index="#1">
<span></span>
<div flex="1" vbox="">
<textarea title="Enter: Run a math.js or SQLite commandShift + Enter: Go to the next line" spellcheck="false" placeholder="Enter math.js or SQLite commands"></textarea>
<div data-id="result" vbox="" align="start"></div>
</div>
</div>
</template>
<div id="box">
<div data-id="command-box" hbox="" data-index="#1">
<span></span>
<div flex="1" vbox="">
<textarea title="Enter: Run a math.js or SQLite commandShift + Enter: Go to the next line" spellcheck="false" placeholder="Welcome to SQLite Manager
Use the "File" menu to open or create a new SQLite database or simply drop a database into this window. You can work on several databases. To select the active database use the selector tool in the top right side of the screen.
You can run one or more SQLite or Math.js commands in each computational box. To execute the command press the "Enter" key. To move to the next line without executing the command use "Shift" + "Enter" key combination. Note that each computational box can either run SQLite or Math.js commands. You are not allowed to mix these two.
-> Use help("command name") to get more info about each Math.js command (e.g.: help("selected")). This function is not usable for SQLite commands at the moment.
-> Supported commands: This extension supports most of the SQLite CLI commands and all of the Math.js commands
-> Extra commands:
plot: plot one or more arrays. See the Chart.js menu for examples
selected: export selected row from the previous SQLite table to the Math.js sandbox
results: export a row from the previous SQLite table to the Math.js sandbox
db_new: Create a new database on the browser memory
db_load: Load a database from a server
db_download: Download the active database to the browser's default download directory
db_remove: Remove the active database from the browser memory
js: Run JavaScript commands in a sandboxed window
sql: Run SQLite commands in the Math.js environment" style="height: 30px;">SELECT name FROM sqlite_master WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' ORDER BY 1
</textarea>
<div data-id="result" vbox="" align="start"></div>
</div>
</div>
</div>
</div>
<div id="notify" hbox="" data-hidden="true">
<span></span>
<span flex="1">Loading...</span>
</div>
<div id="editor" data-visible="false" hbox="" align="end">
<textarea rows="6" spellcheck="false"></textarea>
<div vbox="">
<input type="button" value="Close" data-cmd="close" title="Press Escape instead">
<input type="button" value="Execute" data-cmd="execute" title="Press Meta + E instead">
</div>
</div>
<script src="SQLite%20Manager_files/EventEmitter.js"></script>
<script type="module" src="SQLite%20Manager_files/api.js"></script>
</body></html>