Ballerina API Documentation

Functions of ballerina.lang.datatables package

function close(datatable dt)

Releases the database connection.

Parameters:

Parameter NameData TypeDescription
dtdatatableThe datatable object

function getArray(datatable dt, any key) (map )

Retrieves arrays values of a given column index.

Parameters:

Parameter NameData TypeDescription
dtdatatableThe datatable object
keyanydt: The datatable object

Return Parameters:

Return VariableData TypeDescription
mapmap): 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 NameData TypeDescription
dtdatatableThe datatable object
columnanyThe column position of the result as index or name

Return Parameters:

Return VariableData TypeDescription
booleanThe 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 NameData TypeDescription
dtdatatableThe datatable object
columnanyThe column position of the result as index or name

Return Parameters:

Return VariableData TypeDescription
floatThe 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 NameData TypeDescription
dtdatatableThe datatable object
columnanyThe column position of the result as index or name

Return Parameters:

Return VariableData TypeDescription
intThe 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 NameData TypeDescription
dtdatatableThe datatable object
columnanyThe column position of the result as index or name
typestringDatabase table column type. Supported values are date, time, timestamp

Return Parameters:

Return VariableData TypeDescription
intThe 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 NameData TypeDescription
dtdatatableThe datatable object
columnanyThe column position of the result as index or name

Return Parameters:

Return VariableData TypeDescription
stringThe 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 NameData TypeDescription
dtdatatableThe datatable object
columnanyThe column position of the result as index or name
typestringDatabase table column type. Supported values are blob, clob, nclob, binary.

Return Parameters:

Return VariableData TypeDescription
stringThe 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 NameData TypeDescription
dtdatatableThe datatable object
columnanyThe column position of the result as index or name

Return Parameters:

Return VariableData TypeDescription
stringThe 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 NameData TypeDescription
dtdatatableThe datatable object

Return Parameters:

Return VariableData TypeDescription
booleanTrue 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 NameData TypeDescription
dtdatatableThe datatable object

Return Parameters:

Return VariableData TypeDescription
anyThe resulting row as a struct

function toJson(datatable dt) (json )

Outputs the dataset in JSON format as a stream.

Parameters:

Parameter NameData TypeDescription
dtdatatableThe datatable object

Return Parameters:

Return VariableData TypeDescription
jsonThe 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 NameData TypeDescription
dtdatatableThe datatable object
rootWrapperstringThe root wrapper element
rowWrapperstringThe row wrapper element

Return Parameters:

Return VariableData TypeDescription
xmlThe 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.


Menu

  • Functions
    • close(datatable dt)
    • getArray(datatable dt, any key) (map )
    • getBoolean(datatable dt, any column) (boolean )
    • getFloat(datatable dt, any column) (float )
    • getInt(datatable dt, any column) (int )
    • getIntWithType(datatable dt, any column, string type) (int )
    • getString(datatable dt, any column) (string )
    • getStringWithType(datatable dt, any column, string type) (string )
    • getValueAsString(datatable dt, any column) (string )
    • hasNext(datatable dt) (boolean )
    • next(datatable dt) (any )
    • toJson(datatable dt) (json )
    • toXml(datatable dt, string rootWrapper, string rowWrapper) (xml )

Copyright 2017 Ballerina API Documentation