Definition at line 874 of file pgsql2shp-core.c.
References _, shp_dumper_state::conn, free(), shp_dumper_state::geo_col_name, geometry_type_from_string(), LINETYPE, LWDEBUGF, lwtype_is_collection(), malloc(), shp_dumper_state::message, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, shp_dumper_state::outshptype, shp_dumper_state::outtype, POINTTYPE, POLYGONTYPE, window::res, shp_dumper_state::rowcount, shp_dumper_state::schema, SHPDUMPERERR, SHPDUMPERMSGLEN, SHPDUMPEROK, SHPT_ARC, SHPT_ARCM, SHPT_ARCZ, SHPT_MULTIPOINT, SHPT_MULTIPOINTM, SHPT_MULTIPOINTZ, SHPT_POINT, SHPT_POINTM, SHPT_POINTZ, SHPT_POLYGON, SHPT_POLYGONM, SHPT_POLYGONZ, shp_dumper_state::table, and ovdump::type.
Referenced by ShpDumperOpenTable().
901 sprintf(query,
"SELECT count(1), max(ST_zmflag(\"%s\"::geometry)), geometrytype(\"%s\"::geometry) FROM \"%s\".\"%s\" GROUP BY 3",
908 sprintf(query,
"SELECT count(1), max(ST_zmflag(\"%s\"::geometry)), geometrytype(\"%s\"::geometry) FROM \"%s\" GROUP BY 3",
919 sprintf(query,
"SELECT count(1) FROM \"%s\".\"%s\"", state->
schema, state->
table);
925 sprintf(query,
"SELECT count(1) FROM \"%s\"", state->
table);
929 LWDEBUGF(3,
"Table metadata query: %s\n", query);
931 res = PQexec(state->
conn, query);
934 if (PQresultStatus(res) != PGRES_TUPLES_OK)
936 snprintf(state->
message,
SHPDUMPERMSGLEN,
_(
"ERROR: Could not execute table metadata query: %s"), PQresultErrorMessage(res));
942 if (PQntuples(res) == 0)
963 int typefound = 0, typemismatch = 0;
967 for (i = 0; i < PQntuples(res); i++)
970 if (PQgetisnull(res, i, 2))
972 state->
rowcount += atoi(PQgetvalue(res, i, 0));
1028 state->
rowcount += atoi(PQgetvalue(res, i, 0));
1033 tmpint = atoi(PQgetvalue(res, i, 1));
1130 state->
rowcount = atoi(PQgetvalue(res, 0, 0));
int geometry_type_from_string(const char *str, uint8_t *type, int *z, int *m)
Calculate type integer and dimensional flags from string input.
int lwtype_is_collection(uint8_t type)
Determine whether a type number is a collection or not.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
char message[SHPDUMPERMSGLEN]
#define LWDEBUGF(level, msg,...)