How to read config data in UDF
I'm designing a MySQL UDF (or possibly family of UDFs) to accomplish a certain task. The UDF depends on some "configuration information" (among other things, the hostname for a server). I'd rather not pass that in as an argument to every function call. I can think of a few ways to do it...
1. As a set of environment variables, read them with getenv()
2. As a plain-text configuration file in a well-known place (perhaps "/etc/mysql", or the mysql data directory), and read and parse it in xxx_init()
3. As a table-row in a new table in the `mysql` schema
Any advice on the benefits and drawbacks of the various options?
For option 2, is there a server variable I should consider for that "well-known place" instead of hard-coding it? If so, what's the proper way to read a server veriable from within a C++ UDF?
For option 3, what's the proper way to read one row from one table from within a C++ UDF?
Subject
Views
Written By
Posted
How to read config data in UDF
309
July 04, 2025 09:54PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.