Sha256: 00690c1ebfd7ccb02ce6ef8fc845561fbd9a5de1365b82d9c43efb14fea77992

Contents?: true

Size: 905 Bytes

Versions: 8

Compression:

Stored size: 905 Bytes

Contents

module Rubyfb
  class Connection
    # Creates stored procedure call object
    def prepare_call(procedure_name)
      Rubyfb::ProcedureCall.new(self, procedure_name)
    end
    
    def force_encoding(fb_str, sqlsubtype)
      fb_str
    end
  private
    def init_m17n
      return unless String.method_defined?(:force_encoding)
      
      @charset_map= Hash.new(Rubyfb::Options.charset_name_map.default)
      start_transaction do |tr|
        execute("SELECT RDB$CHARACTER_SET_NAME, RDB$CHARACTER_SET_ID FROM RDB$CHARACTER_SETS", tr) do |row|
          @charset_map[row['RDB$CHARACTER_SET_ID']]=Rubyfb::Options.charset_name_map[row['RDB$CHARACTER_SET_NAME'].strip]
        end
      end
      instance_eval do 
        def force_encoding(fb_str, sqlsubtype)
          fb_str.tap do |s|
            s.force_encoding(@charset_map[sqlsubtype])
          end
        end
      end
    end
  end
end



Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rubyfb-0.6.7 lib/connection.rb
rubyfb-0.6.4 lib/Connection.rb
rubyfb-0.6.3 lib/Connection.rb
rubyfb-0.6.2 lib/Connection.rb
rubyfb-0.6.1 lib/Connection.rb
rubyfb-0.6 lib/Connection.rb
rubyfb-0.5.9 lib/Connection.rb
rubyfb-0.5.8 lib/Connection.rb