froth-webdriverio-framework 1.0.95 → 1.0.97
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,6 +8,7 @@ const getLoginToken = require('../api/loginapi');
|
|
|
8
8
|
|
|
9
9
|
async function connectToDB(id, querytype, query) {
|
|
10
10
|
try {
|
|
11
|
+
console.log("insude connectToDB"+id+" "+querytype+" "+query)
|
|
11
12
|
const jsondata = await dbinfo.getDbDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), id);
|
|
12
13
|
let connectionpool = await dbtype(jsondata);
|
|
13
14
|
let result = await executeQuery(jsondata.database_type,querytype, query, connectionpool);
|
|
@@ -25,7 +26,7 @@ async function dbtype(jsondata) {
|
|
|
25
26
|
connectionpool = mysqlconnect.connectToMySQL(jsondata.host, jsondata.username, jsondata.password, jsondata.schema_name, jsondata.port_number);
|
|
26
27
|
break;
|
|
27
28
|
case 'PostgreSQL':
|
|
28
|
-
connectionpool = postgreSqlConnect.connectToPostgreSQL(jsondata.database_type,jsondata.host, jsondata.username, jsondata.password, jsondata.schema_name, jsondata.port_number);
|
|
29
|
+
connectionpool = await postgreSqlConnect.connectToPostgreSQL(jsondata.database_type,jsondata.host, jsondata.username, jsondata.password, jsondata.schema_name, jsondata.port_number);
|
|
29
30
|
break;
|
|
30
31
|
default:
|
|
31
32
|
console.log('Unknown dbtype.');
|
package/db/postgresOperations.js
CHANGED
|
@@ -3,11 +3,12 @@ const { Pool } = require('pg');
|
|
|
3
3
|
// Function to establish connection to MySQL database
|
|
4
4
|
async function connectToPostgreSQL(hostname, username, password, dbname, portnumber) {
|
|
5
5
|
try {
|
|
6
|
+
console.log('Connecting to the PostgreSQL database...');
|
|
6
7
|
const poolConfig = new Pool({
|
|
7
|
-
user:
|
|
8
|
-
host:
|
|
9
|
-
database:
|
|
10
|
-
password:
|
|
8
|
+
user: "postgres",
|
|
9
|
+
host: "10.0.222.36",
|
|
10
|
+
database: "testops",
|
|
11
|
+
password: "A6b1b/b%V9",
|
|
11
12
|
port: 5432,
|
|
12
13
|
});
|
|
13
14
|
|
|
@@ -27,7 +28,7 @@ async function connectToPostgreSQL(hostname, username, password, dbname, portnum
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
// Function to fetch data from the database
|
|
30
|
-
async function
|
|
31
|
+
async function fetchDataFromPostgresDB(connectionpool, query) {
|
|
31
32
|
let connection = null;
|
|
32
33
|
let finalResult = null;
|
|
33
34
|
try {
|
|
@@ -69,5 +70,5 @@ async function fetchDataFromDB(connectionpool, query) {
|
|
|
69
70
|
|
|
70
71
|
module.exports = {
|
|
71
72
|
connectToPostgreSQL,
|
|
72
|
-
|
|
73
|
+
fetchDataFromPostgresDB
|
|
73
74
|
};
|