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, int index) (map )
Retrieves arrays values of a given column index.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
index | int |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
map | map): The column value as map |
function getArray(datatable dt, string name) (map )
Retrieves arrays values of a given column name.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
name | string |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
map | map): The column value as map |
function getBoolean(datatable dt, int index) (boolean )
Retrieves the Boolean value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
index | int | The column index position of the result. The first column is 1, the second is 2, etc. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
boolean | The column value as a Boolean |
function getBoolean(datatable dt, string name) (boolean )
Retrieves the Boolean value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
name | string | The column name of the output result. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
boolean | The column value as a Boolean |
function getDouble(datatable dt, int index) (double )
Retrieves the double value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
index | int | The column index position of the result. The first column is 1, the second is 2, etc. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
double | The column value as a double |
function getDouble(datatable dt, string name) (double )
Retrieves the double value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
name | string | The column name of the output result. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
double | The column value as a double |
function getFloat(datatable dt, int index) (float )
Retrieves the float value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
index | int | The column index position of the result. The first column is 1, the second is 2, etc. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The column value as a float |
function getFloat(datatable dt, string name) (float )
Retrieves the float value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
name | string | The column name of the output result. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The column value as a float |
function getInt(datatable dt, int index) (int )
Retrieves the integer value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
index | int | The column index position of the result. The first column is 1, the second is 2, etc. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | The column value as an integer |
function getInt(datatable dt, string name) (int )
Retrieves the integer value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
name | string | The column name of the output result. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | The column value as an integer |
function getLong(datatable dt, int index, string type) (long )
Retrieves the long 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 |
index | int | The column index position of the result. The first column is 1, the second is 2, etc. |
type | string | Database table column type. Supported values are date, time, timestamp |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
long | The column value as a long |
function getLong(datatable dt, string column, string type) (long )
Retrieves the long 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 | string | dt: The datatable object |
type | string | Database table column type. Supported values are date, time, timestamp |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
long | The column value as a long |
function getLong(datatable dt, int index) (long )
Retrieves the long value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
index | int | The column index position of the result. The first column is 1, the second is 2, etc. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
long | The column value as a long |
function getLong(datatable dt, string name) (long )
Retrieves the long value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
name | string | The column name of the output result. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
long | The column value as a long |
function getString(datatable dt, int index, 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 |
index | int | The column index position of the result. The first column is 1, the second is 2, etc. |
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 getString(datatable dt, string 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 | string | dt: The datatable object |
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 getString(datatable dt, int index) (string )
Retrieves the string value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
index | int | The column index position of the result. The first column is 1, the second is 2, etc. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The column value as a string |
function getString(datatable dt, string name) (string )
Retrieves the string value of the designated column in the current row
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
dt | datatable | The datatable object |
name | string | The column name of the output result. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The column value as a string |
function getValueAsString(datatable dt, int index) (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 |
index | int | The column index position of the result. The first column is 1, the second is 2, etc. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The column value as a string |
function getValueAsString(datatable dt, string name) (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 |
name | string | The column name of the output result. |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The column value as a string |
function next(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 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. |