/*
 * call-seq:
 *    lrg.size()
 *
 * Returns the size of the large object.
 */
static VALUE
pglarge_size(obj)
  VALUE obj;
{
  PGlarge *pglarge = get_pglarge(obj);
  int start, end;

  if ((start = lo_tell(pglarge->pgconn,pglarge->lo_fd)) == -1) {
  rb_raise(rb_ePGError, "error while getting position");
  }

  if ((end = lo_lseek(pglarge->pgconn, pglarge->lo_fd, 0, SEEK_END)) == -1) {
  rb_raise(rb_ePGError, "error while moving cursor");
  }

  if ((start = lo_lseek(pglarge->pgconn, pglarge->lo_fd,start, SEEK_SET)) == -1) {
  rb_raise(rb_ePGError, "error while moving back to posiion");
  }
  
  return INT2NUM(end);
}