diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 5 | ||||
-rw-r--r-- | src/sql.c | 10 | ||||
-rw-r--r-- | src/sql.h | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c index 28734d0..e46c2f5 100644 --- a/src/config.c +++ b/src/config.c @@ -632,2 +632,7 @@ cb_sql (enum grecs_callback_command cmd, static struct grecs_keyword sql_kw[] = { + { "config-file", N_("file"), N_("Read MySQL configuration from <file>"), + grecs_type_string, NULL, offsetof(struct sqlconn, config_file) }, + { "config-group", N_("name"), + N_("Read the named group from the SQL configuration file"), + grecs_type_string, NULL, offsetof(struct sqlconn, config_group) }, { "host", N_("host"), N_("Set SQL server hostname or IP address"), @@ -72,2 +72,10 @@ sql_init_dictionary (struct dictionary *dict) mysql_init (&conn->mysql); + + if (conn->config_file) + mysql_options (&conn->mysql, MYSQL_READ_DEFAULT_FILE, + conn->config_file); + if (conn->config_group) + mysql_options (&conn->mysql, MYSQL_READ_DEFAULT_GROUP, + conn->config_group); + if (conn->cacert) @@ -77,3 +85,3 @@ sql_init_dictionary (struct dictionary *dict) conn->password, conn->database, conn->port, - conn->socket, 0)) + conn->socket, CLIENT_MULTI_RESULTS)) { @@ -21,2 +21,4 @@ struct sqlconn char *ident; + char *config_file; + char *config_group; char *host; |