forked from sqlectron/sqlectron-gui
-
Notifications
You must be signed in to change notification settings - Fork 4
/
c1.js
33 lines (33 loc) · 1010 Bytes
/
c1.js
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
const cloneDeep =require('lodash.clonedeep');
const sqlectron = require('sqlectron-core');
console.log(sqlectron);
//sqlectron.servers.getAll();
//console.log(sqlectron.db.CLIENTS.length);
//console.log(sqlectron.db.CLIENTS);
var serverConfig={client:"sqlite"}
var db=sqlectron.db.createServer(serverConfig);
//console.log(db);
var con=db.createConnection("/home/mhq/python/parts/data.sqlite")
console.log(con);
async function getContacts(){
let results= await con.executeQuery("select * from parts_contact;");
//.then((data)=>{
// for(var i in data){
// console.log(i);
// }
// con.executeQuery("insert into ma(id) values(1);");
// var ts=con.listTables().then((data)=>{
// console.log(data);
// });
//});
//const results = cloneDeep(remoteResult);
console.log("results:"+results);
for(var i in results){
console.log(i,results[i]);
}
}
con.connect().then(()=>{
console.log("connected");
getContacts();
});
//con.executeQuery("create table ma(id int)");