1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-21166 Add Mroonga initialized check to Mroonga UDFs

Mroonga UDFs can't be used without loading Mroonga.
This commit is contained in:
Sutou Kouhei
2024-06-04 17:38:14 +09:00
committed by Daniel Black
parent 49dff5a4b6
commit 383d53edbc
11 changed files with 110 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
*/
#include <mrn.hpp>
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
#include <mrn_err.h>
@@ -135,6 +136,13 @@ MRN_API my_bool mroonga_snippet_init(UDF_INIT *init, UDF_ARGS *args, char *messa
st_mrn_snip_info *snip_info = NULL;
bool can_open_snippet = TRUE;
init->ptr = NULL;
if (!mrn_initialized)
{
snprintf(message,
MYSQL_ERRMSG_SIZE,
"mroonga_snippet(): Mroonga isn't initialized");
goto error;
}
if (args->arg_count < 11 || (args->arg_count - 11) % 3)
{
sprintf(message, "Incorrect number of arguments for mroonga_snippet(): %u",