63 if (SPI_OK_CONNECT != SPI_connect ())
65 elog(NOTICE,
"getSRSbySRID: could not connect to SPI manager");
71 snprintf(query, 256,
"SELECT auth_name||':'||auth_srid \ 72 FROM spatial_ref_sys WHERE srid='%d'", srid);
74 snprintf(query, 256,
"SELECT 'urn:ogc:def:crs:'||auth_name||'::'||auth_srid \ 75 FROM spatial_ref_sys WHERE srid='%d'", srid);
77 err = SPI_exec(query, 1);
80 elog(NOTICE,
"getSRSbySRID: error executing query %d", err);
86 if (SPI_processed <= 0)
93 srs = SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1);
103 size = strlen(srs)+1;
104 srscopy = SPI_palloc(size);
105 memcpy(srscopy, srs, size);