File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -156,10 +156,23 @@ Mysql2::Client.new(
156156 :local_infile = true / false ,
157157 :secure_auth = true / false ,
158158 :default_file = ' /path/to/my.cfg' ,
159- :default_group = ' my.cfg section'
159+ :default_group = ' my.cfg section' ,
160+ :init_command => sql
160161 )
161162```
162163
164+ ### init_command
165+
166+ If you specify the init_command option, the SQL string you provide will be executed after the connection is established.
167+
168+ If ` :reconnect ` is set to ` true ` , init_command will also be executed after a successful reconnect.
169+
170+ It is useful if you want to provide session options which survive reconnection.
171+
172+ ``` ruby
173+ Mysql2 ::Client .new (:init_command => " SET @@SESSION.sql_mode = 'STRICT_ALL_TABLES'" )
174+ ```
175+
163176### SSL options
164177
165178Setting any of the following options will enable an SSL connection, but only if
You can’t perform that action at this time.
0 commit comments