Abstract Object
-
sql
:
Client
Represents a SQL client.
Methods
Queries the database with the query provided by the user, and returns the result as stream.
Executes the DDL or DML sql query provided by the user, and returns summary of the execution.
Executes a batch of parameterized DDL or DML sql query provided by the user, and returns the summary of the execution.
Executes a SQL stored procedure and returns the result as stream and execution summary.
Close the SQL client.
Queries the database with the query provided by the user, and returns the result as stream.
Parameters
- sqlQuery string | ParameterizedQuery
-
The query which needs to be executed as
stringorParameterizedQuerywhen the SQL query has params to be passed in
- rowType typedesc? (default ())
-
The
typedescof the record that should be returned as a result. If this is not provided the default column names of the query result set be used for the record attributes
-
Return Type
(stream<record {} ,Error>) Stream of records in the type of
rowType
Executes the DDL or DML sql query provided by the user, and returns summary of the execution.
Parameters
- sqlQuery string | ParameterizedQuery
-
The DDL or DML query such as INSERT, DELETE, UPDATE, etc as
stringorParameterizedQuerywhen the query has params to be passed in
-
Return Type
(ExecutionResult | Error) Summary of the sql update query as
ExecutionResultor anErrorif any error occurred when executing the query
Executes a batch of parameterized DDL or DML sql query provided by the user, and returns the summary of the execution.
Parameters
- sqlQueries ParameterizedQuery[]
-
The DDL or DML query such as INSERT, DELETE, UPDATE, etc as
ParameterizedQuerywith an array of values passed in
-
Return Type
(ExecutionResult[] | Error) Summary of the executed SQL queries as
ExecutionResult[]which includes details such asaffectedRowCountandlastInsertId. If one of the commands in the batch fails, this function will returnBatchExecuteError, however the 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 error can be accessed as(<sql:BatchExecuteError> result).detail()?.executionResults.
call
(string | ParameterizedCallQuery sqlQuery, typedesc[] rowTypes)
returns ProcedureCallResult | ErrorExecutes a SQL stored procedure and returns the result as stream and execution summary.
Parameters
- sqlQuery string | ParameterizedCallQuery
-
The query to execute the SQL stored procedure
- rowTypes typedesc[] (default [])
-
The array of
typedescof the records that should be returned as a result. If this is not provided the default column names of the query result set be used for the record attributes.
-
Return Type
(ProcedureCallResult | Error) Summary of the execution is returned in
ProcedureCallResultorsql:Error