I got the following sql_buildup_method... code is bit dirty but that s not the case
char *build_up_sql(char *inputName,char *inputMessage)
{
char firstPartStatement[1064] ="INSERT INTO User (name, msg) VALUES (";
char *endPartStatement =");";
char *lightener = "'";
char *statement;
strcat(firstPartStatement,lightener);
strcat(firstPartStatement,inputName);
strcat(firstPartStatement,lightener);
strcat(firstPartStatement,",");
strcat(firstPartStatement,lightener);
strcat(firstPartStatement,inputMessage);
strcat(firstPartStatement,lightener);
strcat(firstPartStatement,endPartStatement);
statement = firstPartStatement;
return statement;
}
void create_input(sqlite3 *handler,char *inputName,char *inputMessage)
{
char *sql;
sql = build_up_sql(inputName,inputMessage);
// sql ="INSERT INTO User (name, msg) VALUES ('Susanne','hi all');";
printf("%s\n",sql);
sqlite3_exec(handler,sql, NULL, NULL, NULL);
}
the printf gives the output: INSERT INTO User (name, msg) VALUES ('Susanne','hi all'); which is totally fine ... but the sqlite3_exec ignores it and isn't generating new database input .... if I leave the line sql ="INSERT INTO User (name, msg) VALUES ('Susanne','hi all');"; in the code the sqlite3_exec just works fine .... also putting everything in one function also solved the problem, but this shouldn't be an option.....