Escape whatever value is passed. Non-standard, for internal use; do not use this in your applications.
(self, obj, mapping=None)
| 528 | self._read_ok_packet() |
| 529 | |
| 530 | def escape(self, obj, mapping=None): |
| 531 | """Escape whatever value is passed. |
| 532 | |
| 533 | Non-standard, for internal use; do not use this in your applications. |
| 534 | """ |
| 535 | if isinstance(obj, str): |
| 536 | return "'" + self.escape_string(obj) + "'" |
| 537 | if isinstance(obj, (bytes, bytearray)): |
| 538 | ret = self._quote_bytes(obj) |
| 539 | if self._binary_prefix: |
| 540 | ret = "_binary" + ret |
| 541 | return ret |
| 542 | return converters.escape_item(obj, self.charset, mapping=mapping) |
| 543 | |
| 544 | def literal(self, obj): |
| 545 | """Alias for escape(). |