ballerina/sql package
Primitives Summary
Type | Description |
---|
Type Definitions
Type | Values | Description |
---|---|---|
Direction | OUT | INOUT | IN |
|
Param | ||
SQLType | VARCHAR | VARBINARY | TINYINT | TIMESTAMP | TIME | STRUCT | SMALLINT | REFCURSOR | REAL | NVARCHAR | NUMERIC | NCLOB | NCHAR | LONGVARCHAR | LONGVARBINARY | LONGNVARCHAR | INTEGER | FLOAT | DOUBLE | DECIMAL | DATETIME | DATE | CLOB | CHAR | BOOLEAN | BLOB | BIT | BINARY | BIGINT | ARRAY |
|
Annotations
Name | Attachement Points | Data Type | Description |
---|
Objects Summary
Object | Description |
---|---|
Parameter |
|
PoolOptions |
|
Endpoints Summary
Endpoint | Description |
---|
Functions Summary
Return Type | Function and Description |
---|---|
close(CallerActions callerActions)
|
Global Variables
Name | Data Type | Description |
---|---|---|
DIRECTION_IN | Direction | |
DIRECTION_INOUT | Direction | |
DIRECTION_OUT | Direction | |
TYPE_ARRAY | SQLType | |
TYPE_BIGINT | SQLType | |
TYPE_BINARY | SQLType | |
TYPE_BIT | SQLType | |
TYPE_BLOB | SQLType | |
TYPE_BOOLEAN | SQLType | |
TYPE_CHAR | SQLType | |
TYPE_CLOB | SQLType | |
TYPE_DATE | SQLType | |
TYPE_DATETIME | SQLType | |
TYPE_DECIMAL | SQLType | |
TYPE_DOUBLE | SQLType | |
TYPE_FLOAT | SQLType | |
TYPE_INTEGER | SQLType | |
TYPE_LONGNVARCHAR | SQLType | |
TYPE_LONGVARBINARY | SQLType | |
TYPE_LONGVARCHAR | SQLType | |
TYPE_NCHAR | SQLType | |
TYPE_NCLOB | SQLType | |
TYPE_NUMERIC | SQLType | |
TYPE_NVARCHARR | SQLType | |
TYPE_REAL | SQLType | |
TYPE_REFCURSOR | SQLType | |
TYPE_SMALLINT | SQLType | |
TYPE_STRUCT | SQLType | |
TYPE_TIME | SQLType | |
TYPE_TIMESTAMP | SQLType | |
TYPE_TINYINT | SQLType | |
TYPE_VARBINARY | SQLType | |
TYPE_VARCHAR | SQLType |
public object Parameter
CallParam represents a parameter for the SQL call action where OUT or INOUT parameter is required.
Field Name | Data Type | Default Value | Description |
---|---|---|---|
sqlType | SQLType |
|
|
value | any |
|
|
direction | Direction |
|
|
recordType | typedesc |
|
public object PoolOptions
Represents the properties which are used to configure DB connection pool.
Field Name | Data Type | Default Value | Description |
---|---|---|---|
connectionInitSql | string |
|
|
dataSourceClassName | string |
|
|
autoCommit | boolean | true |
|
isXA | boolean | false |
|
maximumPoolSize | int | -1 |
|
connectionTimeout | int | -1 |
|
idleTimeout | int | -1 |
|
minimumIdle | int | -1 |
|
maxLifetime | int | -1 |
|
validationTimeout | int | -1 |
|
public function close(CallerActions callerActions)
The close action implementation for SQL connector to shutdown the connection pool.
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
callerActions | CallerActions |
public type CallerActions object
The Caller actions for SQL databases.
-
<CallerActions> call(string sqlQuery, typedesc[] recordType) returns (table[] | error)
The call action implementation for SQL connector to invoke stored procedures/functions.
Parameter Name Data Type Default Value Description sqlQuery string - SQL statement to execute.
recordType typedesc[] - Array of record types of the returned tables if there is any.
Return Type Description table[] | error table[]
if there are tables returned by the call action and else nill,error
will be returned if there is any error.
-
<CallerActions> select(string sqlQuery, typedesc recordType) returns (table | error)
The select action implementation for SQL connector to select data from tables.
Parameter Name Data Type Default Value Description sqlQuery string - SQL query to execute.
recordType typedesc - Type of the returned table.
Return Type Description table | error table
table returned by the sql query statement elseerror
will be returned if there is any error.
-
<CallerActions> update(string sqlQuery) returns (int | error)
The update action implementation for SQL connector to update data and schema of the database.
Parameter Name Data Type Default Value Description sqlQuery string - SQL statement to execute.
Return Type Description int | error int
number of rows updated by the statement and elseerror
will be returned if there is any error.
-
<CallerActions> batchUpdate(string sqlQuery) returns (int[] | error)
The batchUpdate action implementation for SQL connector to batch data insert.
Parameter Name Data Type Default Value Description sqlQuery string - SQL statement to execute.
Return Type Description int[] | error int[]
An array of updated row count by each of statements in batch and elseerror
will be returned if there is any error.
-
<CallerActions> updateWithGeneratedKeys(string sqlQuery, string[] keyColumns) returns ((int,string[]) | error)
The updateWithGeneratedKeys action implementation for SQL connector which returns the auto generated keys during the update action.
Parameter Name Data Type Default Value Description sqlQuery string - SQL statement to execute.
keyColumns string[] - Names of auto generated columns for which the auto generated key values are returned.
Return Type Description (int,string[]) | error - A
Tuple
will be returned and would represent updated row count during the query exectuion, aray of auto generated key values during the query execution, in order. Elseerror
will be returned if there is any error.
-
<CallerActions> getProxyTable(string tableName, typedesc recordType) returns (table | error)
The getProxyTable action implementation for SQL connector which acts as a proxy for a database table that allows performing select/update operations over the actual database table.
Parameter Name Data Type Default Value Description tableName string - The name of the table to be retrieved.
recordType typedesc - The record type of the returned table.
Return Type Description table | error