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

Expose the file descriptor of the underlying libmysqlclient connection. #300

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
Dec 5, 2018

Conversation

benjaminp
Copy link
Contributor

Add a fileno() method to _mysql.connection. This permits low-level access to the
underlying network connection. My specific usecase for this is wanting to tweak
the TCP timeout (TCP_USER_TIMEOUT).

Add a fileno() method to _mysql.connection. This permits low-level access to the
underlying network connection. My specific usecase for this is wanting to tweak
the TCP timeout (TCP_USER_TIMEOUT).
@methane methane changed the base branch from next to master December 5, 2018 09:34
@methane
Copy link
Member

methane commented Dec 5, 2018

I removed it once because it's deprecated from long ago, and there are no document and guarantee about members of MYSQL struct.
16915a0#diff-5ff2483839269e55a0293b1a6dbec5df

I merge it this time, but I'll remove it again when it caused trouble.
If it's important to you, please submit an issue to bugs.mysql.com to expose public API (option) for it.

@methane methane merged commit 27e4018 into PyMySQL:master Dec 5, 2018
@benjaminp benjaminp deleted the fileno branch December 5, 2018 16:48
@benjaminp
Copy link
Contributor Author

Interesting, I didn't know this was ever available. How do you tell whether something is public API or not with libmysqlclient? I assumed we would be okay here because the source implies fd is available for language bindings.

@methane
Copy link
Member

methane commented Dec 5, 2018

How do you tell whether something is public API or not with libmysqlclient?

I thought only fields documented in reference are public.
I think we should not touch MYSQL member directly. We should use mysql_*** APIs instead.

I assumed we would be okay here because the source implies fd is available for language bindings.

Yes, I saw the comment too in MariaDB connector.
I assumed it was not intended to public member, but since Perl started using it, MySQL (and it's
forks) have to maintain backward compatibility. It's accidental public member.

@methane
Copy link
Member

methane commented Dec 5, 2018

For example, old MySQLdb touched MYSQL.reconnect member.
The member is disappeared in MariaDB. So I needed to fix it.
https://github.com/PyMySQL/mysqlclient-python/pull/177/files

That's why I think undocumented MYSQL fields are not public / portable.

@benjaminp
Copy link
Contributor Author

I would feel better using mysql_* API, too, but there's no way that I see to modify TCP settings with the public API.

@methane
Copy link
Member

methane commented Dec 6, 2018

Yes, there are no way for now. That's why I merged this.
And that's why I said "If it's important to you, please submit an issue to bugs.mysql.com to expose public API (option) for it."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.