I have this insert Method
void insert(char *query)
{
char *err_messg;
int result=0;
if(sqlite3_exec(db_conn, query, NULL, 0, &err_messg) == SQLITE_OK)
{
result = 1;
}
else
{
fprintf(stdout,"SQL error: %s\n", err_messg);
result = 0;
}
}
Im inserting like this
insert("INSERT INTO tdata(sid,stbamount,pkgamount) VALUES('%s','%s','%s');",sid,amount1,amount2);
But when the number of arguments increase ,i get a segmentation fault and core is dumped.
insert("INSERT INTO sdata (sid,name,area,type,stbamount,pkgamount) VALUES('%s','%s','%s','%s','%s','%s');",a1,b1,c1,d1,e1,f1);
All the values are valid and connection is properly established.
Aucun commentaire:
Enregistrer un commentaire