On 22 янв, 15:43, Leonid Borisenko <[EMAIL PROTECTED]> wrote:
> Hello.
>
> Here are patches to Sequel ODBC adapter.
There are could be more than one unnamed column in resultset. So
previous patch must be patched. :)
One more bug was fixed also. Description: empty resultset could be
retrieved after executing query and ODBC method '#fetch_all' on empty
resultset returns nil. Fix prevents iterating on such returned result.
module Sequel
module ODBC
class Dataset
UNNAMED_COLUMN_PSEUDO = 'unnamed_'.freeze
def fetch_rows(sql, &block)
@db.synchronize do
s = @db.execute sql
begin
# PATCH start
unnamed_idx = 0
@columns = s.columns(true).map do |c|
if c.name.empty?
unnamed_idx += 1
UNNAMED_COLUMN_PSEUDO + unnamed_idx.to_s
else c.name end.to_sym
end
# PATCH end
rows = s.fetch_all
# PATCH start
rows.each {|row| yield hash_row(row)} if rows
# PATCH end
ensure
s.drop unless s.nil? rescue nil
end
end
self
end
end #class Dataset
end #module ODBC
end #module Sequel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---