Database Adaptor
Setup
The Database Adapter finds the source of the data and updates or queries the database. These tasks are performed through SQL commands or also called SQL statements. Through the Database Adapter, TAST connects and tests the applications and database components. It is possible to perform individual tests with this adapter or end-to-end tests by connecting to other adapters.
Initialization Parameters
Initialization
Parameters
-
DbType: indicates the provider or type of database to which we want to connect.
-
-
- DB2
- DB2/400
- Oracle
- MySql
- PostGres_SQL
- GoogleBigQuery
- SQL_Server
-
-
Host: represents the IP address or the machine's DNS name where the database resides.
-
Port: the port number that listens for incoming connections to the database.
-
Ssl: when we check the checkbox, the security protocol is activated.
-
DbName: name of the instance or database service.
-
User: user name.
-
Password: user password.
Functions
-
connect_DB(): tries to connect to the configured database. Returns true if it succeeds or false otherwise. On the properties of the object in the Database Adaptor there are some parameter boxes to do the configuration about the Database we are going to use. There will be, once the function is executed, a log with different messages if the connection was a succeed or not.
-
dBExecuteStatement(Statement): executes the SQL that it's contain in the parameter (statement). Allows the user to modify the data in the destination database. This function allows you to write SQL statements like Insert, Delete, Update and Merge in the statement parameter. The function will replace the variables for their values in the execution time, that will return a TastInteger with the number of rows that were changed.
(-
Input parameter:
Thethe sentence for example:” INSERT INTO x (a, b, c) VALUES (d, e, f)” -
Output parameter:
Integerinteger with theresults).
-
-
dBExecuteStatementFromFile: executes the statements found in the file whose path is defined in the PathToFileWithStatements parameter.
-
dBGetQueryData(Query): executes the SQL Select statement contained in the Query parameter, and returns the results as a TastTableData variable to the executor, which allows access and work with the data in later steps of the diagram. The Query parameter contains the Select statement to execute in the database. It is possible to use variables created in the diagram within the Query parameter, the function will substitute the variables for their values at run time.
(-
Input
parameterparameter:(Query),Query -
Output
parameterparameter:(OutputTable)).
-
-
disconnect_DB(): tries to disconnect from the database. Returns true if it succeeds or false otherwise. (As the function connect_DB this function returns an error message if the disconnection fails otherwise returns a succeed message).
-
getNumColumns(): returns the number of columns contained in the TastTableData that was generated by the execution of the dBGetQueryData function. It requires the execution of the dBGetQueryData function in previous steps of the diagram. (Don’t need an input parameter, so it’s a function that just return the number of columns of the selected table (with TastTableData)).
-
getNumRows(): returns the number of rows contained in the TastTableData that was generated by the execution of the dBGetQueryData function. It requires the execution of the dBGetQueryData function in previous steps of the diagram. (Don’t need an input parameter, so it’s a function that just return the number of rows of the selected table (with TastTableData)).
-
getTableValue(RowNum, ColNum): returns the value contained in the cell indicated by the parameters Row and Col. It requires the execution of the dBGetQueryData function in previous steps of the diagram.
(-
Input parameters are the row and the column you need to display, and the
output -
Output should be the information contained
there).
-