I am working with the MySQL library which required an SQL query to be in the form of a char.
char QUERY_SQL = "UPDATE gps_stat.raw_inputs SET snr=snr+1 WHERE id=1";
which basically requests to connect to the database and updates a counter. A bit later in the program the query is executed.
(it likes a char type)
The problem is I would like to throw more then just a static query at it. I would like to have some static text and dynamic data (external sensor) put together to make the query.
I had looked at using string data first with multiple fields all concatenated together to form one big string which then got converted to a char but this didn't work and I suspected it wasn't going to be very memory friendly.
String QUERY_SQL = String("UPDATE gps_stat.raw_inputs SET snr=" + String(DATA) + " WHERE id=1");// concatenating three strings
(DATA is the reference to my sensor data for that particular second)
Does anyone have any suggestions? Can I concatenate multiple char fields into one char field or is there any easier way to go from string to char?