froth-webdriverio-framework 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,7 +8,7 @@ const getLoginToken = require('../api/loginapi');
|
|
|
8
8
|
|
|
9
9
|
async function connectToDB(id, querytype, query) {
|
|
10
10
|
try {
|
|
11
|
-
|
|
11
|
+
// console.log("insude connectToDB"+id+" "+querytype+" "+query)
|
|
12
12
|
const jsondata = await dbinfo.getDbDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), id);
|
|
13
13
|
let connectionpool = await dbtype(jsondata);
|
|
14
14
|
let result = await executeQuery(jsondata.database_type,querytype, query, connectionpool);
|
package/db/postgresOperations.js
CHANGED
|
@@ -12,21 +12,10 @@ async function connectToPostgreSQL(hostname, username, password1, dbname, portnu
|
|
|
12
12
|
database: dbname,
|
|
13
13
|
port: portnumber // Increased connection timeout
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
// user: "postgres",
|
|
17
|
-
// host: "10.0.222.36",
|
|
18
|
-
// database: "testops",
|
|
19
|
-
// password: "A6b1b/b%V9",
|
|
20
|
-
// port: 5432,
|
|
21
|
-
// });
|
|
22
|
-
|
|
15
|
+
|
|
23
16
|
const pool = new Pool(poolConfig);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// Optionally, run a simple query to verify the connection
|
|
27
|
-
// const res = await client.query('SELECT NOW()');
|
|
28
|
-
// console.log("postgresresults "+res.rows[0]);
|
|
29
|
-
// client.release();
|
|
17
|
+
console.log('PostgreSQL connection pool created.');
|
|
18
|
+
|
|
30
19
|
return pool;
|
|
31
20
|
} catch (error) {
|
|
32
21
|
console.error('Error creating MySQL connection pool:', error);
|
|
@@ -40,18 +29,15 @@ async function fetchDataFromPostgresDB(connectionpool, query) {
|
|
|
40
29
|
let connection = null;
|
|
41
30
|
let finalResult = null;
|
|
42
31
|
try {
|
|
43
|
-
console.log("connectionpool" + connectionpool)
|
|
44
32
|
connection = await connectionpool.connect();
|
|
45
33
|
|
|
46
|
-
console.log('Connected to the fetchDataFromPostgresDB database.' + connection);
|
|
47
|
-
|
|
48
34
|
const result = await connection.query(query);
|
|
49
35
|
const dataArray = result[0] || result.rows; // Adjust for MySQL and PostgreSQL response formats
|
|
50
36
|
finalResult = {
|
|
51
37
|
totalNumberOfRecords: dataArray.length,
|
|
52
38
|
records: dataArray
|
|
53
39
|
};
|
|
54
|
-
console.log(JSON.stringify(finalResult, null, 2));
|
|
40
|
+
// console.log(JSON.stringify(finalResult, null, 2));
|
|
55
41
|
} catch (error) {
|
|
56
42
|
console.error('Error fetching data:', error);
|
|
57
43
|
|