File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -217,8 +217,17 @@ public final class MySQL {
217217 return MYSQL_ENABLE_CLEARTEXT_PLUGIN
218218 case MySQLOpt . MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS:
219219 return MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
220- }
221- }
220+ }
221+ }
222+
223+ func exposedOptionToMySQLServerOption( _ o: MySQLServerOpt ) -> enum_mysql_set_option {
224+ switch o {
225+ case MySQLServerOpt . MYSQL_OPTION_MULTI_STATEMENTS_ON:
226+ return MYSQL_OPTION_MULTI_STATEMENTS_ON
227+ case MySQLServerOpt . MYSQL_OPTION_MULTI_STATEMENTS_OFF:
228+ return MYSQL_OPTION_MULTI_STATEMENTS_OFF
229+ }
230+ }
222231
223232 /// Sets connect options for connect()
224233 @discardableResult
@@ -249,6 +258,12 @@ public final class MySQL {
249258 }
250259 return b
251260 }
261+
262+ /// Sets connect options after connect()
263+ @discardableResult
264+ public func setServerOption( _ option: MySQLServerOpt ) -> Bool {
265+ return mysql_set_server_option ( mysqlPtr, exposedOptionToMySQLServerOption ( option) ) == 0
266+ }
252267
253268 /// Class used to manage and interact with result sets
254269 public final class Results : IteratorProtocol {
Original file line number Diff line number Diff line change @@ -111,4 +111,8 @@ public enum MySQLOpt {
111111 MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
112112}
113113
114+ /// enum for mysql options
115+ public enum MySQLServerOpt {
116+ case MYSQL_OPTION_MULTI_STATEMENTS_ON, MYSQL_OPTION_MULTI_STATEMENTS_OFF
117+ }
114118
You can’t perform that action at this time.
0 commit comments