Class luasql.exasol.ExasolWebsocket

This internal class represents a websocket connection to an Exasol database that provides convenient functions for sending commands and evaluating the result.

Local Functions

luasql.exasol.exasolwebsocket.get_response_error(response) Extract the error from the given database response.

Methods

luasql.exasol.exasolwebsocket:_create(websocket) Creates a new Exasol websocket.
luasql.exasol.exasolwebsocket:connect(url, connection_properties) Connects to an Exasol database.
luasql.exasol.exasolwebsocket:send_login_command() Sends the login command.
luasql.exasol.exasolwebsocket:send_login_credentials(username, encrypted_password) Sends the login credentials.
luasql.exasol.exasolwebsocket:send_disconnect() Sends the disconnect command.
luasql.exasol.exasolwebsocket:send_execute(statement) Sends the execute command.
luasql.exasol.exasolwebsocket:send_set_attribute(attribute_name, attribute_value) Sends the setAttribute command with a given attribute name and value.
luasql.exasol.exasolwebsocket:send_fetch(result_set_handle, start_position, num_bytes) Sends the fetch command.
luasql.exasol.exasolwebsocket:send_close_result_set(result_set_handle) Sends the closeResultSet command.
luasql.exasol.exasolwebsocket:_send_json(payload, ignore_response) Send the given payload serialized to JSON to the database and optionally wait for the response and deserialize it from JSON.
luasql.exasol.exasolwebsocket:close() Closes the websocket.


Local Functions

Methods
luasql.exasol.exasolwebsocket.get_response_error(response) line 129
Extract the error from the given database response.

Parameters:

  • response table the response from the database

Returns:

    nil or table nil the error that occurred or nil if the response was successful

Methods

luasql.exasol.exasolwebsocket:_create(websocket) line 17
Creates a new Exasol websocket.

Parameters:

Returns:

    luasql.exasol.ExasolWebsocket the new websocket
luasql.exasol.exasolwebsocket:connect(url, connection_properties) line 29
Connects to an Exasol database.

Parameters:

Returns:

    luasql.exasol.ExasolWebsocket the new websocket
luasql.exasol.exasolwebsocket:send_login_command() line 41
Sends the login command. See Exasol API documentation for the login command. This returns a public RSA key used for encrypting the password before sending it with the luasql.exasol.ExasolWebsocket:send_login_credentials method.

Returns:

  1. table or nil the public RSA key or nil if an error occurred
  2. table or nil nil if the operation was successful, otherwise the error that occurred
luasql.exasol.exasolwebsocket:send_login_credentials(username, encrypted_password) line 54
Sends the login credentials. See Exasol API documentation for the login command.

Parameters:

Returns:

  1. table or nil response data from the database or nil if an error occurred
  2. table or nil nil if the operation was successful, otherwise the error that occurred
luasql.exasol.exasolwebsocket:send_disconnect() line 63
Sends the disconnect command. See Exasol API documentation for the disconnect command.

Returns:

    table or nil nil if the operation was successful, otherwise the error that occurred
luasql.exasol.exasolwebsocket:send_execute(statement) line 75
Sends the execute command. See Exasol API documentation for the execute command.

Parameters:

  • statement string the SQL statement to execute

Returns:

  1. table or nil the result set response data from the database or nil if an error occurred
  2. table or nil nil if the operation was successful, otherwise the error that occurred
luasql.exasol.exasolwebsocket:send_set_attribute(attribute_name, attribute_value) line 88
Sends the setAttribute command with a given attribute name and value. To set the null value for an attribute, use constants.NULL or nil. Both will be translated to null in the JSON command. See Exasol API documentation for the setAttributes command.

Parameters:

  • attribute_name string the name of the attribute to set, e.g. "autocommit"
  • attribute_value string, number, boolean or nil the value of the attribute to set, e.g. false

Returns:

    table or nil nil if the operation was successful, otherwise the error that occurred
luasql.exasol.exasolwebsocket:send_fetch(result_set_handle, start_position, num_bytes) line 104
Sends the fetch command. See Exasol API documentation for the fetch command.

Parameters:

  • result_set_handle number result set handle
  • start_position number row offset (0-based) from which to begin data retrieval
  • num_bytes number number of bytes to retrieve (max: 64MiB)

Returns:

  1. table or nil result set from the database or nil if an error occurred
  2. table or nil nil if the operation was successful, otherwise the error that occurred
luasql.exasol.exasolwebsocket:send_close_result_set(result_set_handle) line 120
Sends the closeResultSet command. See Exasol API documentation for the closeResultSet command.

Parameters:

  • result_set_handle number result set handle to close

Returns:

    table or nil nil if the operation was successful, otherwise the error that occurred
luasql.exasol.exasolwebsocket:_send_json(payload, ignore_response) line 151
Send the given payload serialized to JSON to the database and optionally wait for the response and deserialize it from JSON.

Parameters:

  • payload table the payload to send
  • ignore_response boolean or nil false if we expect a response, else true. Default is false.

Returns:

  1. table or nil the received response or nil if ignore_response was true or an error occurred
  2. table or nil nil if the operation was successful, otherwise the error that occurred
luasql.exasol.exasolwebsocket:close() line 185
Closes the websocket.

Returns:

    boolean true if the operation was successful
generated by LDoc 1.5.0 Last updated 2025-03-06 11:54:17