mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-16 12:27:03 +08:00
Fix Connection.client_flag (#266)
This commit is contained in:

committed by
INADA Naoki

parent
09018914e1
commit
9fb618806b
2
_mysql.c
2
_mysql.c
@ -2491,8 +2491,8 @@ static struct PyMemberDef _mysql_ConnectionObject_memberlist[] = {
|
||||
{
|
||||
"client_flag",
|
||||
T_UINT,
|
||||
READONLY,
|
||||
offsetof(_mysql_ConnectionObject,connection.client_flag),
|
||||
READONLY,
|
||||
"Client flags; refer to MySQLdb.constants.CLIENT"
|
||||
},
|
||||
{NULL} /* Sentinel */
|
||||
|
@ -92,3 +92,14 @@ class CoreAPI(unittest.TestCase):
|
||||
self.assertTrue(isinstance(self.conn.get_server_info(), str),
|
||||
"Should return an str.")
|
||||
|
||||
def test_client_flag(self):
|
||||
conn = connection_factory(
|
||||
use_unicode=True,
|
||||
client_flag=MySQLdb.constants.CLIENT.FOUND_ROWS)
|
||||
|
||||
self.assertIsInstance(conn.client_flag, (int, MySQLdb.compat.long))
|
||||
self.assertTrue(conn.client_flag & MySQLdb.constants.CLIENT.FOUND_ROWS)
|
||||
with self.assertRaises(TypeError if MySQLdb.compat.PY2 else AttributeError):
|
||||
conn.client_flag = 0
|
||||
|
||||
conn.close()
|
||||
|
Reference in New Issue
Block a user