MCPcopy
hub / github.com/django/django / _execute_query

Method _execute_query

django/db/models/sql/query.py:208–225  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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
228ExplainInfo = namedtuple("ExplainInfo", ("format", "options"))

Callers 2

get_columnsMethod · 0.95
__iter__Method · 0.95

Calls 3

cursorMethod · 0.80
itemsMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected