Skip to content

Commit c94ae7b

Browse files
committed
Fix for Issue michiya#113 Select for Update improvement
1 parent 4df37f3 commit c94ae7b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sql_server/pyodbc/operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ def for_update_sql(self, nowait=False, skip_locked=False):
234234
Returns the FOR UPDATE SQL clause to lock rows for an update operation.
235235
"""
236236
if skip_locked:
237-
return 'WITH (NOLOCK)'
237+
return 'WITH (ROWLOCK, UPDLOCK, READPAST, FORCESEEK)'
238238
elif nowait:
239-
return 'WITH (NOWAIT, ROWLOCK, UPDLOCK)'
239+
return 'WITH (NOWAIT, ROWLOCK, UPDLOCK, FORCESEEK)'
240240
else:
241-
return 'WITH (ROWLOCK, UPDLOCK)'
241+
return 'WITH (ROWLOCK, UPDLOCK, FORCESEEK)'
242242

243243
def format_for_duration_arithmetic(self, sql):
244244
if sql == '%s':

0 commit comments

Comments
 (0)