Re: [sqlite] segmentation fault in sqlite api call

2018-10-22 Thread Olivier Mascia
Your query string is ~ 61 characters (did not count precisely), not including the key length not the value length. Are you sure the real tests you run do not overflow the fixed buffer char query[200] which can hold no more than 199 characters? You would have huge problems as soon as

Re: [sqlite] segmentation fault in sqlite api call

2018-10-21 Thread Ratheendran R
Thanks Olivier Mascia for the tips and suggestion I will definitely try out. sorry for the code with the double pointer which has raised lot of confusion I ensured this fault raised is not beacuse of any of my pointer usage . I am having a workaround with key/value memory allocation in heap and

Re: [sqlite] segmentation fault in sqlite api call

2018-10-21 Thread Keith Medcalf
o: sqlite-users@mailinglists.sqlite.org >Subject: [sqlite] segmentation fault in sqlite api call > >Hi, > >I am a embedded engineer and new to sqlite,we want to use sqlite for >our >local storage instead of file i/o. > >I have created a table with key and value records of char type,now i

Re: [sqlite] segmentation fault in sqlite api call

2018-10-21 Thread Peter da Silva
You're passing a char * to a routine that expects a char **, and then immediately trying to indirect through it, which means it's taking the text, treating it as a pointer, and passing the random data it's pointing to as a string to sqlite. On Sun., 21 Oct. 2018, 11:55 Ratheendran R, wrote: >

Re: [sqlite] segmentation fault in sqlite api call

2018-10-21 Thread Larry Brasfield
The code you provided declares and defines a pointer, named ‘db’ in main(), which is used with the SQLite API but never made to point to a valid object in memory or even to allocated memory. Hence your segmentation fault. ___ sqlite-users mailing

Re: [sqlite] segmentation fault in sqlite api call

2018-10-21 Thread Olivier Mascia
Hi, mydef_set probably overflows your 'query' variable of which you don't show declaration but I guess it is 200 bytes seeing your memset(query,0,200); strcpy(query, ... This above and why this char** buffer in mydef_set prototype? Think about what your intent was. Compare to what you did

[sqlite] segmentation fault in sqlite api call

2018-10-21 Thread Ratheendran R
Hi, I am a embedded engineer and new to sqlite,we want to use sqlite for our local storage instead of file i/o. I have created a table with key and value records of char type,now if I try store a value with string length more than 50 char I get segmentation fault,please see the code below and