Skip to content

Fixed Connection.client_flag. #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -2455,8 +2455,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 */
Expand Down
11 changes: 11 additions & 0 deletions tests/test_MySQLdb_nonstandard.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,14 @@ def test_server_info(self):
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()