X-Git-Url: http://www.average.org/gitweb/?p=pulsecounter.git;a=blobdiff_plain;f=linux%2Fdbstore.c;fp=linux%2Fdbstore.c;h=1a85dbac1a7a50eb2564982cead098587f1fcc08;hp=b39235b1b2eb66c241840e2e9b4d223862555447;hb=8ccd96947c30f401410182f29e7a9cd19224380c;hpb=9e60d66129fbe12edece200733bd42a7566ab10e diff --git a/linux/dbstore.c b/linux/dbstore.c index b39235b..1a85dba 100644 --- a/linux/dbstore.c +++ b/linux/dbstore.c @@ -4,6 +4,8 @@ #include #include +#include + #include #include "dbstore.h" @@ -74,8 +76,7 @@ int dbstore(uint8_t which, uint32_t val) (void)strftime(tstr, sizeof(tstr), "%Y-%m-%d %H:%M:%S", &tm); mysql_init(&mysql); if(!mysql_real_connect(&mysql, host, user, pass, dbnm, 0, NULL, 0)) { - fprintf(stderr, "mysql connect error: %s\n", - mysql_error(&mysql)); + g_warning("mysql connect error: %s\n", mysql_error(&mysql)); return 1; } snprintf(statement, sizeof(statement), @@ -83,8 +84,8 @@ int dbstore(uint8_t which, uint32_t val) table, tstr, val); rc = mysql_query(&mysql, statement); if (rc) - fprintf(stderr, "mysql insert \"%s\" error: %s\n", - statement, mysql_error(&mysql)); + g_warning("mysql insert \"%s\" error: %s\n", + statement, mysql_error(&mysql)); mysql_close(&mysql); return rc; }