/*
 * call-seq:
 *    conn.lo_export( oid, file ) -> nil
 *
 * Saves a large object of _oid_ to a _file_.
 */
static VALUE
pgconn_loexport(VALUE self, VALUE lo_oid, VALUE filename)
{
    PGconn *conn = get_pgconn(self);
    int oid;
    Check_Type(filename, T_STRING);

    oid = NUM2INT(lo_oid);
    if (oid < 0) {
        rb_raise(rb_ePGError, "invalid large object oid %d",oid);
    }

    if (lo_export(conn, oid, StringValuePtr(filename)) < 0) {
        rb_raise(rb_ePGError, "%s", PQerrorMessage(conn));
    }
    return Qnil;
}