Class List Method List File List

# Class: VertxSql::SQLRowStream

Inherits:
  Object
  - Object
  - VertxSql::SQLRowStream
  show all
Includes:
  Vertx::ReadStream
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb

## Overview

A ReadStream of Rows from the underlying RDBMS. This class follows the ReadStream semantics and will automatically close the underlying resources if all returned rows are returned. For cases where the results are ignored before the full processing of the returned rows is complete the close method **MUST** be called in order to release underlying resources. The interface is minimal in order to support all SQL clients not just JDBC.

## 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 { ... }
  Closes the stream/underlying cursor(s).
- - (Fixnum) column(name = nil)
  Will convert the column name to the json array index.
- - (self) end_handler { ... }
- - (self) exception_handler { ... }
- - (self) handler { ... }
- - (void) more_results
  Request for more results if available.
- - (self) pause
- - (::VertxSql::SQLRowStream) result_set_closed_handler { ... }
  Event handler when a resultset is closed.
- - (self) resume

## Class Method Details

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

Returns:

- (`Boolean`)

    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 24

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

### + (`Object`) j_api_type

    33
    34
    35
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 33

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    36
    37
    38
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 36

    def self.j_class
      Java::IoVertxExtSql::SQLRowStream.java_class
    end

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

    30
    31
    32
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 30

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

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

    27
    28
    29
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 27

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

## Instance Method Details

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

This method returns an undefined value.

Closes the stream/underlying cursor(s). The actual close happens asynchronously.

Yields:

- called when the stream/underlying cursor(s) is(are) closed

Raises:

- (`ArgumentError`)

    111
    112
    113
    114
    115
    116
    117
    118
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 111

    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

### - (`Fixnum`) column(name = nil)

Will convert the column name to the json array index.

Parameters:

- name (`String`) (defaults to: `nil`) —
  the column name

Returns:

- (`Fixnum`) —
  the json array index

Raises:

- (`ArgumentError`)

    85
    86
    87
    88
    89
    90
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 85

    def column(name=nil)
      if name.class == String && !block_given?
        return @j_del.java_method(:column, [Java::java.lang.String.java_class]).call(name)
      end
      raise ArgumentError, "Invalid arguments when calling column(#{name})"
    end

### - (`self`) end_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    75
    76
    77
    78
    79
    80
    81
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 75

    def end_handler
      if block_given?
        @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling end_handler()"
    end

### - (`self`) exception_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    41
    42
    43
    44
    45
    46
    47
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 41

    def exception_handler
      if block_given?
        @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling exception_handler()"
    end

### - (`self`) handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    50
    51
    52
    53
    54
    55
    56
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 50

    def handler
      if block_given?
        @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.encode) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling handler()"
    end

### - (`void`) more_results

This method returns an undefined value.

Request for more results if available

Raises:

- (`ArgumentError`)

    102
    103
    104
    105
    106
    107
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 102

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

### - (`self`) pause

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    58
    59
    60
    61
    62
    63
    64
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 58

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

### - (`::VertxSql::SQLRowStream`) result_set_closed_handler { ... }

Event handler when a resultset is closed. This is useful to request for more results.

Yields:

Returns:

- (`::VertxSql::SQLRowStream`)

Raises:

- (`ArgumentError`)

    94
    95
    96
    97
    98
    99
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 94

    def result_set_closed_handler
      if block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:resultSetClosedHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield }),::VertxSql::SQLRowStream)
      end
      raise ArgumentError, "Invalid arguments when calling result_set_closed_handler()"
    end

### - (`self`) resume

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    66
    67
    68
    69
    70
    71
    72
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 66

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