Module
cdata
Modules
Module cdata
rolandhewage/cdata
0.1.0
Functions
handleProperties
Isolated Function
Clients
cdata: Client
CData Client connector.
query
Isolated FunctionRemote Function
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
Isolated FunctionRemote Function
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
Isolated FunctionRemote Function
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
Isolated FunctionRemote Function
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
Isolated Function
function close() returns Error?
Records
cdata: CdataConfig
CData configuration.
Fields
- jdbcUrl string - The JDBC URL of the database
- 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
- options Options? - The database-specific JDBC client properties
Import
import rolandhewage/cdata;
Metadata
Released date: almost 4 years ago
Version: 0.1.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: slalpha5
GraalVM compatible: Yes
Pull count
Total: 3
Current verison: 3
Weekly downloads
Keywords
CData
Jira
Contributors
Other versions
0.1.0
Dependencies
See more...