More sensor information in struct; added handle_url; new node_id column in sendmysql
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user