More sensor information in struct; added handle_url; new node_id column in sendmysql

This commit is contained in:
2017-08-26 15:02:15 +02:00
parent 2efcbce437
commit 740589b158
6 changed files with 76 additions and 9 deletions

View File

@@ -42,11 +42,12 @@ void insertData(sensor *s) {
char *pquerystring = NULL;
if (-1 == asprintf(&pquerystring,
"INSERT INTO stats (pin, humidity, temperature) VALUES (%i, %f, %f)", s->pin, s->humidity, s->temperature)) {
"INSERT INTO stats (node_id, pin, humidity, temperature) VALUES (%i, %i, %f, %f)", s->node_id, s->pin, s->humidity, s->temperature)) {
perror("asprintf() failed");
} else {
if (mysql_query(conn, pquerystring)) {
fprintf(stderr, "%s\n", mysql_error(conn));
free(pquerystring);
exit(1);
}
}