Package org.jruby.pg.internal.messages

Examples of org.jruby.pg.internal.messages.CopyData


    public IRubyObject get_copy_data(ThreadContext context, IRubyObject[] args) {
      try {
        boolean async = false;
        if (args.length == 1)
          async = args[0].isTrue();
        CopyData data = postgresqlConnection.getCopyData(async);
        if (data == PostgresqlConnection.COPY_DATA_NOT_READY)
          return context.runtime.getFalse();
        else if (data == null)
          return context.nil;
        ByteBuffer value = data.getValue();
        return context.runtime.newString(new ByteList(value.array(), value.arrayOffset() + value.position(), value.remaining()));
      } catch (IOException e) {
        throw newPgError(context, e.getLocalizedMessage(), null, getClientEncodingAsJavaEncoding(context));
      }
    }
View Full Code Here


      if (currentOutBuffer.remaining() != 0)
        flush();

      if (currentOutBuffer.remaining() == 0) {
        currentOutBuffer = new CopyData(data).toBytes();
        flush();
        return true;
      } else {
        return false;
      }
View Full Code Here

TOP

Related Classes of org.jruby.pg.internal.messages.CopyData

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.