wuhuizhong 发表于 2013-2-1 09:57:41

Sequel访问Oracle CLOB

修改oracle.rb中的fetch_rows,原代碼:
      def fetch_rows(sql)      execute(sql) do |cursor|          begin            @columns = cursor.get_col_names.map{|c| output_identifier(c)}            while r = cursor.fetch            row = {}            r.each_with_index {|v, i| row[@columns] = v unless @columns == :raw_rnum_}            yield row            end          ensure            cursor.close          end      end      self      end 修改后:
      def fetch_rows(sql, &block)      execute(sql) do |cursor|          begin            @columns = cursor.get_col_names.map {|c| c.downcase.to_sym}            while r = cursor.fetch            row = {}            r.each_with_index do |v, i|                puts "CLASS: #{v.class}"                if v.class == OCI8::CLOB                  puts "Caught CLOB!"                  row] = v.read                else                  row] = v unless columns == :raw_rnum_                end            end            yield row            end          ensure            cursor.close          end      end      end
页: [1]
查看完整版本: Sequel访问Oracle CLOB