Skip to content

Commit 0f397ac

Browse files
committed
fix(system_tests): Move no-op savepoints to DatabaseOperations
- Moved and related methods from (incorrect location) to (correct location). - This ensures Django uses these no-op methods (SELECT 1) instead of generating invalid SQL for Spanner. - Kept in features to maintain the fix for .
1 parent 79787bd commit 0f397ac

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

django_spanner/base.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -244,21 +244,3 @@ def _start_transaction_under_autocommit(self):
244244
else:
245245
# transactions in autocommit mode for Django 3.2.
246246
self.connection.cursor().execute("SELECT 1")
247-
248-
def savepoint_create_sql(self, sid):
249-
"""
250-
Return the SQL for creating a savepoint.
251-
"""
252-
return "SELECT 1"
253-
254-
def savepoint_commit_sql(self, sid):
255-
"""
256-
Return the SQL for committing a savepoint.
257-
"""
258-
return "SELECT 1"
259-
260-
def savepoint_rollback_sql(self, sid):
261-
"""
262-
Return the SQL for rolling back to a savepoint.
263-
"""
264-
return "SELECT 1"

django_spanner/operations.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,3 +678,21 @@ def _get_limit_offset_params(self, low_mark, high_mark):
678678
# from Cloud Spanner.
679679
limit -= offset
680680
return limit, offset
681+
682+
def savepoint_create_sql(self, sid):
683+
"""
684+
Return the SQL for creating a savepoint.
685+
"""
686+
return "SELECT 1"
687+
688+
def savepoint_commit_sql(self, sid):
689+
"""
690+
Return the SQL for committing a savepoint.
691+
"""
692+
return "SELECT 1"
693+
694+
def savepoint_rollback_sql(self, sid):
695+
"""
696+
Return the SQL for rolling back to a savepoint.
697+
"""
698+
return "SELECT 1"

0 commit comments

Comments
 (0)