-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
74 lines (65 loc) · 1.61 KB
/
example.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
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
const Database = require("./DBOperations");
const config = {
user: "user",
password: "pass",
server: "DESKTOP1-RUTK0G",
database: "EXAMPLE_DATABASE",
port: 1433,
pool: {
max: 10,
min: 0,
idleTimeoutMillis: 15000,
},
connectionTimeout: 15000,
requestTimeout: 15000,
options: {
encrypt: true,
trustServerCertificate: true,
},
};
const configSayacDB = {
user: "sayac_user",
password: "pass",
server: "DESKTOP1-RUTK0G",
database: "SAYAC",
port: 1433,
pool: {
max: 10,
min: 0,
idleTimeoutMillis: 15000,
},
connectionTimeout: 15000,
requestTimeout: 15000,
options: {
encrypt: true,
trustServerCertificate: true,
},
};
const db = new Database(config);
const dbSayac = new Database(configSayacDB);
async function test() {
const isExist = await db.isExist("ISMERKEZI", "IsMerkeziKodu", "C01");
const isExistSayac = await dbSayac.isExist("SAYAC2", "SayacAdet", 40);
const getDBValues = await db.getDBValues(
"ISMERKEZI",
"MasterID, IsMerkeziAdi",
"IsMerkeziKodu='C01'"
);
// const insertDBValues = await db.insertDBValues("ISMERKEZI", {
// MasterID: 1,
// IsMerkeziKodu: "deneme",
// IsMerkeziKodu: "deneme",
// IsMerkeziAdi: "deneme",
// });
// const updateDBValues = await db.updateDBValues(
// "ISMERKEZI",
// { IsMerkeziAdi: "deneme" },
// "IsMerkeziKodu='C01'"
// );
console.log("isExist:", isExist);
console.log("isExistSayac:", isExistSayac);
console.log("getDBValues:", getDBValues);
// console.log("insertDBValues:", insertDBValues);
// console.log("updateDBValues", updateDBValues);
}
test();