Skip to content

Commit

Permalink
spec for insert/updates in raw mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Feb 20, 2009
1 parent 7ffe57a commit b2ac78c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/em/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,20 @@ def SQL(query, &blk) SQL.select(query, &blk) end
}
end

should 'allow access to insert_id in raw mode' do
SQL.raw('insert into evented_mysql_test (num) values (20), (21), (22)'){ |mysql|
mysql.insert_id.should == 4
done
}
end

should 'allow access to affected_rows in raw mode' do
SQL.raw('update evented_mysql_test set num = num + 10'){ |mysql|
mysql.affected_rows.should == 6
done
}
end

should 'fire error callback with exceptions' do
SQL.settings.update :on_error => proc{ |e|
e.class.should == Mysql::Error
Expand Down

0 comments on commit b2ac78c

Please sign in to comment.