brianmario / mysql2

A modern, simple and very fast Mysql library for Ruby - binding to libmysql
http://github.com/brianmario/mysql2
MIT License
2.25k stars 551 forks source link

:as => :column #261

Open snarglebritchet opened 12 years ago

snarglebritchet commented 12 years ago

Please add a new :as type called :column which

  1. yields each row as a single item, which may be nil, or returns all items as a flat array
  2. complains if the number of returned columns is >1

It's equivalent to :as => :array and then using row[0], but avoids building garbage arrays.

brianmario commented 12 years ago

Not a bad idea. I might try and hack on this soon.