Method: WIKK::SQL.each_hash
- Defined in:
- lib/wikk_sql.rb
.each_hash(db_config, query, with_table_names = false) {|each| ... } ⇒ Object
Note:
@result and @affected_rows are also set via call to query().
Create WIKK::SQL instance and set up the mySQL connection, and Run a query on the DB server. Yields query result row by row, as Hash, using String keys
227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/wikk_sql.rb', line 227 def self.each_hash(db_config, query, with_table_names=false) sql = self.new sql.open db_config begin if block_given? sql.each_hash(query, with_table_names) do |res| yield res end end ensure sql.close end return sql end |