Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9fb6188

Browse filesBrowse files
sir-sigurdmethane
authored andcommitted
Fix Connection.client_flag (PyMySQL#266)
1 parent 0901891 commit 9fb6188
Copy full SHA for 9fb6188

File tree

Expand file treeCollapse file tree

2 files changed

+12
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-1
lines changed

‎_mysql.c

Copy file name to clipboardExpand all lines: _mysql.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2491,8 +2491,8 @@ static struct PyMemberDef _mysql_ConnectionObject_memberlist[] = {
24912491
{
24922492
"client_flag",
24932493
T_UINT,
2494-
READONLY,
24952494
offsetof(_mysql_ConnectionObject,connection.client_flag),
2495+
READONLY,
24962496
"Client flags; refer to MySQLdb.constants.CLIENT"
24972497
},
24982498
{NULL} /* Sentinel */

‎tests/test_MySQLdb_nonstandard.py

Copy file name to clipboardExpand all lines: tests/test_MySQLdb_nonstandard.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,14 @@ def test_server_info(self):
9292
self.assertTrue(isinstance(self.conn.get_server_info(), str),
9393
"Should return an str.")
9494

95+
def test_client_flag(self):
96+
conn = connection_factory(
97+
use_unicode=True,
98+
client_flag=MySQLdb.constants.CLIENT.FOUND_ROWS)
99+
100+
self.assertIsInstance(conn.client_flag, (int, MySQLdb.compat.long))
101+
self.assertTrue(conn.client_flag & MySQLdb.constants.CLIENT.FOUND_ROWS)
102+
with self.assertRaises(TypeError if MySQLdb.compat.PY2 else AttributeError):
103+
conn.client_flag = 0
104+
105+
conn.close()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.