1 .Dd April 29, 2026 2 .Dt SQLITE3_SET_ERRMSG 3 3 .Os 4 .Sh NAME 5 .Nm sqlite3_set_errmsg 6 .Nd set error code and message 7 .Sh SYNOPSIS 8 .In sqlite3.h 9 .Ft int 10 .Fo sqlite3_set_errmsg 11 .Fa "sqlite3 *db" 12 .Fa "int errcode" 13 .Fa "const char *zErrMsg" 14 .Fc 15 .Sh DESCRIPTION 16 Set the error code of the database handle passed as the first argument 17 to errcode, and the error message to a copy of nul-terminated string 18 zErrMsg. 19 If zErrMsg is passed NULL, then the error message is set to the default 20 message associated with the supplied error code. 21 Subsequent calls to 22 .Fn sqlite3_errcode 23 and 24 .Fn sqlite3_errmsg 25 and similar will return the values set by this routine in place of 26 what was previously set by SQLite itself. 27 .Pp 28 This function returns SQLITE_OK if the error code and error message 29 are successfully set, SQLITE_NOMEM if an OOM occurs, and SQLITE_MISUSE 30 if the database handle is NULL or invalid. 31 .Pp 32 The error code and message set by this routine remains in effect until 33 they are changed, either by another call to this routine or until they 34 are changed to by SQLite itself to reflect the result of some subsquent 35 API call. 36 .Pp 37 This function is intended for use by SQLite extensions or wrappers. 38 The idea is that an extension or wrapper can use this routine to set 39 error messages and error codes and thus behave more like a core SQLite 40 feature from the point of view of an application. 41 .Sh IMPLEMENTATION NOTES 42 These declarations were extracted from the 43 interface documentation at line 4252. 44 .Bd -literal 45 SQLITE_API int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zErrMsg); 46 .Ed 47 .Sh SEE ALSO 48 .Xr sqlite3_errcode 3 49