Skip to content

Commit 55fd8f4

Browse files
author
Jerry Schneider
committed
syncing upstream
2 parents 541505b + b94dfb5 commit 55fd8f4

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/DatabaseLibrary/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.0
1+
0.9.1

src/DatabaseLibrary/query.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,26 @@ def execute_sql_string(self, sqlString):
269269
if cur:
270270
self._dbconnection.rollback()
271271

272+
def execute_sql_string_sanstran(self, sqlString):
273+
"""
274+
Executes the sqlString as SQL commands.
275+
Useful to pass arguments to your sql.
276+
Does not wrap execution in transaction!
277+
278+
SQL commands are expected to be delimited by a semi-colon (';').
279+
280+
For example:
281+
| Check If Exists In Database SELECT * FROM dbo.ExampleTable WHERE Id = 1 AND ExampleFlag = 0
282+
| Execute Sql String Sanstran BEGIN TRAN
283+
| Execute Sql String Sanstran UPDATE dbo.ExampleTable SET ExampleFlag = 1 WHERE Id = 1 AND ExampleFlag = 0
284+
| Check If Exists In Database SELECT * FROM dbo.ExampleTable WHERE Id = 1 AND ExampleFlag = 1
285+
| Execute Sql String Sanstran ROLLBACK TRAN
286+
| Check If Exists In Database SELECT * FROM dbo.ExampleTable WHERE Id = 1 AND ExampleFlag = 0
287+
"""
288+
cur = self._dbconnection.cursor()
289+
logger.info('Executing : Execute SQL String Sanstran | %s ' % (sqlString))
290+
self.__execute_sql(cur, sqlString)
291+
272292
def call_stored_procedure(self, spName, spParams=None):
273293
"""
274294
Uses the inputs of spName and spParams to call a stored procedure

0 commit comments

Comments
 (0)