ruby - mysql2 MULTI_STATEMENTS and error reporting -


i submit multiple database queries using single call mysql2 client. client configured using mysql2::client::multi_statements flag.

if 1 of queries has syntax error, want call fail, succeeds unless error in first statement.

my test code below. there way accomplish while still using multi-statement queries (and not sending each query separately)?

require 'mysql2/em'  def database   @database ||= mysql2::em::client.new(flags: mysql2::client::multi_statements) end  em.run {   database.query('select rand(1);bad syntax;').callback {|rs|     rs.each {|r|       p r     }     em.stop   }.errback {|e|     p e     em.stop   } } 


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -