Module: Sequel::Postgres::Streaming::DatasetMethods
- Defined in:
- lib/sequel/extensions/pg_streaming.rb
Overview
Dataset methods used to implement streaming.
Instance Method Summary collapse
-
#fetch_rows(sql) ⇒ Object
If streaming has been requested and the current dataset can be streamed, request the database use streaming when executing this query, and use yield_each_row to process the separate PGresult for each row in the connection.
-
#stream ⇒ Object
Return a clone of the dataset that will use streaming to load rows.
Instance Method Details
#fetch_rows(sql) ⇒ Object
If streaming has been requested and the current dataset can be streamed, request the database use streaming when executing this query, and use yield_each_row to process the separate PGresult for each row in the connection.
96 97 98 99 100 101 102 103 104 |
# File 'lib/sequel/extensions/pg_streaming.rb', line 96 def fetch_rows(sql) if stream_results? execute(sql, :stream=>true) do |conn| yield_each_row(conn){|h| yield h} end else super end end |
#stream ⇒ Object
Return a clone of the dataset that will use streaming to load rows.
108 109 110 |
# File 'lib/sequel/extensions/pg_streaming.rb', line 108 def stream clone(:stream=>true) end |