MCPcopy Index your code
hub / github.com/PyMySQL/mysqlclient / execute

Method execute

src/MySQLdb/cursors.py:162–180  ·  view source on GitHub ↗

Execute a query. query -- string, query to execute on server args -- optional sequence or mapping, parameters to use with query. Note: If args is a sequence, then %s must be used as the parameter placeholder in the query. If a mapping is used, %(key)s must b

(self, query, args=None)

Source from the content-addressed store, hash-verified

160 return con
161
162 def execute(self, query, args=None):
163 """Execute a query.
164
165 query -- string, query to execute on server
166 args -- optional sequence or mapping, parameters to use with query.
167
168 Note: If args is a sequence, then %s must be used as the
169 parameter placeholder in the query. If a mapping is used,
170 %(key)s must be used as the placeholder.
171
172 Returns integer represents rows affected, if any
173 """
174 self._discard()
175
176 mogrified_query = self._mogrify(query, args)
177
178 assert isinstance(mogrified_query, (bytes, bytearray))
179 res = self._query(mogrified_query)
180 return res
181
182 def _mogrify(self, query, args=None):
183 """Return query after binding args."""

Callers 15

executemanyMethod · 0.95
_do_execute_manyMethod · 0.95
executeDDL1Method · 0.80
executeDDL2Method · 0.80
tearDownMethod · 0.80
test_cursor_isolationMethod · 0.80
test_descriptionMethod · 0.80
test_rowcountMethod · 0.80
_paraminsertMethod · 0.80
test_executemanyMethod · 0.80

Calls 3

_discardMethod · 0.95
_mogrifyMethod · 0.95
_queryMethod · 0.95

Tested by 15

test_cursor_isolationMethod · 0.64
test_descriptionMethod · 0.64
test_rowcountMethod · 0.64
test_executemanyMethod · 0.64
test_fetchoneMethod · 0.64
test_fetchmanyMethod · 0.64
test_fetchallMethod · 0.64
test_mixedfetchMethod · 0.64
test_nextsetMethod · 0.64
test_NoneMethod · 0.64