mysql2の複文問い合わせを行いたいのですが、うまくできませんでした。
queryのところを複文で表現したいのですが、下記のエラーが出てしまいます。
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax … (Mysql2::Error)
ruby
1client = Mysql2::Client.new(:host => '127.0.0.1', :username => 'root', :password => 'root', :database => “test”, :multipleStatements => true)#複文問い合わせをOKにしておく 2 3query = %{insert into table( title , content ) values( 'タイトル', '本文' ); 4insert into table( date ) values( ‘2017–02-21’ ) where last_insert_id() as ID;} 5 6puts query 7 8results = client.query(query)
どうぞよろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。