|
1 | 1 | /*
|
2 |
| - Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
| 2 | + Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
3 | 3 |
|
4 | 4 | This program is free software; you can redistribute it and/or modify
|
5 | 5 | it under the terms of the GNU General Public License as published by
|
@@ -50,19 +50,6 @@ Mysql_connection_options::Mysql_connection_options(Abstract_program *program)
|
50 | 50 | this->add_provider(&this->m_ssl_options_provider);
|
51 | 51 | }
|
52 | 52 |
|
53 |
| -Mysql_connection_options::~Mysql_connection_options() |
54 |
| -{ |
55 |
| - my_boost::mutex::scoped_lock lock(m_connection_mutex); |
56 |
| - for (vector<MYSQL*>::iterator it= this->m_allocated_connections.begin(); |
57 |
| - it != this->m_allocated_connections.end(); it++) |
58 |
| - { |
59 |
| - if (*it) |
60 |
| - { |
61 |
| - mysql_close(*it); |
62 |
| - } |
63 |
| - } |
64 |
| -} |
65 |
| - |
66 | 53 | void Mysql_connection_options::create_options()
|
67 | 54 | {
|
68 | 55 | this->create_new_option(&this->m_bind_addr, "bind-address",
|
@@ -129,13 +116,7 @@ void Mysql_connection_options::create_options()
|
129 | 116 |
|
130 | 117 | MYSQL* Mysql_connection_options::create_connection()
|
131 | 118 | {
|
132 |
| - MYSQL *connection = new MYSQL; |
133 |
| - |
134 |
| - { |
135 |
| - my_boost::mutex::scoped_lock lock(m_connection_mutex); |
136 |
| - this->m_allocated_connections.push_back(connection); |
137 |
| - } |
138 |
| - mysql_init(connection); |
| 119 | + MYSQL *connection= mysql_init(NULL); |
139 | 120 | if (this->m_compress)
|
140 | 121 | mysql_options(connection, MYSQL_OPT_COMPRESS, NullS);
|
141 | 122 |
|
@@ -184,6 +165,7 @@ MYSQL* Mysql_connection_options::create_connection()
|
184 | 165 | this->get_null_or_string(this->m_mysql_unix_port), 0))
|
185 | 166 | {
|
186 | 167 | this->db_error(connection, "while connecting to the MySQL server");
|
| 168 | + mysql_close(connection); |
187 | 169 | return NULL;
|
188 | 170 | }
|
189 | 171 |
|
@@ -218,22 +200,22 @@ const char* Mysql_connection_options::get_null_or_string(
|
218 | 200 |
|
219 | 201 | #ifdef _WIN32
|
220 | 202 | void Mysql_connection_options::pipe_protocol_callback(
|
221 |
| - char* not_used __attribute__((unused))) |
| 203 | + char* not_used MY_ATTRIBUTE((unused))) |
222 | 204 | {
|
223 | 205 | this->m_protocol= MYSQL_PROTOCOL_PIPE;
|
224 | 206 | }
|
225 | 207 | #endif
|
226 | 208 |
|
227 | 209 | void Mysql_connection_options::protocol_callback(
|
228 |
| - char* not_used __attribute__((unused))) |
| 210 | + char* not_used MY_ATTRIBUTE((unused))) |
229 | 211 | {
|
230 | 212 | this->m_protocol=
|
231 | 213 | find_type_or_exit(this->m_protocol_string.value().c_str(),
|
232 | 214 | &sql_protocol_typelib, "protocol");
|
233 | 215 | }
|
234 | 216 |
|
235 | 217 | void Mysql_connection_options::secure_auth_callback(
|
236 |
| - char* not_used __attribute__((unused))) |
| 218 | + char* not_used MY_ATTRIBUTE((unused))) |
237 | 219 | {
|
238 | 220 | /* --secure-auth is a zombie option. */
|
239 | 221 | if (!this->m_secure_auth)
|
|
0 commit comments