MySQL 9.1.0
Source Code Documentation
my_default.h File Reference
#include <sys/types.h>
#include "my_inttypes.h"
#include "my_macros.h"

Go to the source code of this file.

Typedefs

typedef int(* Process_option_func) (void *ctx, const char *group_name, const char *option, const char *cnf_file)
 

Functions

void set_persist_args_separator (char **arg)
 
bool my_getopt_is_args_separator (const char *arg)
 
bool my_getopt_is_ro_persist_args_separator (const char *arg)
 
int get_defaults_options (int argc, char **argv, char **defaults, char **extra_defaults, char **group_suffix, char **login_path, bool found_no_defaults, bool *found_no_login_paths)
 
int my_load_defaults (const char *conf_file, const char **groups, int *argc, char ***argv, MEM_ROOT *alloc, const char ***)
 
int check_file_permissions (const char *file_name, bool is_login_file, myf MyFlags=0)
 Check file permissions of the option file. More...
 
int load_defaults (const char *conf_file, const char **groups, int *argc, char ***argv, MEM_ROOT *alloc)
 
int my_search_option_files (const char *conf_file, int *argc, char ***argv, uint *args_used, Process_option_func func, void *func_ctx, const char **default_directories, bool is_login_file, bool found_no_defaults)
 
void my_print_default_files (const char *conf_file)
 
void print_defaults (const char *conf_file, const char **groups)
 
void init_variable_default_paths ()
 Initialize all the mappings between default config file paths/ command line options/persistent config file path/login file path and corresponding enum_variable_source values. More...
 
void update_variable_source (const char *opt_name, const char *config_file)
 Track all options loaded from config files and command line options along with the path from where options are loaded. More...
 
void set_variable_source (const char *opt_name, void *value)
 This function will set value for my_option::arg_source by doing a lookup into variables_hash based on opt_name as key. More...
 

Variables

const char * my_defaults_extra_file
 
const char * my_defaults_group_suffix
 
const char * my_defaults_file
 
bool my_getopt_use_args_separator
 
bool my_defaults_read_login_file
 A global to turn off or on reading the mylogin file. More...
 
bool no_defaults
 
char datadir_buffer []
 Holds a reference to the directory where the persisted configuration file is located. More...
 

Typedef Documentation

◆ Process_option_func

typedef int(* Process_option_func) (void *ctx, const char *group_name, const char *option, const char *cnf_file)

Function Documentation

◆ check_file_permissions()

int check_file_permissions ( const char *  file_name,
bool  is_login_file,
myf  flags 
)

Check file permissions of the option file.

Parameters
[in]file_nameName of the option file.
[in]is_login_fileTRUE, when login file is being processed.
[in]flagserror handling flags
Returns
0 - Non-allowable file permissions. 1 - Failed to stat. 2 - Success.

◆ get_defaults_options()

int get_defaults_options ( int  argc,
char **  argv,
char **  defaults,
char **  extra_defaults,
char **  group_suffix,
char **  login_path,
bool  found_no_defaults,
bool *  found_no_login_paths 
)

◆ init_variable_default_paths()

void init_variable_default_paths ( )

Initialize all the mappings between default config file paths/ command line options/persistent config file path/login file path and corresponding enum_variable_source values.

◆ load_defaults()

int load_defaults ( const char *  conf_file,
const char **  groups,
int *  argc,
char ***  argv,
MEM_ROOT alloc 
)

◆ my_getopt_is_args_separator()

bool my_getopt_is_args_separator ( const char *  arg)

◆ my_getopt_is_ro_persist_args_separator()

bool my_getopt_is_ro_persist_args_separator ( const char *  arg)

◆ my_load_defaults()

int my_load_defaults ( const char *  conf_file,
const char **  groups,
int *  argc,
char ***  argv,
MEM_ROOT alloc,
const char ***  default_directories 
)

◆ my_print_default_files()

void my_print_default_files ( const char *  conf_file)

◆ my_search_option_files()

int my_search_option_files ( const char *  conf_file,
int *  argc,
char ***  argv,
uint *  args_used,
Process_option_func  func,
void *  func_ctx,
const char **  default_directories,
bool  is_login_file,
bool  found_no_defaults 
)

copy group

Construct new group

copy group

Construct new group

◆ print_defaults()

void print_defaults ( const char *  conf_file,
const char **  groups 
)

◆ set_persist_args_separator()

void set_persist_args_separator ( char **  arg)

◆ set_variable_source()

void set_variable_source ( const char *  opt_name,
void *  value 
)

This function will set value for my_option::arg_source by doing a lookup into variables_hash based on opt_name as key.

If key is present corresponding value (config file, enum value) will be set in value.

Parameters
[in]opt_namePointer to option name.
[out]valuePointer to struct holding config file path and variable source

◆ update_variable_source()

void update_variable_source ( const char *  opt_name,
const char *  value 
)

Track all options loaded from config files and command line options along with the path from where options are loaded.

For command line options path is empty string.

Ex: /etc/my.cnf has max_connections /$datadir/mysqld.auto.cnf has max_user_connections ./mysqld –server-id=47 with this setup, variables_hash has 3 entries of the above options along with path of config files and its enum value which is as below: max_connections -> (/etc/my.cnf , enum_variable_source::GLOBAL) max_user_connections -> ($datadir/mysqld.auto.cnf , enum_variable_source::PERSISTED) server-id -> ("" , enum_variable_source::COMMAND_LINE)

Parameters
[in]opt_namePointer to option name. opt_name must be in the form off –XXXXXX
[in]valuePointer to config file path

Variable Documentation

◆ datadir_buffer

char datadir_buffer[]
extern

Holds a reference to the directory where the persisted configuration file is located.

This usually is the data directory. This is different from mysql_real_data_home mostly because it's passed down to mysys. And is also filled in a bit differently from mysql_real_data_home by Persisted_variables_cache::init()

◆ my_defaults_extra_file

const char* my_defaults_extra_file
extern

◆ my_defaults_file

const char* my_defaults_file
extern

◆ my_defaults_group_suffix

const char* my_defaults_group_suffix
extern

◆ my_defaults_read_login_file

bool my_defaults_read_login_file
extern

A global to turn off or on reading the mylogin file.

On by default

◆ my_getopt_use_args_separator

bool my_getopt_use_args_separator
extern

◆ no_defaults

bool no_defaults
extern