Class: VertxSql::SQLRowStream

Inherits:
Object
  • Object
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)

Instance Method Summary (collapse)

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)


122
123
124
125
126
127
128
129
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-sql/sql_row_stream.rb', line 122

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

- (Array<String>) columns

Returns all column names available in the underlying resultset. One needs to carefully use this method since in contrast to the singular version it does not perform case insensitive lookups or takes alias in consideration on the column names.

Returns:

  • (Array<String>)
    the list of columns names returned by the query

Raises:

  • (ArgumentError)


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

def columns
  if !block_given?
    return @j_del.java_method(:columns, []).call().to_a.map { |elt| elt }
  end
  raise ArgumentError, "Invalid arguments when calling columns()"
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)


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

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

- (self) result_set_closed_handler { ... }

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

Yields:

  • called when the current result set is closed

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def result_set_closed_handler
  if block_given?
    @j_del.java_method(:resultSetClosedHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
    return self
  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