lua-resty-mysql icon indicating copy to clipboard operation
lua-resty-mysql copied to clipboard

provide a method to ping the server

Open rohityadavcloud opened this issue 12 years ago • 3 comments

MySQL ping method/query could let us know in advance before executing a query if the server is reachable and in good state. The feature request is to add this ping method on a db object which returns err to say whether it was success or failure.

rohityadavcloud avatar Nov 20 '13 09:11 rohityadavcloud

@bhaisaab Patches welcome! :)

agentzh avatar Nov 20 '13 19:11 agentzh

How about using str = db:server_ver() If it return a version that indicates server is available

maanas avatar Sep 01 '15 03:09 maanas

@maanas That won't work since server_ver simply reads the version data in the initial handshake (if any) while establishing a new MySQL connection. There is no new communications with the MySQL server upon each server_ver call.

agentzh avatar Sep 01 '15 04:09 agentzh