Skip to content

SQL Server Actions

SQL Server actions are used to interact with tables on SQL Server.

Actions

sqlserver.close

Closes connection with SQL Server.

Parameters:

connection - connection object with server. Connections are created using sqlserver.open action.

Returns:

This action has no return.

Exceptions:

This action returns no Exception

sqlserver.commit

Commit the transation on SQL Server.

Parameters:

connection - connection object with server. Connections are created using sqlserver.open action.

Returns:

This action has no return.

Exceptions:

This action returns no Exception

sqlserver.execute_sql

Execute a SQL command on SQL Server.

Parameters:

connection - connection object with server. Connections are created using sqlserver.open action.

sql - string with SQL command to be executed.

auto_commit (optional) - set if the auto commit on transaction should be used or not (default=True)

Returns:

result - grid with all results returned for SQL command.

count - number of lines returned by result.

affected_rows - number of lines affected by SQL command execution.

Exceptions:

ConnectionException - when problems with SQL Server connection occurs.

sqlserver.open

Creates a new connection to SQL Server.

Parameters:

host - IP or hostname of the server to connect.

user - username to be used on SQL Server authentication.

password - password to be used on SQL Server authentication.

database - name of the database to connect with.

port (optional) - number of the port to connect with SQL Server.

Returns:

connection - connection stablished with SQL Server.

Exceptions:

ConnectionException - when problems with SQL Server connection occurs.

sqlserver.rollback

Rollback the transation on SQL Server.

Parameters:

connection - connection object with server. Connections are created using sqlserver.open action.

Returns:

This action has no return.

Exceptions:

This action returns no Exception

sqlserver.select

Execute a SQL query on SQL Server.

Parameters:

connection - connection object with server. Connections are created using sqlserver.open action.

sql - string with SQL command to be executed.

Returns:

result - grid with all results returned for SQL command.

count - number of lines returned by result.

Exceptions:

ConnectionException - when problems with SQL Server connection occurs.

sqlserver.get_result

Convert the result values from a SQL query into a standardized format.

Parameters:

cursor - Cursor object used to execute SQL commands on SQL Server.

Returns:

result - Grid with all rows and columns returned by the cursor, where: - datetime values are converted to "YYYY-MM-DD HH:MM:SS". - Other values are kept unchanged.

Exceptions:

This action returns no Exception.