From: Po Lu Date: Sat, 5 Nov 2022 11:43:12 +0000 (+0800) Subject: Make sqlite.c build with SQlite in Fedora 9 X-Git-Tag: emacs-29.0.90~1616^2~288 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ae7dcba6c5d9c2c19f4ee67793e164af3723f69f;p=emacs.git Make sqlite.c build with SQlite in Fedora 9 * src/sqlite.c (sqlite_prepare_errdata): Use sqlite3_errmsg instead of sqlite3_errstr. --- diff --git a/src/sqlite.c b/src/sqlite.c index 08bf696b8ca..906d0640003 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -428,11 +428,23 @@ row_to_value (sqlite3_stmt *stmt) static Lisp_Object sqlite_prepare_errdata (int code, sqlite3 *sdb) { - Lisp_Object errstr = build_string (sqlite3_errstr (code)); - Lisp_Object errcode = make_fixnum (code); + Lisp_Object errstr, errcode, ext_errcode; + const char *errmsg; + + /* The internet says this is identical to sqlite3_errstr (code), + which is too new to exist on Fedora 9. */ + errmsg = sqlite3_errmsg (sdb); + errstr = errmsg ? build_string (errmsg) : Qnil; + errcode = make_fixnum (code); + /* More details about what went wrong. */ - Lisp_Object ext_errcode = make_fixnum (sqlite3_extended_errcode (sdb)); - const char *errmsg = sqlite3_errmsg (sdb); +#if SQLITE_VERSION_NUMBER >= 3006005 + ext_errcode = make_fixnum (sqlite3_extended_errcode (sdb)); +#else + /* What value to use here? */ + ext_errcode = make_fixnum (0); +#endif + return list4 (errstr, errmsg ? build_string (errmsg) : Qnil, errcode, ext_errcode); }