summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 45811d0)
raw | patch | inline | side by side (parent: 45811d0)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 20 Mar 2009 21:10:18 +0000 (22:10 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 20 Mar 2009 21:10:18 +0000 (22:10 +0100) |
Also, improved the error message logged if the connection failed.
src/mysql.c | patch | blob | history |
diff --git a/src/mysql.c b/src/mysql.c
index 565a88e0acb20bd1bd5d2f45351619c5a0b56872..0d3cb7f8b18ed743dc3449b9fcc37589cf965540 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
if (mysql_real_connect (db->con, db->host, db->user, db->pass,
db->database, db->port, db->socket, 0) == NULL)
{
- ERROR ("mysql_real_connect failed: %s", mysql_error (db->con));
+ ERROR ("mysql plugin: Failed to connect to database %s "
+ "at server %s: %s",
+ (db->database != NULL) ? db->database : "<none>",
+ (db->host != NULL) ? db->host : "localhost",
+ mysql_error (db->con));
db->state = 0;
return (NULL);
}
else
{
+ INFO ("mysql plugin: Sucessfully connected to database %s "
+ "at server %s (server version: %s, protocol version: %d)",
+ (db->database != NULL) ? db->database : "<none>",
+ mysql_get_host_info (db->con),
+ mysql_get_server_info (db->con),
+ mysql_get_proto_info (db->con));
db->state = 1;
return (db->con);
}