The fifth parameter is a pointer into which the address of the error message is written. If you pass NULL (0), then no error message is returned, and no memory is allocated to contain the message.
On the gripping hand, if you pass a pointer (non NULL / non 0) then memory is allocated to contain the error message and the address of that memory block is written to the location specified by the 5th parameter. eg: char* errmsg; sqlite_exec(p1, p2, p3, p4, &errmsg); now errmsg points to the error message and you call sqlite_free(errmsg) when you are done with the error message. sqlite_exec(p1, p2, p3, p4, 0); no memory is allocated for an error message and therefore no pointer is written to *0 ... > -----Original Message----- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of Igor Korot > Sent: Saturday, 19 November, 2016 15:59 > To: Discussion of SQLite Database; General Discussion of SQLite Database > Subject: [sqlite] Fwd: Bug in the docs > > Hi, ALL, > On the page https://www.sqlite.org/c3ref/exec.html following phrase is > written: > > [quote] > If the 5th parameter to sqlite3_exec() is not NULL then any error > message is written into memory obtained from sqlite3_malloc() and > passed back through the 5th parameter. > [/quote] > > Shouldn't it start with: > > "If the 5th parameter to sqlite3_exec() is NULL" > > ? > > Thank you. > > P.S.: Sorry if it appears twice. > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users