I kinda feel like a fool, I just want to do an Insert every minute to a MySQL database. Up until now I've had a laptop connected to the Arduino running a PowerShell script that did the task of reading the "blinks" counted and written to the serial connection and then posting them along with the time to the MySQL database. I'd like to remove the laptop. I keep thinking I've halfway figured out what I'm doing and then I end up feeling lost again.
http://pastebin.com/mQN4UcA1
This is what I've got so far, it's my old code with the Ethernet adapter and MySQL Connector code added. You can see it used to (and technically still does) write to the Serial connection, just the blink count. Now I want it to write straight to the database. There are a few things I'm not sure about and that concern me.
One is the whole reading every column/row thing. Does it actually need to do that? It seems like that would take forever. I'm just writing to the database and it's not the end of the world if I loose data. What would be the disadvantage of skipping that?
Secondly, how would I build the following query, I know it's somewhere in these examples, and I'll probably figure it out before I get a response, but sometimes I don't seem to be able to figure something out before I ask, then it just becomes obvious :)
INSERT INTO `test_arduino`.`homedb_power` (`DateTime`, `WattHour`) VALUES (Date_Format(NOW(),'%Y-%m-%d %H:%i:00'), 10);
Thanks for any assistance.