/* * call-seq: * conn.put_copy_data( buffer ) -> Boolean * * Transmits _buffer_ as copy data to the server. * Returns true if the data was sent, false if it was * not sent (false is only possible if the connection * is in nonblocking mode, and this command would block). * * Raises an exception if an error occurs. */ static VALUE pgconn_put_copy_data(self, buffer) VALUE self, buffer; { int ret; VALUE error; PGconn *conn = get_pgconn(self); Check_Type(buffer, T_STRING); ret = PQputCopyData(conn, RSTRING_PTR(buffer), RSTRING_LEN(buffer)); if(ret == -1) { error = rb_exc_new2(rb_ePGError, PQerrorMessage(conn)); rb_iv_set(error, "@connection", self); rb_exc_raise(error); } return (ret) ? Qtrue : Qfalse; }