Process SQLite statment

Hello, I need some help. I want to insert some Values into my SQlite DB on my Linino.

I have a table with (id int, time Text, Itemp Double, Stemp Double) Now i am able to write from Linux side with:

sqlite3 -line /mnt/sda1/Thermostat/test.db 'insert into thermostat (id, time, ISTtemp, SOLLTemp) values (1, "04/05/16 23:06:14", 22.60, 22.20)';

now i want to create a function, thats writes the values "ID, time, ISTtemp, SOLLTemp" into the sqlite DB

like this:

Process p;
  String cmd = "sqlite3 ";
  String param1 = "-line ";
  String param2 = "/mnt/sda1/Thermostat/test.db ";
  String param3 = "'insert into thermostat (id, time, ISTtemp, SOLLTemp) values ( "+id+", \""+time+"\", "+Itemp+", "+Stemp+")';";
   String sqliteparam = "'insert into test (id, text) values (1, \"test\")';";
  Console.println(cmd + param1 + param2 + param3);                                     
  p.runShellCommand(cmd + param1 + param2 + param3);

i get the error:

exit status 1 invalid operands of types 'const char*' and 'const char [4]' to binary 'operator+'

had something todo with the value "+id+", if i use a fix integer it will work :(

someone have an idea ?

Sutcliffe: someone have an idea ?

Yes - it doesn't like something about the variable id. But you haven't shown the complete code so we can't tell you what's going on. You should always post the complete code, as the problem is usually in the area where you aren't looking (if you were looking there, you'd probably see the error.)

Is this a compile time error? (I'm guessing so.) Or is it a run time error? It would be helpful to have the full details.

Off of the top of my head, it looks like you are trying to use the "+" operator to concatenate C style strings. There is no such operator for C style strings, like there is for String class objects.

@Sutcliffe, agree with ShapeShifters comments. In addition, there is no need to create such a complex string, unless you have some "masochist" preference. Best of Luck Jesse

Change time to thermostat_time, time is keyword at sqlite.

set up id as PRIMARY KEY

thermostat_time as CURRENT_TIMESTAMP

http://www.ibuyopenwrt.com/index.php/8-yun-compatible/126-timestamp-with-sqlite3