Class luasql.exasol.Connection
This class represents a database connection.
It provides methods for interacting with the database, e.g. executing queries.
Methods
luasql.exasol.connection:create(connection_properties, websocket, session_id) | Create a new instance of the Connection class. |
luasql.exasol.connection:_verify_connection_open(operation) | Verify that this connection is open before executing an operation |
luasql.exasol.connection:execute(statement) | Executes the given SQL statement. |
luasql.exasol.connection:commit() | Commits the current transaction. |
luasql.exasol.connection:rollback() | Rolls back the current transaction. |
luasql.exasol.connection:setautocommit(autocommit) | Turns on or off the "auto commit" mode. |
luasql.exasol.connection:close() | Closes this connection and all cursors created using this connection. |
Methods
- luasql.exasol.connection:create(connection_properties, websocket, session_id) line 19
-
Create a new instance of the Connection class.
Parameters:
- connection_properties luasql.exasol.ConnectionProperties the connection properties
- websocket luasql.exasol.ExasolWebsocket websocket connection to the database
- session_id string session ID of the current database connection
Returns:
-
luasql.exasol.Connection
the new instance
- luasql.exasol.connection:_verify_connection_open(operation) line 36
-
Verify that this connection is open before executing an operation
Parameters:
- operation string the operation to be executed (used in the potential error message)
Raises:
an error if this connection is closed - luasql.exasol.connection:execute(statement) line 50
-
Executes the given SQL statement.
Parameters:
- statement string the SQL statement to execute
Returns:
-
luasql.exasol.Cursor, number or nil
a Cursor object if there are results,
the number of rows affected by the command
or
nil
in case there was an error executing the statement -
table or nil
in case there was an error executing the statement or
nil
if the statement was executed successfully
- luasql.exasol.connection:commit() line 87
-
Commits the current transaction.
Returns:
-
boolean
true
in case of success - luasql.exasol.connection:rollback() line 101
-
Rolls back the current transaction.
Returns:
-
boolean
true
in case of success - luasql.exasol.connection:setautocommit(autocommit) line 118
-
Turns on or off the "auto commit" mode.
Auto commit is on by default. If auto commit is off, you must explicitly execute the
COMMIT
command to commit the transaction.Parameters:
- autocommit
boolean
true
to enable auto commit,false
to disable auto commit
Returns:
-
boolean
true
in case of success - autocommit
boolean
- luasql.exasol.connection:close() line 134
-
Closes this connection and all cursors created using this connection.
Returns:
-
boolean
true
in case of successRaises:
an error in case disconnecting fails