Module epgsql_cmd_copy_from_stdin

Tells server to switch to "COPY-in" mode.

Behaviours: epgsql_command.


Tells server to switch to "COPY-in" mode

See See

When Format is text, copy data should then be delivered using Erlang io protocol. See file:write/2, io:put_chars/2. "End-of-data" marker \. at the end of TEXT or CSV data stream is not needed.

When Format is {binary, [epgsql_type()]}, recommended way to deliver data is epgsql:copy_send_rows/3. IO-protocol can be used as well, as long as you can do proper binary encoding of data tuples (header and trailer are sent automatically), see When you don't know what are the correct type names for your columns, you could try to construct equivalent INSERT or SELECT statement and call epgsql:parse/2 command. It will return #statement{columns = [#column{type = TypeName}]} with correct type names.

epgsql_cmd_copy_done should be called in the end.

This command should not be used with command pipelining!

   > SQuery COPY ... FROM STDIN ...
   < CopyInResponse
   > CopyData*            -- implemented in io protocol, not here
   > CopyDone | CopyFail  -- implemented in epgsql_cmd_copy_done
   < CommandComplete      -- implemented in epgsql_cmd_copy_done

Data Types


response() = {ok, [text | binary]} | {error, epgsql:query_error()}

Function Index


Function Details


execute(Sock, Copy_stdin) -> any()


handle_message(X1, Error, Sock, Copy_stdin) -> any()


init(X1) -> any()

Generated by EDoc