Database

Database actions help you to perform various queries on the database.

A database connection needs to be created under DB Connect (Configure > DB Connect) and the created variable can then be used in the Database String parameter for various database keywords.

 

Database Connection String format : Type | Name / IP Address : Port | SID | Database Name | User Name | Password

 

The database types available in BQ Platform are :

  1. Oracle

  2. MySQL

  3. SQL Server

  4. Postgres

 

To know how to establish a connection with the Database, please go through the https://bqurious.atlassian.net/wiki/spaces/BSD/pages/845938760 document.

Structure :

executeUpdateQuery <parameters>

Action

Parameter

Example Usage

Action

Parameter

Example Usage

executeQueryAndStoreResults

Web, Mobile


To execute the query (mentioned in Parameter 2) on database, with database connection string (mentioned in Parameter 1) and store the result in variable (mentioned in Parameter 3) for further use.

Param 1 : Database connection string
Param 2 : Query to execute
Param 3 : Variable name to store the resultant value

Example :

Suppose the DB Connect variable created is bqdbString with values MySQL | 192.9.9.9 | 9999 | Schema 1 | abcde | xxxxxxxx

executeQueryAndStoreResult : <Data Base String : bqdbString> <Query : select xxxx from Table where xxxx= xxx> <In Variable : bqVariable>

Executes query (select xxxx from Table where xxxx= xxx) on database, with database connection string (bqdbString) and stores the result in (bqVariable) variable.

executeUpdateQuery

Web, Mobile


To execute the update query (mentioned in Parameter 2) on database, with database connection string (mentioned in Parameter 1). 

Param 1 : Database Connection String
Param 2 : Update Query to execute

Example :

Suppose the DB Connect variable created is bqdbString with values MySQL | 192.9.9.9 | 9999 | Schema 1 | abcde | xxxxxxxx

executeUpdateQuery : <Data Base String : bqdbString> <Update Query : update Table set xxxx= xxx where yyyy=yyyy>

Executes query (update Table set xxxx= xxx where yyyy=yyyy) on database, with database connection string (bqdbString).

executeDeleteQuery

Web, Mobile


To execute the delete query (mentioned in Parameter 2) on database, with database connection string (mentioned in Parameter 1).

Param 1 : Database Connection String
Param 2 : Delete Query to execute

Example :

Suppose the DB Connect variable created is bqdbString with values MySQL | 192.9.9.9 | 9999 | Schema 1 | abcde | xxxxxxxx.

executeDeleteQuery : <Data Base String : bqdbString> <Delete Query : delete from Table where yyyy=yyyy>

Execute query (delete from Table where yyyy=yyyy) on database, with database connection string (bqdbString).

executeInsertQuery

Web, Mobile


To execute the insert query (mentioned in Parameter 2) on database, with database connection string (mentioned in Parameter 1).

Param 1 : Database Connection String
Param 2 : Insert Query to execute

Example :

Suppose the DB Connect variable created is bqdbString with values MySQL | 192.9.9.9 | 9999 | Schema 1 | abcde | xxxxxxxx.

executeInsertQuery : <Data Base String : bqdbString> <Insert Query : Insert into Table values (xxxxxxxx)>

Execute query (Insert into Table values (xxxxxxxx)) on database, with database connection string (bqdbString).

executeStoredProcedureAndStoreResult

Web, Mobile


To execute the stored procedure (mentioned in Parameter 2) on database, with database connection string (mentioned in Parameter 1).

Param 1 : Database Connection String
Param 2 : Name of procedure

Example :

Suppose the DB Connect variable created is bqdbString with values MySQL | 192.9.9.9 | 9999 | Schema 1 | abcde | xxxxxxxx.

executeStoredProcedureAndStoreResult : <Data Base String : bqdbString> <Procedure Name : SP1>

Executes stored procedure SP1 on database, with database connection string bqdbString.

setDbInputParameter

Web, Mobile


To set the input parameter name (mentioned in parameter 1) and parameter value (mentioned in parameter 2), of data type (mentioned in parameter 3).

The default parameter type is String. If no value is provided in param 3, String will be used as parameter type.

If parameter type is mentioned as Date, default date format will be used unless user provides a date format in param 4.

Param 1 : Name of the parameter
Param 2 : Value of the parameter
Param 3 (Optional) : Type of parameter
Param 4 (Optional) : Data Format

Example 1 :

setDbInputParameter : <Parameter Name : userName> <Parameter Value : bqurious> <Parameter Type : > <Date Format : >

 Sets input parameter name userName with parameter value bqurious of parameter type String.

Example 2 :

setDbInputParameter : <Parameter Name : setDate> <Parameter Value : 16/04/2020> <Parameter Type : Date> <Date Format : >

Suppose the default date format mentioned in App config. is MM/dd/yy.

Sets input parameter name setDate with parameter value 04/16/20 (date converted to default format) of parameter type Date.

Example 3 :

setDbInputParameter : <Parameter Name : setDate> <Parameter Value : 16/04/2020> <Parameter Type : Date> <Date Format : dd/MM/yy>

Sets input parameter name setDate with parameter value 16/04/20 (date converted to the provided format in param 4) of parameter type Date.

setDbOutputParameter

Web, Mobile


To set the output parameter (name mentioned in parameter 1) of data type (type mentioned in Parameter 3.

The default parameter type is String. If no value is provided in param 2, String will be used as parameter type.

Param 1 : Name of the parameter
Param 2 (Optional) : Type of parameter

Example 1 :

setDbOutputParameter : <Parameter Name : userName> <Parameter Type : >

Sets output parameter userName of type String.

Example 2 :

setDbOutputParameter : <Parameter Name : setDate> <Parameter Type : Date>

Sets output parameter setDate of type Date.

verifyQueryResults

Web, Mobile


To verify the query (mentioned in Parameter 2) on database, with database connection string (mentioned in Parameter 1), returns the value (mentioned in Parameter 3).

Param 1 : Database connection string
Param 2 : Query to execute
Param 3 : Expected Result

Example :

Suppose the DB Connect variable created is bqdbString with values MySQL | 192.9.9.9 | 9999 | Schema 1 | abcde | xxxxxxxx.

verifyQueryResults : <Data Base String : bqdbString> <Query : select xyz from Table where xx = yyyy> <Expected Results : bqResults>

Verifies query (select xyz from Table where xx = yyyy) returns value (bqResults) on database with database connection string (bqdbString).



 

https://bqurious.atlassian.net/wiki/spaces/BSD/pages/845938760