/*
 * call-seq:
 *    conn.lo_export( oid, file )
 *
 * Saves a large object of _oid_ to a _file_.
 */
static VALUE
pgconn_loexport(obj, lo_oid,filename)
  VALUE obj, lo_oid, filename;
{
  PGconn *conn = get_pgconn(obj);
  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, STR2CSTR(filename))) {
  rb_raise(rb_ePGError, PQerrorMessage(conn));
  }
  return Qnil;
}