diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-01-06 13:25:39 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-01-06 13:25:39 +0200 |
commit | 1a0f319a747220e48bde4fae8b80c0b00d22e69c (patch) | |
tree | 5912bfb14ac3d26b29eff947ded1eefa008e80be /src/sql.c | |
parent | fa78a9f21ff4fd85fb568232c9bee957b9c83497 (diff) | |
download | wydawca-1a0f319a747220e48bde4fae8b80c0b00d22e69c.tar.gz wydawca-1a0f319a747220e48bde4fae8b80c0b00d22e69c.tar.bz2 |
Improve SQL configuration.
* src/config.c (sql_kw): New statements: config-file and
config-group.
* src/sql.c (sql_init_dictionary): Handle config-file and
config-group. Set CLIENT_MULTI_RESULTS option.
* src/sql.h (struct sqlconn): New members: config_file and
config_group.
* NEWS, doc/wydawca.texi: Update.
Diffstat (limited to 'src/sql.c')
-rw-r--r-- | src/sql.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -70,12 +70,20 @@ sql_init_dictionary (struct dictionary *dict) | |||
70 | if (conn->initcount++ == 0) | 70 | if (conn->initcount++ == 0) |
71 | { | 71 | { |
72 | mysql_init (&conn->mysql); | 72 | mysql_init (&conn->mysql); |
73 | |||
74 | if (conn->config_file) | ||
75 | mysql_options (&conn->mysql, MYSQL_READ_DEFAULT_FILE, | ||
76 | conn->config_file); | ||
77 | if (conn->config_group) | ||
78 | mysql_options (&conn->mysql, MYSQL_READ_DEFAULT_GROUP, | ||
79 | conn->config_group); | ||
80 | |||
73 | if (conn->cacert) | 81 | if (conn->cacert) |
74 | mysql_ssl_set (&conn->mysql, NULL, NULL, conn->cacert, | 82 | mysql_ssl_set (&conn->mysql, NULL, NULL, conn->cacert, |
75 | NULL, NULL); | 83 | NULL, NULL); |
76 | if (!mysql_real_connect (&conn->mysql, conn->host, conn->user, | 84 | if (!mysql_real_connect (&conn->mysql, conn->host, conn->user, |
77 | conn->password, conn->database, conn->port, | 85 | conn->password, conn->database, conn->port, |
78 | conn->socket, 0)) | 86 | conn->socket, CLIENT_MULTI_RESULTS)) |
79 | { | 87 | { |
80 | logmsg (LOG_ERR, _("failed to connect to database %s: error: %s\n"), | 88 | logmsg (LOG_ERR, _("failed to connect to database %s: error: %s\n"), |
81 | dict->parmv[0], mysql_error (&conn->mysql)); | 89 | dict->parmv[0], mysql_error (&conn->mysql)); |