1111 SPIPlanPtr plan = NULL;
1131 else if (arg->
nodata[0][0][0] && !arg->
nodata[1][0][0]) {
1141 else if (!arg->
nodata[0][0][0] && arg->
nodata[1][0][0]) {
1168 if (arg->
nodata[0][0][0]) {
1204 SPITupleTable *tuptable = NULL;
1207 bool isnull =
FALSE;
1212 memset(values, (Datum) NULL,
sizeof(Datum) * callback->
kw.
count);
1213 memset(nulls,
FALSE,
sizeof(
char) * callback->
kw.
count);
1218 for (i = 0; i < callback->
kw.
count; i++) {
1220 if (idx < 1)
continue;
1223 if (arg->
rasters == 1 && i > 7) {
1224 elog(ERROR,
"rtpg_nmapalgebraexpr_callback: rast2 argument specified in single-raster invocation");
1231 values[idx] = Int32GetDatum(arg->
src_pixel[0][0] + 1);
1235 values[idx] = Int32GetDatum(arg->
src_pixel[0][1] + 1);
1241 if (!arg->
nodata[0][0][0])
1242 values[idx] = Float8GetDatum(arg->
values[0][0][0]);
1249 values[idx] = Int32GetDatum(arg->
src_pixel[0][0] + 1);
1253 values[idx] = Int32GetDatum(arg->
src_pixel[0][1] + 1);
1259 if (!arg->
nodata[0][0][0])
1260 values[idx] = Float8GetDatum(arg->
values[0][0][0]);
1267 values[idx] = Int32GetDatum(arg->
src_pixel[1][0] + 1);
1271 values[idx] = Int32GetDatum(arg->
src_pixel[1][1] + 1);
1277 if (!arg->
nodata[1][0][0])
1278 values[idx] = Float8GetDatum(arg->
values[1][0][0]);
1288 err = SPI_execute_plan(plan, values, nulls,
TRUE, 1);
1289 if (err != SPI_OK_SELECT || SPI_tuptable == NULL || SPI_processed != 1) {
1290 elog(ERROR,
"rtpg_nmapalgebraexpr_callback: Unexpected error when running prepared statement %d",
id);
1295 tupdesc = SPI_tuptable->tupdesc;
1296 tuptable = SPI_tuptable;
1297 tuple = tuptable->vals[0];
1299 datum = SPI_getbinval(tuple, tupdesc, 1, &isnull);
1300 if (SPI_result == SPI_ERROR_NOATTRIBUTE) {
1301 if (SPI_tuptable) SPI_freetuptable(tuptable);
1302 elog(ERROR,
"rtpg_nmapalgebraexpr_callback: Could not get result of prepared statement %d",
id);
1307 *
value = DatumGetFloat8(datum);
1327 if (SPI_tuptable) SPI_freetuptable(tuptable);
#define POSTGIS_RT_DEBUG(level, msg)
#define POSTGIS_RT_DEBUGF(level, msg,...)
struct rtpg_nmapalgebraexpr_callback_arg::@24 kw
struct rtpg_nmapalgebraexpr_callback_arg::@23 nodatanodata
struct rtpg_nmapalgebraexpr_callback_arg::@22 expr[3]