froth-webdriverio-framework 1.0.99 → 2.0.0
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.
- package/db/postgresOperations.js +4 -3
- package/package.json +1 -1
package/db/postgresOperations.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const { Pool } = require('pg');
|
|
2
2
|
|
|
3
3
|
// Function to establish connection to MySQL database
|
|
4
|
-
async function connectToPostgreSQL(hostname, username,
|
|
4
|
+
async function connectToPostgreSQL(hostname, username, password1, dbname, portnumber) {
|
|
5
5
|
try {
|
|
6
6
|
console.log('Connecting to the PostgreSQL database...');
|
|
7
7
|
|
|
8
8
|
const poolConfig = {
|
|
9
9
|
host: hostname,
|
|
10
10
|
user: username,
|
|
11
|
-
password:
|
|
11
|
+
password: password1,
|
|
12
12
|
database: dbname,
|
|
13
13
|
port: 5432 // Increased connection timeout
|
|
14
14
|
};
|
|
@@ -22,7 +22,7 @@ async function connectToPostgreSQL(hostname, username, password, dbname, portnum
|
|
|
22
22
|
|
|
23
23
|
const pool = new Pool(poolConfig);
|
|
24
24
|
// const client = await poolConfig.connect();
|
|
25
|
-
console.log('PostgreSQL connection pool created.');
|
|
25
|
+
console.log('PostgreSQL connection pool created.'+JSON.stringify(pool));
|
|
26
26
|
// Optionally, run a simple query to verify the connection
|
|
27
27
|
// const res = await client.query('SELECT NOW()');
|
|
28
28
|
// console.log("postgresresults "+res.rows[0]);
|
|
@@ -54,6 +54,7 @@ async function fetchDataFromPostgresDB(connectionpool, query) {
|
|
|
54
54
|
console.log(JSON.stringify(finalResult, null, 2));
|
|
55
55
|
} catch (error) {
|
|
56
56
|
console.error('Error fetching data:', error);
|
|
57
|
+
|
|
57
58
|
} finally {
|
|
58
59
|
if (connection) {
|
|
59
60
|
connection.release();
|