SQLite Forum

sqlite3_exec: 5th parameter
Login

sqlite3_exec: 5th parameter

(1) By anonymous on 2021-09-22 14:25:15 [source]

Is the 5th a verbose description of the return code of sqlite3_exec?

Should I check the 5th parameter (which is a C# out parameter) all the time or only when the return code is not SQLITE_OK i.e. 0?

(2) By Richard Hipp (drh) on 2021-09-22 14:39:21 in reply to 1 [link] [source]

The error message is only set and meaningful if a non-SQLITE_OK code is returned.

Note that the error message might not be set for SQLITE_NOMEM too.

(3) By Larry Brasfield (larrybr) on 2021-09-22 14:44:35 in reply to 1 [link] [source]

Is the 5th a verbose description of the return code of sqlite3_exec?

Considered as an optional out parameter, yes. Technically, it is where the caller will receive a pointer to such an error message, at caller's option.

Should I check the 5th parameter (which is a C# out parameter) all the time or only when the return code is not SQLITE_OK i.e. 0?

It need not be checked at all; the int return indicates success or other outcomes.

sqlite3_exec() is a convenience function, wrapping a series of other calls, including potential retrieval of text error messages.