Functions of ballerina.lang.datatables package
function close(datatable dt)
Releases the database connection.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
function getArray(datatable dt, any key) (map )
Retrieves arrays values of a given column index.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
key | any | dt: The datatable object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
map | map): The column value as map |
function getBoolean(datatable dt, any column) (boolean )
Retrieves the Boolean value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
column | any | The column position of the result as index or name |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
boolean | The column value as a Boolean |
function getFloat(datatable dt, any column) (float )
Retrieves the float value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
column | any | The column position of the result as index or name |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The column value as a float |
function getInt(datatable dt, any column) (int )
Retrieves the integer value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
column | any | The column position of the result as index or name |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | The column value as an integer |
function getIntWithType(datatable dt, any column, string type) (int )
Retrieves the int value of the designated column in the current row for the given column type: date, time, or timestamp
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
column | any | The column position of the result as index or name |
type | string | Database table column type. Supported values are date, time, timestamp |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | The column value as a int |
function getString(datatable dt, any column) (string )
Retrieves the string value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
column | any | The column position of the result as index or name |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The column value as a string |
function getStringWithType(datatable dt, any column, string type) (string )
Retrieves the base64encoded string value of the designated column in the current row for the given column type: blob, clob, nclob, or binary
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
column | any | The column position of the result as index or name |
type | string | Database table column type. Supported values are blob, clob, nclob, binary. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The column value as a string |
function getValueAsString(datatable dt, any column) (string )
Retrieves the string value of the designated column in the current row. The value of type blob and binary columns will return as a Base64Encoded string.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
column | any | The column position of the result as index or name |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The column value as a string |
function hasNext(datatable dt) (boolean )
Checks for a new row in the given datatable. If a new row is found, moves the cursor to it.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
boolean | True if there is a new row; false otherwise |
function next(datatable dt) (any )
Retrives the current row and return a struct with the data in the columns
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
any | The resulting row as a struct |
function toJson(datatable dt) (json )
Outputs the dataset in JSON format as a stream.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
json | The resulting dataset in JSON format |
function toXml(datatable dt, string rootWrapper, string rowWrapper) (xml )
Outputs the dataset in XML format as a stream. This function will add 'results' and 'result' if the root wrapper and row wrapper elements are not provided.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
rootWrapper | string | The root wrapper element |
rowWrapper | string | The row wrapper element |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
xml | The resulting dataset in XML format with given root wrapper and row wrapper. The default will be results and result if the wrapper isn't provided. |