Skip to content

0.3.12

Compare
Choose a tag to compare
@brianmario brianmario released this 15 Jul 23:50
· 874 commits to master since this release

New features

  • We're compatible with Ruby 2.0.0 now!
  • A new :streaming option can be passed while issuing a query which will leave the results on the server side and stream them to the client a row-at-a-time. This is great for really large datasets.
  • Mysql2::Client#abandon_results! has been introduced which lets you throw away result sets in an efficient manner.
  • Mysql2::Client#select_db has been introduced allowing you to select which database a connection is using without needing to issue a query.
  • Mysql2::Client#more_results? has been introduced which is used to check if there are more results to be read when CLIENT_MULTI_STATEMENTS is enabled.
  • Mysql2::Client#next_result has been introduced which is used to step the result cursor forward by one when CLIENT_MULTI_STATEMENTS is enabled.
  • Mysql2::Client#store_result has been introduced which allows you to read the next result off the wire when CLIENT_MULTI_STATEMENTS is enabled.
  • Mysql2::Client#reconnect= has been introduced which allows you to change the reconnect behavior of libmysql while a connection is active.
  • Mysql2::Client#warning_count has been introduced which returns the warning count from the most recent query.
  • Mysql2::Client#query_info_string has been introduced which returns an informational string returned by the server about the most recent query.
  • The read_timeout connection option has been introduced allowing you to set the read timeout of the connection in seconds.
  • The write_timeout connection option has been introduced allowing you to set the write timeout of the connection in seconds.
  • The local_infile connection option has been introduced which allows you to enable LOCAL INFILE support.
  • BIT field values can be used as boolean fields when cast_bool is enabled.
  • We now respect fractional seconds in TIMESTAMP and DATETIME fields (this was introduced in Mysql 5.6.4).

Bug Fixes

  • Fix a really long-standing double-free bug related to a Mysql2::Client being freed before a Mysql2::Result that was generated from it. We now do our own refcounting in C as well as a Ruby reference to a Mysql2::Client from it's Mysql2::Result's.
  • Fix a compile bug when using the mysql-connector-c related to version compatibility checks in mysql2
  • A more explicit error is raised when a single connection is attempted to be shared across threads
  • We're more protected against GC-related bugs when compiler optimizations may keep a Ruby object pointer from being visible during GC runs.
  • Fix an integer overflow bug with the CLIENT_ constant values
  • Compiling the gem should be a little more robust. Some changes were made to extconf to try and make sure we can find libmysql when linking.
  • Make sure we read values from the various TIME/DATE field types as unsigned integers.
  • Mysql2::Client::EM shouldn't swallow exceptions raised in the deferrable callbacks.
  • Passing options to Mysql2::Client#query should no longer persist on the Mysql2::Client object itself but instead only apply to the Mysql2::Result object created by the query as intended.
  • Reading Mysql2::Client#affected_rows or Mysql2::Client#last_id after a result has been freed should no longer return garbage.

Optimizations

  • Push mysql<->ruby encoding mapping table down into C for a nice speedup
  • Use a faster Hash#dup on 1.8.7 when cascading the options hash through Mysql2's objects
  • We use rb_intern3 if it's available to create symbol keys when symbolize_keys is enabled to skip creating an intermediary Ruby String.

View the diff here