azure.mysql
Module azure.mysql
ballerinax/azure.mysql Ballerina library
This package does not have any public APIs.
Clients
azure.mysql: Client
Represents a MySQL database client.
Constructor
Initializes the MySQL Client.
init (string host, string? user, string? password, string? database, int port, Options? options, ConnectionPool? connectionPool)
- host string "localhost" - Hostname of the MySQL server to be connected
- user string? () - If the MySQL server is secured, the username to be used to connect to the MySQL server
- password string? () - The password of the provided username of the database
- database string? () - The name fo the database to be connected
- port int 3306 - Port number of the MySQL server to be connected
- options Options? () - The database-specific JDBC client properties
- connectionPool ConnectionPool? () - The
sql:ConnectionPool
object to be used within the JDBC client. If there is noconnectionPool
provided, the global connection pool will be used and it will be shared by other clients, which have the same properties
query
function query(string|ParameterizedQuery sqlQuery, typedesc<record {}>? rowType) returns stream<record {}, Error>
Queries the database with the provided query and returns the result as a stream.
Parameters
- sqlQuery string|ParameterizedQuery - The query, which needs to be executed as a
string
or ansql:ParameterizedQuery
when the SQL query has params to be passed in
- rowType typedesc<record {}>? (default ()) - The
typedesc
of the record that should be returned as a result. If this is not provided, the default column names of the query result set will be used for the record attributes
Return Type
execute
function execute(string|ParameterizedQuery sqlQuery) returns ExecutionResult|Error
Executes the provided DDL or DML SQL queries and returns a summary of the execution.
Parameters
- sqlQuery string|ParameterizedQuery - The DDL or DML queries such as
INSERT
,DELETE
,UPDATE
, etc. as astring
or ansql:ParameterizedQuery
when the query has params to be passed in
Return Type
- ExecutionResult|Error - Summary of the SQL update query as an
sql:ExecutionResult
orsql:Error
if any error occurred when executing the query
batchExecute
function batchExecute(ParameterizedQuery[] sqlQueries) returns ExecutionResult[]|Error
Executes a batch of parameterized DDL or DML SQL queries provided and returns the summary of the execution.
Parameters
- sqlQueries ParameterizedQuery[] - The DDL or DML queries such as
INSERT
,DELETE
,UPDATE
, etc. as ansql:ParameterizedQuery
with an array of values passed in
Return Type
- ExecutionResult[]|Error - Summary of the executed SQL queries as an
sql:ExecutionResult[]
, which includes details such as theaffectedRowCount
andlastInsertId
. If one of the commands in the batch fails, this function will return ansql:BatchExecuteError
. However, the JDBC driver may or may not continue to process the remaining commands in the batch after a failure. The summary of the executed queries in case of an error can be accessed as(<sql:BatchExecuteError> result).detail()?.executionResults
call
function call(string|ParameterizedCallQuery sqlQuery, typedesc<record {}>[] rowTypes) returns ProcedureCallResult|Error
Executes a SQL stored procedure and returns the result as a stream with an execution summary.
Parameters
- sqlQuery string|ParameterizedCallQuery - The query to execute the SQL stored procedure
- rowTypes typedesc<record {}>[] (default []) - The array of
typedesc
of the records that should be returned as a result. If this is not provided, the default column names of the query result set will be used for the record attributes
Return Type
- ProcedureCallResult|Error - Summary of the execution is returned in an
sql:ProcedureCallResult
orsql:Error
close
function close() returns Error?
Close the SQL client.
Return Type
- Error? - Possible error during the closure of the client
Import
import ballerinax/azure.mysql;
Metadata
Released date: almost 3 years ago
Version: 0.1.0
License: Apache-2.0
Compatibility
Platform: java11
Ballerina version: slalpha5
Pull count
Total: 741
Current verison: 197
Weekly downloads
Keywords
Azure
MySQL
Contributors
Other versions
0.1.0
Dependencies