Sannis / node-mysql-libmysqlclient

Asynchronous MySQL binding for Node.js
http://sannis.github.com/node-mysql-libmysqlclient
Other
229 stars 47 forks source link

Connection status error #163

Closed Tamiyadd closed 10 years ago

Tamiyadd commented 11 years ago

I noticed that the method used to check if the connection is acting weird

I noticed that if the server is in a local network and i'm connecting to a database outside the network, and the internet connection goes down (not the local connection) the method always say that the connection is on and don't notice that was dropped, i'm using it wrongly?

thank

if (!conn.connectedSync()) {
  sys.puts("Connection error " + conn.connectErrno + ": " + conn.connectError);
  process.exit(1);
}
Sannis commented 11 years ago

MySQL API is weird)))

connectedSync does not use MySQL API to check connection - it just answered a question "Are we try to connect and sucsessfully connected before?"

There is pingSync to check connection status before any operation. You can check MySQL developer docs for description.