PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ RASTER_getBandFileTimestamp()

Datum RASTER_getBandFileTimestamp ( PG_FUNCTION_ARGS  )

Definition at line 410 of file rtpg_band_properties.c.

411 {
412  rt_pgraster *pgraster;
414  rt_band band = NULL;
415  int64_t fileSize;
416  int32_t bandindex;
417 
418  /* Index is 1-based */
419  bandindex = PG_GETARG_INT32(1);
420  if ( bandindex < 1 ) {
421  elog(NOTICE, "Invalid band index (must use 1-based). Returning NULL");
422  PG_RETURN_NULL();
423  }
424 
425  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
426  pgraster = (rt_pgraster *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
427 
428  raster = rt_raster_deserialize(pgraster, FALSE);
429  if ( ! raster ) {
430  PG_FREE_IF_COPY(pgraster, 0);
431  elog(ERROR, "RASTER_getBandFileTimestamp: Could not deserialize raster");
432  PG_RETURN_NULL();
433  }
434 
435  /* Fetch requested band */
436  band = rt_raster_get_band(raster, bandindex - 1);
437  if (!band) {
438  elog(
439  NOTICE,
440  "Could not find raster band of index %d when getting band path. Returning NULL",
441  bandindex
442  );
444  PG_FREE_IF_COPY(pgraster, 0);
445  PG_RETURN_NULL();
446  }
447 
448  if (!rt_band_is_offline(band)) {
449  elog(NOTICE, "Band of index %d is not out-db.", bandindex);
452  PG_FREE_IF_COPY(pgraster, 0);
453  PG_RETURN_NULL();
454  }
455 
456  fileSize = rt_band_get_file_timestamp(band);
457 
460  PG_FREE_IF_COPY(pgraster, 0);
461 
462  PG_RETURN_INT64(fileSize);
463 }
#define FALSE
Definition: dbfopen.c:72
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:86
void rt_band_destroy(rt_band band)
Destroy a raster band.
Definition: rt_band.c:340
uint64_t rt_band_get_file_timestamp(rt_band band)
Return file timestamp.
Definition: rt_band.c:608
int rt_band_is_offline(rt_band band)
Return non-zero if the given band data is on the filesystem.
Definition: rt_band.c:329
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:725
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
Definition: rt_raster.c:385
band
Definition: ovdump.py:58
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
Struct definitions.
Definition: librtcore.h:2396

References ovdump::band, FALSE, rtrowdump::raster, rt_band_destroy(), rt_band_get_file_timestamp(), rt_band_is_offline(), rt_raster_deserialize(), rt_raster_destroy(), and rt_raster_get_band().

Here is the call graph for this function: