(self)
| 206 | return self.sql % self.params_type(self.params) |
| 207 | |
| 208 | def _execute_query(self): |
| 209 | connection = connections[self.using] |
| 210 | |
| 211 | # Adapt parameters to the database, as much as possible considering |
| 212 | # that the target type isn't known. See #17755. |
| 213 | params_type = self.params_type |
| 214 | adapter = connection.ops.adapt_unknown_value |
| 215 | if params_type is tuple: |
| 216 | params = tuple(adapter(val) for val in self.params) |
| 217 | elif params_type is dict: |
| 218 | params = {key: adapter(val) for key, val in self.params.items()} |
| 219 | elif params_type is None: |
| 220 | params = None |
| 221 | else: |
| 222 | raise RuntimeError("Unexpected params type: %s" % params_type) |
| 223 | |
| 224 | self.cursor = connection.cursor() |
| 225 | self.cursor.execute(self.sql, params) |
| 226 | |
| 227 | |
| 228 | ExplainInfo = namedtuple("ExplainInfo", ("format", "options")) |
no test coverage detected