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
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 ornil
if the response was successful
Methods
- luasql.exasol.exasolwebsocket:_create(websocket) line 17
-
Creates a new Exasol websocket.
Parameters:
- websocket luasql.exasol.Websocket the websocket to wrap
Returns:
-
luasql.exasol.ExasolWebsocket
the new websocket
- luasql.exasol.exasolwebsocket:connect(url, connection_properties) line 29
-
Connects to an Exasol database.
Parameters:
- url
string
the websocket URL, e.g.
wss://exasoldb.example.com:8563
- connection_properties luasql.exasol.ConnectionProperties the connection properties
Returns:
-
luasql.exasol.ExasolWebsocket
the new websocket
- url
string
the websocket URL, e.g.
- 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:
- luasql.exasol.exasolwebsocket:send_login_credentials(username, encrypted_password) line 54
-
Sends the login credentials.
See Exasol API documentation for the
login
command.Parameters:
- username string the username
- encrypted_password string the password encrypted with the public key returned by luasql.exasol.ExasolWebsocket:send_login_command
Returns:
- 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:
- 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, useconstants.NULL
ornil
. Both will be translated tonull
in the JSON command. See Exasol API documentation for thesetAttributes
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 - attribute_name
string
the name of the attribute to set, e.g.
- 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:
- 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, elsetrue
. Default isfalse
.
Returns:
- luasql.exasol.exasolwebsocket:close() line 185
-
Closes the websocket.
Returns:
-
boolean
true
if the operation was successful