Class List Method List File List

# Class: VertxSqlClient::Cursor

Inherits:
  Object
  - Object
  - VertxSqlClient::Cursor
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb

## Overview

A cursor that reads progressively rows from the database, it is useful for reading very large result sets.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) close { ... }
  Like #close but with a completionHandler called when the cursor has been released.
- - (true, false) closed?
  Whether the cursor is closed.
- - (true, false) has_more?
  Returns true when the cursor has results in progress and the #read should be called to retrieve them.
- - (void) read(count = nil) { ... }
  Read rows from the cursor, the result is provided asynchronously to the handler.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    19
    20
    21
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb', line 19

    def @@j_api_type.accept?(obj)
      obj.class == Cursor
    end

### + (`Object`) j_api_type

    28
    29
    30
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb', line 28

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    31
    32
    33
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb', line 31

    def self.j_class
      Java::IoVertxSqlclient::Cursor.java_class
    end

### + (`Object`) unwrap(obj)

    25
    26
    27
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb', line 25

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    22
    23
    24
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb', line 22

    def @@j_api_type.wrap(obj)
      Cursor.new(obj)
    end

## Instance Method Details

### - (`void`) close { ... }

This method returns an undefined value.

Like #close but with a `completionHandler` called when the cursor has been released.

Yields:

Raises:

- (`ArgumentError`)

    56
    57
    58
    59
    60
    61
    62
    63
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb', line 56

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      elsif block_given?
        return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`true`, `false`) closed?

Returns whether the cursor is closed

Returns:

- (`true`, `false`) —
  whether the cursor is closed

Raises:

- (`ArgumentError`)

    65
    66
    67
    68
    69
    70
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb', line 65

    def closed?
      if !block_given?
        return @j_del.java_method(:isClosed, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling closed?()"
    end

### - (`true`, `false`) has_more?

Returns `true` when the cursor has results in progress and the #read should be called to retrieve them.

Returns:

- (`true`, `false`) —
  whether the cursor has more results,

Raises:

- (`ArgumentError`)

    47
    48
    49
    50
    51
    52
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb', line 47

    def has_more?
      if !block_given?
        return @j_del.java_method(:hasMore, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling has_more?()"
    end

### - (`void`) read(count = nil) { ... }

This method returns an undefined value.

Read rows from the cursor, the result is provided asynchronously to the `handler`.

Parameters:

- count (`Fixnum`) (defaults to: `nil`) —
  the amount of rows to read

Yields:

- the handler for the result

Raises:

- (`ArgumentError`)

    38
    39
    40
    41
    42
    43
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-sql-client/cursor.rb', line 38

    def read(count=nil)
      if count.class == Fixnum && block_given?
        return @j_del.java_method(:read, [Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(count,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxSqlClient::RowSet,::VertxSqlClient::Row.j_api_type) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling read(#{count})"
    end