ChuckBell / MySQL_Connector_Arduino

Database connector library for using MySQL with your Arduino projects.
332 stars 133 forks source link

Sending long string to mysql #71

Closed sotb11 closed 2 years ago

sotb11 commented 5 years ago

I use WIFI D1 R2 ESP8266 with two sensors. I have read https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/45. I meet the problem with sending long string because of program stopping after correct saving data to base. I tried to get data from sensor in 5 or 10 second delayed loop and gather them in one variable to send after 5 minutes. To do it i had to change value of query[] to 256. It is not enough. So, is there another way to send much longer strings with data? I do not know it is better to send data often and shorter variable or send data less often but longer variable. Its not impotrant if we send data from temperature or humidity sensors, but dust sensor data may vary in short time, so it is better to send more data, I think.

ChuckBell commented 5 years ago

Well, if 256 isn't long enough and you have enough memory, make it bigger!

Or, better, reconsider how much data you must send to the database. Do you really need to send such a long (much data) string? Can you do it in several passes (create the row, then update)? There are a variety of ways to overcome this. Just think small because the Arduino has very little memory. For example, while DBAs such myself would cringe, you can use shorter names for columns. Things like this should get you where you need to be and working.