diff options
| author | Lars Ingebrigtsen | 2021-12-11 06:40:01 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-12-11 06:40:01 +0100 |
| commit | ebf59d1a28b49b391b8025d7017bacf853c01aa2 (patch) | |
| tree | c1e91846fd6a916e7013bb1d596d318f5b79a556 /src/sqlite.c | |
| parent | ad1b80d91dfae992c91d36446af5357f77739bfc (diff) | |
| download | emacs-ebf59d1a28b49b391b8025d7017bacf853c01aa2.tar.gz emacs-ebf59d1a28b49b391b8025d7017bacf853c01aa2.zip | |
Check whether the sqlite supports sqlite3_load_extension
* configure.ac: Check for sqlite3_load_extension, which is
apparently missing in some versions.
* src/sqlite.c: Add guards.
(Fsqlite_load_extension): Ifdef out on systems that doesn't have it.
Diffstat (limited to 'src/sqlite.c')
| -rw-r--r-- | src/sqlite.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/sqlite.c b/src/sqlite.c index 50989434ffa..42a7a3a0268 100644 --- a/src/sqlite.c +++ b/src/sqlite.c | |||
| @@ -65,11 +65,16 @@ DEF_DLL_FN (SQLITE_API const char*, sqlite3_column_name, (sqlite3_stmt*, int)); | |||
| 65 | DEF_DLL_FN (SQLITE_API int, sqlite3_exec, | 65 | DEF_DLL_FN (SQLITE_API int, sqlite3_exec, |
| 66 | (sqlite3*, const char*, int (*callback)(void*,int,char**,char**), | 66 | (sqlite3*, const char*, int (*callback)(void*,int,char**,char**), |
| 67 | void*, char**)); | 67 | void*, char**)); |
| 68 | DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, | ||
| 69 | (sqlite3*, const char*, const char*, char**)); | ||
| 70 | DEF_DLL_FN (SQLITE_API int, sqlite3_prepare_v2, | 68 | DEF_DLL_FN (SQLITE_API int, sqlite3_prepare_v2, |
| 71 | (sqlite3*, const char*, int, sqlite3_stmt**, const char**)); | 69 | (sqlite3*, const char*, int, sqlite3_stmt**, const char**)); |
| 72 | 70 | ||
| 71 | # ifdef HAVE_SQLITE3_LOAD_EXTENSION | ||
| 72 | DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, | ||
| 73 | (sqlite3*, const char*, const char*, char**)); | ||
| 74 | # undef sqlite3_load_extension | ||
| 75 | # define sqlite3_load_extension fn_sqlite3_load_extension | ||
| 76 | # endif | ||
| 77 | |||
| 73 | # undef sqlite3_finalize | 78 | # undef sqlite3_finalize |
| 74 | # undef sqlite3_close | 79 | # undef sqlite3_close |
| 75 | # undef sqlite3_open_v2 | 80 | # undef sqlite3_open_v2 |
| @@ -91,7 +96,6 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_prepare_v2, | |||
| 91 | # undef sqlite3_column_text | 96 | # undef sqlite3_column_text |
| 92 | # undef sqlite3_column_name | 97 | # undef sqlite3_column_name |
| 93 | # undef sqlite3_exec | 98 | # undef sqlite3_exec |
| 94 | # undef sqlite3_load_extension | ||
| 95 | # undef sqlite3_prepare_v2 | 99 | # undef sqlite3_prepare_v2 |
| 96 | 100 | ||
| 97 | # define sqlite3_finalize fn_sqlite3_finalize | 101 | # define sqlite3_finalize fn_sqlite3_finalize |
| @@ -115,7 +119,6 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_prepare_v2, | |||
| 115 | # define sqlite3_column_text fn_sqlite3_column_text | 119 | # define sqlite3_column_text fn_sqlite3_column_text |
| 116 | # define sqlite3_column_name fn_sqlite3_column_name | 120 | # define sqlite3_column_name fn_sqlite3_column_name |
| 117 | # define sqlite3_exec fn_sqlite3_exec | 121 | # define sqlite3_exec fn_sqlite3_exec |
| 118 | # define sqlite3_load_extension fn_sqlite3_load_extension | ||
| 119 | # define sqlite3_prepare_v2 fn_sqlite3_prepare_v2 | 122 | # define sqlite3_prepare_v2 fn_sqlite3_prepare_v2 |
| 120 | 123 | ||
| 121 | static bool | 124 | static bool |
| @@ -142,7 +145,9 @@ load_dll_functions (HMODULE library) | |||
| 142 | LOAD_DLL_FN (library, sqlite3_column_text); | 145 | LOAD_DLL_FN (library, sqlite3_column_text); |
| 143 | LOAD_DLL_FN (library, sqlite3_column_name); | 146 | LOAD_DLL_FN (library, sqlite3_column_name); |
| 144 | LOAD_DLL_FN (library, sqlite3_exec); | 147 | LOAD_DLL_FN (library, sqlite3_exec); |
| 148 | # ifdef HAVE_SQLITE3_LOAD_EXTENSION | ||
| 145 | LOAD_DLL_FN (library, sqlite3_load_extension); | 149 | LOAD_DLL_FN (library, sqlite3_load_extension); |
| 150 | # endif | ||
| 146 | LOAD_DLL_FN (library, sqlite3_prepare_v2); | 151 | LOAD_DLL_FN (library, sqlite3_prepare_v2); |
| 147 | return true; | 152 | return true; |
| 148 | } | 153 | } |
| @@ -576,6 +581,7 @@ DEFUN ("sqlite-rollback", Fsqlite_rollback, Ssqlite_rollback, 1, 1, 0, | |||
| 576 | return sqlite_exec (XSQLITE (db)->db, "rollback"); | 581 | return sqlite_exec (XSQLITE (db)->db, "rollback"); |
| 577 | } | 582 | } |
| 578 | 583 | ||
| 584 | #ifdef HAVE_SQLITE3_LOAD_EXTENSION | ||
| 579 | DEFUN ("sqlite-load-extension", Fsqlite_load_extension, | 585 | DEFUN ("sqlite-load-extension", Fsqlite_load_extension, |
| 580 | Ssqlite_load_extension, 2, 2, 0, | 586 | Ssqlite_load_extension, 2, 2, 0, |
| 581 | doc: /* Load an SQlite module into DB. | 587 | doc: /* Load an SQlite module into DB. |
| @@ -593,6 +599,7 @@ MODULE should be the file name of an SQlite module .so file. */) | |||
| 593 | return Qt; | 599 | return Qt; |
| 594 | return Qnil; | 600 | return Qnil; |
| 595 | } | 601 | } |
| 602 | #endif /* HAVE_SQLITE3_LOAD_EXTENSION */ | ||
| 596 | 603 | ||
| 597 | DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, | 604 | DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, |
| 598 | doc: /* Return the next result set from SET. */) | 605 | doc: /* Return the next result set from SET. */) |
| @@ -691,7 +698,9 @@ syms_of_sqlite (void) | |||
| 691 | defsubr (&Ssqlite_transaction); | 698 | defsubr (&Ssqlite_transaction); |
| 692 | defsubr (&Ssqlite_commit); | 699 | defsubr (&Ssqlite_commit); |
| 693 | defsubr (&Ssqlite_rollback); | 700 | defsubr (&Ssqlite_rollback); |
| 701 | #ifdef HAVE_SQLITE3_LOAD_EXTENSION | ||
| 694 | defsubr (&Ssqlite_load_extension); | 702 | defsubr (&Ssqlite_load_extension); |
| 703 | #endif | ||
| 695 | defsubr (&Ssqlite_next); | 704 | defsubr (&Ssqlite_next); |
| 696 | defsubr (&Ssqlite_columns); | 705 | defsubr (&Ssqlite_columns); |
| 697 | defsubr (&Ssqlite_more_p); | 706 | defsubr (&Ssqlite_more_p); |