-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Add contrib/mariadbclient #469
base: master
Are you sure you want to change the base?
Conversation
Please fix travis-ci first, put |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't read the contrib/mariadhclient/ part, will do it later.
Channel(EventLoop* loop, int fd); | ||
typedef std::function<void(int, Timestamp)> EventsCallback; | ||
|
||
Channel(EventLoop* loop, int fd, bool classify = true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest not to introduce the new classify
parameter. Instead, if EventsCallback is provided, it intercepts all events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean change
channel_->setEventsCallback(std::bind(&MariaDBClient::stateMachineHandler, this, kRealConnectCont, _1, 2));
to
channel->setReadCallback(std::bind(&MariaDBClient::stateMachineHandler, this, kRealConnectCont, _1, 2));
channel->setWriteCallback(std::bind(&MariaDBClient::stateMachineHandler, this, kRealConnectCont, _1, _2));
?
@@ -67,6 +72,8 @@ class Channel : noncopyable | |||
bool isWriting() const { return events_ & kWriteEvent; } | |||
bool isReading() const { return events_ & kReadEvent; } | |||
|
|||
void enableEvents(int events__) { events_ = events__; update(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameter events__
-> events
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on centos7-x86_64:
if events__ -> events
错误:‘events’的声明隐藏了‘this’的一个成员 [-Werror=shadow]
events shadows int events()
ref:
Channel::Channel(EventLoop* loop, int fd__, bool classify)
Update:
Test successfully with MariaDB-Server/MySQL-Server ref: |
MariaDB Async Client
Using Non-blocking API
Reference:
https://mariadb.com/kb/en/using-the-non-blocking-library/
https://github.com/MariaDB/server/blob/5.5/client/async_example.c
https://github.com/MariaDB/server/blob/5.5/tests/async_queries.c
https://mariadb.com/kb/en/non-blocking-api-reference/
Build:
centos7-x86_64:
yum install mariadb-devel mariadb-libs
ubuntu14.04-x86_64:
apt-get install libmariadbclient-dev
ln -sf libmariadbclient.so libmysqlclient.so