Skip to content

Commit 5a64b34

Browse files
authored
Fix #167 (#168)
* Fix #167 (use if ... end rather than if ... elseif ... end in setoptions!) * Add a keyword argument to setoptions! for enable_cleartext_plugin * Add line to docstring for DBInterface.connect, re: enable_cleartext_plugin support. * Remove unnecessary cleartext option
1 parent 85bdb29 commit 5a64b34

File tree

1 file changed

+62
-31
lines changed

1 file changed

+62
-31
lines changed

src/MySQL.jl

+62-31
Original file line numberDiff line numberDiff line change
@@ -137,67 +137,98 @@ function setoptions!(mysql;
137137
)
138138
if init_command !== nothing
139139
API.setoption(mysql, API.MYSQL_INIT_COMMAND, init_command)
140-
elseif connect_timeout !== nothing
140+
end
141+
if connect_timeout !== nothing
141142
API.setoption(mysql, API.MYSQL_OPT_CONNECT_TIMEOUT, connect_timeout)
142-
elseif reconnect !== nothing
143+
end
144+
if reconnect !== nothing
143145
API.setoption(mysql, API.MYSQL_OPT_RECONNECT, reconnect)
144-
elseif read_timeout !== nothing
146+
end
147+
if read_timeout !== nothing
145148
API.setoption(mysql, API.MYSQL_OPT_READ_TIMEOUT, read_timeout)
146-
elseif write_timeout !== nothing
149+
end
150+
if write_timeout !== nothing
147151
API.setoption(mysql, API.MYSQL_OPT_WRITE_TIMEOUT, write_timeout)
148-
elseif data_truncation !== nothing
152+
end
153+
if data_truncation !== nothing
149154
API.setoption(mysql, API.MYSQL_REPORT_DATA_TRUNCATION, data_truncation)
150-
elseif charset_dir !== nothing
155+
end
156+
if charset_dir !== nothing
151157
API.setoption(mysql, API.MYSQL_SET_CHARSET_DIR, charset_dir)
152-
elseif charset_name !== nothing
158+
end
159+
if charset_name !== nothing
153160
API.setoption(mysql, API.MYSQL_SET_CHARSET_NAME, charset_name)
154-
elseif bind !== nothing
161+
end
162+
if bind !== nothing
155163
API.setoption(mysql, API.MYSQL_OPT_BIND, bind)
156-
elseif max_allowed_packet !== nothing
164+
end
165+
if max_allowed_packet !== nothing
157166
API.setoption(mysql, API.MYSQL_OPT_MAX_ALLOWED_PACKET, max_allowed_packet)
158-
elseif net_buffer_length !== nothing
167+
end
168+
if net_buffer_length !== nothing
159169
API.setoption(mysql, API.MYSQL_OPT_NET_BUFFER_LENGTH, net_buffer_length)
160-
elseif named_pipe !== nothing
170+
end
171+
if named_pipe !== nothing
161172
API.setoption(mysql, API.MYSQL_OPT_NAMED_PIPE, named_pipe)
162-
elseif protocol !== nothing
173+
end
174+
if protocol !== nothing
163175
API.setoption(mysql, API.MYSQL_OPT_PROTOCOL, protocol)
164-
elseif ssl_key !== nothing
176+
end
177+
if ssl_key !== nothing
165178
API.setoption(mysql, API.MYSQL_OPT_SSL_KEY, ssl_key)
166-
elseif ssl_cert !== nothing
179+
end
180+
if ssl_cert !== nothing
167181
API.setoption(mysql, API.MYSQL_OPT_SSL_CERT, ssl_cert)
168-
elseif ssl_ca !== nothing
182+
end
183+
if ssl_ca !== nothing
169184
API.setoption(mysql, API.MYSQL_OPT_SSL_CA, ssl_ca)
170-
elseif ssl_capath !== nothing
185+
end
186+
if ssl_capath !== nothing
171187
API.setoption(mysql, API.MYSQL_OPT_SSL_CAPATH, ssl_capath)
172-
elseif ssl_cipher !== nothing
188+
end
189+
if ssl_cipher !== nothing
173190
API.setoption(mysql, API.MYSQL_OPT_SSL_CIPHER, ssl_cipher)
174-
elseif ssl_crl !== nothing
191+
end
192+
if ssl_crl !== nothing
175193
API.setoption(mysql, API.MYSQL_OPT_SSL_CRL, ssl_crl)
176-
elseif ssl_crlpath !== nothing
194+
end
195+
if ssl_crlpath !== nothing
177196
API.setoption(mysql, API.MYSQL_OPT_SSL_CRLPATH, ssl_crlpath)
178-
elseif passphrase !== nothing
197+
end
198+
if passphrase !== nothing
179199
API.setoption(mysql, API.MARIADB_OPT_TLS_PASSPHRASE, passphrase)
180-
elseif ssl_verify_server_cert !== nothing
200+
end
201+
if ssl_verify_server_cert !== nothing
181202
API.setoption(mysql, API.MYSQL_OPT_SSL_VERIFY_SERVER_CERT, ssl_verify_server_cert)
182-
elseif ssl_enforce !== nothing
203+
end
204+
if ssl_enforce !== nothing
183205
API.setoption(mysql, API.MYSQL_OPT_SSL_ENFORCE, ssl_enforce)
184-
elseif default_auth !== nothing
206+
end
207+
if default_auth !== nothing
185208
API.setoption(mysql, API.MYSQL_DEFAULT_AUTH, default_auth)
186-
elseif connection_handler !== nothing
209+
end
210+
if connection_handler !== nothing
187211
API.setoption(mysql, API.MARIADB_OPT_CONNECTION_HANDLER, connection_handler)
188-
elseif plugin_dir !== nothing
212+
end
213+
if plugin_dir !== nothing
189214
API.setoption(mysql, API.MYSQL_PLUGIN_DIR, plugin_dir)
190-
elseif secure_auth !== nothing
215+
end
216+
if secure_auth !== nothing
191217
API.setoption(mysql, API.MYSQL_SECURE_AUTH, secure_auth)
192-
elseif server_public_key !== nothing
218+
end
219+
if server_public_key !== nothing
193220
API.setoption(mysql, API.MYSQL_SERVER_PUBLIC_KEY, server_public_key)
194-
elseif read_default_file !== nothing && read_default_file
221+
end
222+
if read_default_file !== nothing && read_default_file
195223
API.setoption(mysql, API.MYSQL_READ_DEFAULT_FILE, C_NULL)
196-
elseif option_file !== nothing
224+
end
225+
if option_file !== nothing
197226
API.setoption(mysql, API.MYSQL_READ_DEFAULT_FILE, option_file)
198-
elseif read_default_group !== nothing && read_default_group
227+
end
228+
if read_default_group !== nothing && read_default_group
199229
API.setoption(mysql, API.MYSQL_READ_DEFAULT_GROUP, C_NULL)
200-
elseif option_group !== nothing
230+
end
231+
if option_group !== nothing
201232
API.setoption(mysql, API.MYSQL_READ_DEFAULT_GROUP, option_group)
202233
end
203234
return

0 commit comments

Comments
 (0)