123 "FROM spatial_ref_sys, " 124 "regexp_matches($1::text, E'([a-z]+):([0-9]+)', 'gi') AS re " 125 "WHERE re[1] ILIKE auth_name AND int4(re[2]) = auth_srid";
126 Oid argtypes[] = {CSTRINGOID};
127 Datum values[] = {CStringGetDatum(srs)};
133 if (SPI_OK_CONNECT != SPI_connect())
135 elog(NOTICE,
"getSRIDbySRS: could not connect to SPI manager");
139 err = SPI_execute_with_args(query, 1, argtypes, values, NULL,
true, 1);
142 elog(NOTICE,
"getSRIDbySRS: error executing query %d", err);
148 if (SPI_processed <= 0)
152 "FROM spatial_ref_sys, " 153 "regexp_matches($1::text, E'urn:ogc:def:crs:([a-z]+):.*:([0-9]+)', 'gi') AS re " 154 "WHERE re[1] ILIKE auth_name AND int4(re[2]) = auth_srid";
156 err = SPI_execute_with_args(query, 1, argtypes, values, NULL,
true, 1);
159 elog(NOTICE,
"getSRIDbySRS: error executing query %d", err);
164 if (SPI_processed <= 0)
171 srid = atoi(SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1));