Search code examples
c++mysqlraspberry-piraspbianmysql-connector-c

MariaDB/MySQL Connector/C insert is producing confusing error (C++ on Raspbian)


After some struggling, I was able to get the MariaDB/MySQL libraries linked up to my development environment on the RPi-4B (Raspbian/CodeBlocks).

One of my lines seems to be erroring out and I can't quite figure out why:

insertString = "INSERT INTO eco_tank_data (eco_id) VALUES ('"+eco_id"')";

produces the error:

error: expected ';' before string constant

Am I missing something here? I feel like I'm completely bombing some syntax which is why I just included this line, but can include the full program if necessary.

Thanks


Solution

  • Bonus quiz. Find any operator between eco_id and "')" in eco_id"')".