MCPcopy Create free account
hub / github.com/PyMySQL/mysqlclient / set_character_set

Method set_character_set

src/MySQLdb/connections.py:328–334  ·  view source on GitHub ↗

Set the connection character set to charset.

(self, charset, collation=None)

Source from the content-addressed store, hash-verified

326 self.query(b"BEGIN")
327
328 def set_character_set(self, charset, collation=None):
329 """Set the connection character set to charset."""
330 super().set_character_set(charset)
331 self.encoding = _charset_to_encoding.get(charset, charset)
332 if collation:
333 self.query(f"SET NAMES {charset} COLLATE {collation}")
334 self.store_result()
335
336 def set_sql_mode(self, sql_mode):
337 """Set the connection sql_mode. See MySQL documentation for

Callers 1

__init__Method · 0.95

Calls 1

queryMethod · 0.95

Tested by

no test coverage detected