Method: PG::Connection#get_copy_data
- Defined in:
- lib/pg/connection.rb
#get_copy_data(async = false, decoder = nil) ⇒ Object Also known as: async_get_copy_data
call-seq:
conn.get_copy_data( [ nonblock = false [, decoder = nil ]] ) -> Object
Return one row of data, nil
if the copy is done, or false
if the call would block (only possible if nonblock is true).
If decoder is not set or nil
, data is returned as binary string.
If decoder is set to a PG::Coder derivation, the return type depends on this decoder. PG::TextDecoder::CopyRow decodes the received data fields from one row of PostgreSQL’s COPY text format to an Array of Strings. Optionally the decoder can type cast the single fields to various Ruby types in one step, if PG::TextDecoder::CopyRow#type_map is set accordingly.
See also #copy_data.
428 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/pg/connection.rb', line 428 def get_copy_data(async=false, decoder=nil) if async return sync_get_copy_data(async, decoder) else while (res=sync_get_copy_data(true, decoder)) == false socket_io.wait_readable consume_input end return res end end |