Package org.jruby.pg.internal

Examples of org.jruby.pg.internal.PostgresqlString


    /******     PG::Connection INSTANCE METHODS: Command Execution     ******/

    @JRubyMethod(alias = {"query", "async_exec", "async_query"}, required = 1, optional = 2)
    public IRubyObject exec(ThreadContext context, IRubyObject[] args, Block block) {
        PostgresqlString query = rubyStringAsPostgresqlString(args[0]);
        ResultSet set = null;
        try {
            if (args.length == 1) {
              set = postgresqlConnection.exec(query);
            } else {
View Full Code Here


    }

    @JRubyMethod(required = 2, rest = true)
    public IRubyObject prepare(ThreadContext context, IRubyObject[] args) {
      try {
        PostgresqlString name = rubyStringAsPostgresqlString(args[0]);
        PostgresqlString query = rubyStringAsPostgresqlString(args[1]);
        int [] oids = null;
        if (args.length == 3) {
          RubyArray array = ((RubyArray) args[2]);
          oids = new int[array.getLength()];
          for (int i = 0; i < oids.length; i++)
View Full Code Here

        throw newPgError(context, e.getLocalizedMessage(), null, getClientEncodingAsJavaEncoding(context));
      }
    }

    private ResultSet execPreparedCommon(ThreadContext context, IRubyObject[] args, boolean async) throws IOException, PostgresqlException {
      PostgresqlString queryName = rubyStringAsPostgresqlString(args[0]);
      Value[] values;
      int[] oids;
      if (args.length > 1) {
        RubyArray array = (RubyArray) args[1];
        values = new Value[array.getLength()];
View Full Code Here

    }

    @JRubyMethod(required = 1)
    public IRubyObject describe_prepared(ThreadContext context, IRubyObject query_name) {
      try {
        PostgresqlString queryName = rubyStringAsPostgresqlString(query_name);
        ResultSet resultSet = postgresqlConnection.describePrepared(queryName);
        return createResult(context, resultSet, NULL_ARRAY, Block.NULL_BLOCK);
      } catch (PostgresqlException e) {
        throw newPgError(context, e.getLocalizedMessage(), e.getResultSet(), getClientEncodingAsJavaEncoding(context));
      } catch (Exception e) {
View Full Code Here

    }

    @JRubyMethod(required = 1)
    public IRubyObject describe_portal(ThreadContext context, IRubyObject arg0) {
      try {
        PostgresqlString name = rubyStringAsPostgresqlString(arg0);
        ResultSet resultSet = postgresqlConnection.describePortal(name);
        return createResult(context, resultSet, NULL_ARRAY, Block.NULL_BLOCK);
      } catch (PostgresqlException e) {
        throw newPgError(context, e.getLocalizedMessage(), e.getResultSet(), getClientEncodingAsJavaEncoding(context));
      } catch (Exception e) {
View Full Code Here

    @JRubyMethod(rest = true)
    public IRubyObject send_query(ThreadContext context, IRubyObject[] args) {
      try {
        if (args.length == 1) {
          PostgresqlString query = rubyStringAsPostgresqlString(args[0]);
          postgresqlConnection.sendQuery(query);
        }
      } catch (Exception e) {
        throw newPgError(context, e.getLocalizedMessage(), null, getClientEncodingAsJavaEncoding(context));
      }
View Full Code Here

      }
      return string.length();
    }

    private PostgresqlString rubyStringAsPostgresqlString(IRubyObject str) {
      return new PostgresqlString(((RubyString) str).getBytes());
    }
View Full Code Here

TOP

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

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.