-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
55 lines (53 loc) · 1.56 KB
/
test.js
File metadata and controls
55 lines (53 loc) · 1.56 KB
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
let cfg = require('./cloudconfig');
var sql = require('mssql');
let helper = require('./sqlHelper');
var md5 = require('md5');
console.log(md5('A201603250031504181688'))
return
function getApps(idx) {
try {
const pool1 = new sql.ConnectionPool("mssql://" + cfg.dbConnection, err => {
pool1.request() // or: new sql.Request(pool1)
.query('select * from App', (err, result) => {
// ... error checks
if (err)
console.error(err)
else
console.info(idx, result)
})
})
pool1.on('error', err => {
// ... error handler
console.error(err)
})
} catch (err) {
}
}
var start = function () {
// 在这里使用起来就像同步代码那样直观
let idx = 0;
while (idx++ < 10) {
helper.exePro('test', {},
function (d) {
console.log('pro',idx, d)
},
function (err) {
console.log('pro',idx, err)
})
helper.exeSql('select * from App', {},
function (d) {
console.log('sql',idx, d)
},
function (err) {
console.log('sql',idx, err)
})
}
};
function Person() {
var age = 0;
Object.defineProperty(this, "age", {
get: function () { console.log("内部存储数据为:" + age); return new Date().getFullYear() - age; },
set: function (value) { age = value; }
});
}
start();