Skip to content

Adapter - MySQL

This page describes version 2.0.2 of the adapter.

Overview

The MySQL adapter uses a connection string to connect to the desired MySQL Database upon the implementation of each available adapter command. The adapter allows for selecting data from the database, making updates, inserts, and deletions, as well as calling existing stored procedures.



Properties

Name Display Is Required Comments Type Default Value Maximum Value Minimum Value Maximum Length Minimum Length
connectionString MySQL Database Connection String True The connection string used to connect to the MySQL database. string 2048 1

Configuration

The configuration of the adapter only requires the input of a supported database connection string. Refer to MySQL documentation for more details.



Commands

MySQL Command (mySqlCommand)

Adapter command for submitting custom written MySQL updates, inserts and deletes to the database.

Request Properties

Name Display Description Is Required Type
rawMySqlCommand MySQL Command The MySQL command to be run against the database. To prevent SQL Injection attacks, all operators in the command should be followed by a unique parameter assignment signified by @ to be replaced by the Parameter Values. ie. Select columnName from table WHERE columnName = <@parameter1> OR columnName = <@parameter2> OR columnName IS NULL. Null values need not be parameterized. True string
parameter Parameters Parameters to be used in the MySQL Command. False array
parameter[0].name Parameter Name The name of the Parameter to be replaced by its Value within the MySQL Database. This name must match the value used in the MySQL Command. True string
parameter[0].value Parameter Value The value to be used in place of the parameter during execution within MySQL Database. True string

Response Properties

Name Description Type
status Status of the adapter command. string
recordsAffected The number of records reported affected by the MySQL Command. string
code Error code if there is one. string
error The error message if there is one. string

MySQL SELECT (mySqlSelect)

Adapter command for submitting custom written MySQL SELECT statements to the database.

Request Properties

Name Display Description Is Required Type
rawMySqlSelect MySQL SELECT statement The MySQL SELECT statement to be run against the database. To prevent SQL Injection attacks, all operators in the command should be followed by a unique parameter assignment signified by '@' to be replaced by the Parameter Values. ie. Select columnName from table WHERE columnName = @parameter1 OR columnName = @parameter2 OR columnName IS NULL. Null values need not be parameterized. True string
parameter Parameters Parameters to be used in the MySQL SELECT Command False array
parameter[0].name Parameter Name The name of the Parameter to be replaced by its corresponding Parameter Value within the MySQL Database. This name must match the value used in the MySQL SELECT Command. True string
parameter[0].value Parameter Value The value to be used in place of the parameter during execution within MySQL Database. True string
rows Rows Returned The number of rows to return. If left blank, the first 100 rows will be returned. To return more, specify a number up to 500. False string

Response Properties

Name Description Type
row Array of rows of data returned by the MySQL database. Returned in the form of row[1].column1: value, row[1].column2:value, etc. array
status Status of the adapter command. string
code Error code if there is one. string
error The error message if there is one. string

MySQL SELECT Scalar (mySqlSelectScalar)

Adapter command for submitting custom written MySQL SELECT statements to the database when a single value is wanted or expected. Only the value of the first column of the first record is returned from the database.

Request Properties

Name Display Description Is Required Type
rawMySqlSelect MySQL SELECT Statement The MySQL command to be run against the database. To prevent SQL Injection attacks, all operators in the command should be followed by a unique parameter assignment signified by @ to be replaced by the Parameter Values. ie. Select columnName from table WHERE columnName = <@parameter1> OR columnName = <@parameter2> OR columnName IS NULL. Null values need not be parameterized. True string
parameter Parameters Parameters to be used in the MySQL Command False array
parameter[0].name Parameter Name The name of the Parameter to be replaced by its Value within the MySQL Database. This name must match the value used in the MySQL Command. True string
parameter[0].value Parameter Value The value used in place of the parameter during the execution within MySQL Database. True string

Response Properties

Name Description Type
status Status of the adapter command. string
value Scalar value returned from MySQL Database. string
code Error code if there is one. string
error The error message if there is one. string

Execute Stored Procedure (storedProcedure)

Used to call an existing stored procedure.

Request Properties

Name Display Description Is Required Type
storedProcedure Stored Procedure The name of the stored procedure that will be called from the connected database. True string
parameter Parameters Parameters to be used in the MySQL Stored Procedure. False array
parameter[0].name Parameter Name The name of the Parameter to be replaced by its Value within the MySQL Database. This name must match the value used in the MySQL Command. True string
parameter[0].value Parameter Value The name of the Value used to replace the Parameter within the MySQL Database True string
column Columns to Return Used to specify the order and which columns to return from the Stored Procedure. If not used, all columns returned by the Stored Procedure will be returned and in the order returned from the MySQL Database. False array
column[0].name Column Name The name of the Column(s) to be returned by the Stored Procedure. True string

Response Properties

Name Description Type
row Array of rows of data returned by the MySQL database. Returned in the form of row[1].column1: value, row[1].column2:value, etc. array
status Status of the adapter command. string
recordsAffected The number of records reported affected by the Stored Procedure. string
code Error code if there is one. string
error The error message if there is one. string

Release History

Version Type Description Tracking # Date
2.0.1 Initial First release in the Adapter Type store. NAP-23784 2023-09-19
2.0.2 Maintenance Updated third-party components and improved maintainability. NAP-27635 2024-07-31

Categories