Connectors of ballerina.data.sql package
connector ClientConnector (string dbType, string hostOrPath, int port, string dbName, string username, string password, ConnectionProperties options)
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dbType | string | |
hostOrPath | string | |
port | int | |
dbName | string | |
username | string | |
password | string | |
options | ConnectionProperties |
action batchUpdate(string query, Parameter[][] parameters)
The batchUpdate action implementation for SQL connector to batch data insert.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
query | string | SQL query to execute |
parameters | Parameter[][] | Parameter array used with the SQL query |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int[] | int[]: Array of update counts |
action call(string query, Parameter[] parameters)
The call action implementation for SQL connector to invoke stored procedures/functions.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
query | string | SQL query to execute |
parameters | Parameter[] | Parameter array used with the SQL query |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
datatable | datatable: Result set for the given query |
action close()
The close action implementation for SQL connector to shutdown the connection pool.
Parameters:
Parameter Name | Data Type | Description |
---|
action select(string query, Parameter[] parameters)
The select action implementation for SQL connector to select data from tables.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
query | string | SQL query to execute |
parameters | Parameter[] | Parameter array used with the SQL query |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
datatable | datatable: Result set for the given query |
action update(string query, Parameter[] parameters)
The update action implementation for SQL connector to update data and schema of the database.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
query | string | SQL query to execute |
parameters | Parameter[] | Parameter array used with the SQL query |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: Updated row count |
action updateWithGeneratedKeys(string query, Parameter[] parameters, string[] keyColumns)
The updateWithGeneratedKeys action implementation for SQL connector which returns the auto generated keys during the update action.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
query | string | SQL query to execute |
parameters | Parameter[] | Parameter array used with the SQL query |
keyColumns | string[] | Names of auto generated columns for which the auto generated key values are returned |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: Updated row count during the query exectuion | |
string[] | int: Updated row count during the query exectuion |
Structs of ballerina.data.sql package
struct ConnectionProperties
Fields:
Field Name | Data Type | Description |
---|---|---|
url | string | Platform independent DB access URL |
dataSourceClassName | string | Name of the DataSource class provided by the JDBC driver |
connectionTestQuery | string | Query that will be executed to validate that the connection to the database is still alive |
poolName | string | User-defined name for the connection pool and appears mainly in logging |
catalog | string | Catalog of connections created by this pool |
connectionInitSql | string | SQL statement that will be executed after every new connection creation before adding it to the pool |
driverClassName | string | Fully qualified Java class name of the JDBC driver to be used |
transactionIsolation | string | Transaction isolation level of connections returned from the pool. The supported values are TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ and TRANSACTION_SERIALIZABLE |
autoCommit | boolean | Auto-commit behavior of connections returned from the pool |
isolateInternalQueries | boolean | Determines whether HikariCP isolates internal pool queries, such as the connection alive test, in their own transaction |
allowPoolSuspension | boolean | Whether the pool can be suspended and resumed through JMX |
readOnly | boolean | Whether Connections obtained from the pool are in read-only mode by default |
isXA | boolean | Whether Connections are used for a distributed transaction |
maximumPoolSize | int | Maximum size that the pool is allowed to reach, including both idle and in-use connections |
connectionTimeout | int | Maximum number of milliseconds that a client will wait for a connection from the pool |
idleTimeout | int | Maximum amount of time that a connection is allowed to sit idle in the pool |
minimumIdle | int | Minimum number of idle connections that pool tries to maintain in the pool |
maxLifetime | int | Maximum lifetime of a connection in the pool |
validationTimeout | int | Maximum amount of time that a connection will be tested for aliveness |
leakDetectionThreshold | int | Amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak |
datasourceProperties | map | Data source specific properties which are used along with the dataSourceClassName |
struct Parameter
Fields:
Field Name | Data Type | Description |
---|---|---|
sqlType | string | The data type of the corresponding SQL parameter |
value | any | Value of paramter pass into the SQL query |
direction | int | Direction of the SQL Parameter 0 - IN, 1- OUT, 2 - INOUT |