| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -156,9 +156,11 @@ def get_new_connection(self, conn_params): | |||
| 156 | 156 | ||
| 157 | 157 | def init_connection_state(self): | |
| 158 | 158 | """Initialize the state of the existing connection.""" | |
| 159 | + autocommit = self.connection.autocommit | ||
| 159 | 160 | self.connection.close() | |
| 160 | 161 | database = self.connection.database | |
| 161 | 162 | self.connection.__init__(self.instance, database) | |
| 163 | + self.connection.autocommit = autocommit | ||
| 162 | 164 | ||
| 163 | 165 | def create_cursor(self, name=None): | |
| 164 | 166 | """Create a new Database cursor. | |
@@ -196,3 +198,12 @@ def is_usable(self): | |||
| 196 | 198 | return False | |
| 197 | 199 | ||
| 198 | 200 | return True | |
| 201 | + | ||
| 202 | + def _start_transaction_under_autocommit(self): | ||
| 203 | + """ | ||
| 204 | + Start a transaction explicitly in autocommit mode. | ||
| 205 | + | ||
| 206 | + Staying in autocommit mode works around a bug that breaks | ||
| 207 | + save points when autocommit is disabled by django. | ||
| 208 | + """ | ||
| 209 | + self.connection.cursor().execute("SELECT 1") | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments