Package org.jruby.pg.internal

Examples of org.jruby.pg.internal.Value


      RubySymbol format_s = context.runtime.newSymbol("format");
      for (int i = 0; i < params.getLength(); i++) {
        IRubyObject param = params.entry(i);
        Format valueFormat = Format.Text;
        if (param.isNil()) {
          values[i] = new Value(null, valueFormat);
        } else if (param instanceof RubyHash) {
          RubyHash hash = (RubyHash) params.get(i);
          IRubyObject value = hash.op_aref(context, value_s);
          IRubyObject type = hash.op_aref(context, type_s);
          IRubyObject format = hash.op_aref(context, format_s);
          if (!type.isNil())
            oids[i] = (int) ((RubyFixnum) type).getLongValue();
          if (!format.isNil())
            valueFormat = ((RubyFixnum) format).getLongValue() == 1 ? Format.Binary : Format.Text;
          if (value.isNil())
            values[i] = new Value(null, valueFormat);
          else
            values[i] = new Value(((RubyString) value).getBytes(), valueFormat);
        } else {
          RubyString rubyString;
          if (param instanceof RubyString)
            rubyString = (RubyString) param;
          else
            rubyString = (RubyString) ((RubyObject) param).to_s();
          values[i] = new Value(rubyString.getBytes(), valueFormat);
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.jruby.pg.internal.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.