Return query after binding args.
(self, query, args)
| 105 | return self._nextset(False) |
| 106 | |
| 107 | def _mogrify(self, query, args) -> str: |
| 108 | """Return query after binding args.""" |
| 109 | escape = self._get_db().escape |
| 110 | |
| 111 | if isinstance(args, dict): |
| 112 | args = {key: escape(item) for key, item in args.items()} |
| 113 | elif isinstance(args, (list, tuple)): |
| 114 | args = tuple(map(escape, args)) |
| 115 | else: |
| 116 | # Escaping a single argument is not part of the DB-API or mysqlclient. |
| 117 | # It will be removed in the next version. |
| 118 | warnings.warn( |
| 119 | "single argument is deprecated and will be removed in the next version.", |
| 120 | DeprecationWarning, |
| 121 | stacklevel=3) |
| 122 | args = escape(args) |
| 123 | try: |
| 124 | return query % args |
| 125 | except TypeError as m: |
| 126 | raise err.ProgrammingError(str(m)) |
| 127 | |
| 128 | def mogrify(self, query, args=None) -> str: |
| 129 | """ |
no test coverage detected