List,

sorry about that. I misread Nathan's post, and so came up with a bogus answer. Never try to answer technical questions when it's 03:45am for you ;-).

Ulrik Petersen

Randall Fox wrote:

On Mon, 7 Feb 2005 18:14:42 -0800, you wrote:



Does this

var
pMsg: PChar;

..
  pMsg := SQLite3_ErrMsg(aDB);

necessitate this?

if pMsg <> nil then SQLite3_Free(pMsg);




It depends.  If you use sqlite3_exec, then yes, if you use the other
method (sqlite_prepare) then I would say no, depending on your
definition of the word "ephemeral"  ;-)


From the docs:

sqlite3_exec method:
If an error occurs while parsing or evaluating the SQL (but not while
executing the callback) then an appropriate error message is written
into memory obtained from malloc() and *errmsg is made to point to
that message. The calling function is responsible for freeing the
memory that holds the error message. Use sqlite3_free() for this. If
errmsg==NULL, then no error message is ever written.


sqlite3_prepare method The sqlite3_errcode() routine returns a result code for the most recent major API call. sqlite3_errmsg() returns an English-language text error message for the most recent error. The error message is represented in UTF-8 and will be ephemeral - it could disappear on the next call to any SQLite API function. sqlite3_errmsg16() works like sqlite3_errmsg() except that it returns the error message represented as UTF-16 in host native byte order.








Reply via email to