class PG::Connection

def put_copy_data(buffer, encoder=nil)


See also #copy_data.

Raises an exception if an error occurs.

if PG::TextEncoder::CopyRow#type_map is set accordingly.
the encoder can type cast the fields from various Ruby types in one step,
PostgreSQL's COPY text format inclusive proper escaping. Optionally
This encodes the data fields given as _buffer_ from an Array of Strings to
_encoder_ can be a PG::Coder derivation (typically PG::TextEncoder::CopyRow).

is in nonblocking mode, and this command would block).
not sent (false is only possible if the connection
Returns true if the data was sent, false if it was
Transmits _buffer_ as copy data to the server.

conn.put_copy_data( buffer [, encoder] ) -> Boolean
call-seq:
def put_copy_data(buffer, encoder=nil)
	# sync_put_copy_data does a non-blocking attept to flush data.
	until res=sync_put_copy_data(buffer, encoder)
		# It didn't flush immediately and allocation of more buffering memory failed.
		# Wait for all data sent by doing a blocking flush.
		res = flush
	end
	# And do a blocking flush every 100 calls.
	# This is to avoid memory bloat, when sending the data is slower than calls to put_copy_data happen.
	if (@calls_to_put_copy_data += 1) > 100
		@calls_to_put_copy_data = 0
		res = flush
	end
	res
end