PostGIS  2.1.10dev-r@@SVN_REVISION@@
void ShpDumperDestroy ( SHPDUMPERSTATE state)

Definition at line 2268 of file pgsql2shp-core.c.

References shp_dumper_state::column_map_dbffieldnames, shp_dumper_state::column_map_pgfieldnames, shp_dumper_state::column_map_size, shp_dumper_state::conn, shp_dumper_state::dbffieldnames, shp_dumper_state::dbffieldtypes, shp_dumper_state::fetch_query, shp_dumper_state::fieldcount, shp_dumper_state::geo_col_name, shp_dumper_state::main_scan_query, shp_dumper_state::pgfieldnames, shp_dumper_state::schema, and shp_dumper_state::table.

Referenced by main(), pgui_action_export(), and test_ShpDumperDestroy().

2269 {
2270  /* Destroy a state object created with ShpDumperConnect */
2271  int i;
2272 
2273  if (state != NULL)
2274  {
2275  /* Disconnect from the database */
2276  if (state->conn)
2277  PQfinish(state->conn);
2278 
2279  /* Free the query strings */
2280  if (state->fetch_query)
2281  free(state->fetch_query);
2282  if (state->main_scan_query)
2283  free(state->main_scan_query);
2284 
2285  /* Free the DBF information fields */
2286  if (state->dbffieldnames)
2287  {
2288  for (i = 0; i < state->fieldcount; i++)
2289  free(state->dbffieldnames[i]);
2290  free(state->dbffieldnames);
2291  }
2292 
2293  if (state->dbffieldtypes)
2294  free(state->dbffieldtypes);
2295 
2296  if (state->pgfieldnames)
2297  free(state->pgfieldnames);
2298 
2299  /* Free any column map fieldnames if specified */
2300  if (state->column_map_size > 0)
2301  {
2302  for (i = 0; i < state->column_map_size; i++)
2303  {
2304  if (state->column_map_pgfieldnames[i])
2305  free(state->column_map_pgfieldnames[i]);
2306 
2307  if (state->column_map_dbffieldnames[i])
2308  free(state->column_map_dbffieldnames[i]);
2309  }
2310 
2311  free(state->column_map_pgfieldnames);
2312  free(state->column_map_dbffieldnames);
2313  }
2314 
2315  /* Free other names */
2316  if (state->table)
2317  free(state->table);
2318  if (state->schema)
2319  free(state->schema);
2320  if (state->geo_col_name)
2321  free(state->geo_col_name);
2322 
2323  /* Free the state itself */
2324  free(state);
2325  }
2326 }
char ** column_map_pgfieldnames
char ** column_map_dbffieldnames

Here is the caller graph for this function: