PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ ShpDumperOpenTable()

int ShpDumperOpenTable ( SHPDUMPERSTATE state)

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

1336 {
1337  PGresult *res;
1338 
1339  char buf[256];
1340  char *query;
1341  int gidfound = 0, i, j, ret, status;
1342 
1343 
1344  /* Open the column map if one was specified */
1345  if (state->config->column_map_filename)
1346  {
1347  ret = colmap_read(state->config->column_map_filename,
1348  &state->column_map, state->message, SHPDUMPERMSGLEN);
1349  if (!ret) return SHPDUMPERERR;
1350  }
1351 
1352  /* If a user-defined query has been specified, create and point the state to our new table */
1353  if (state->config->usrquery)
1354  {
1355  int r = asprintf(&(state->table), "__pgsql2shp%lu_tmp_table", (long)getpid());
1356  (void)r;
1357  r = asprintf(&query, "CREATE TEMP TABLE \"%s\" AS %s", state->table, state->config->usrquery);
1358  (void)r;
1359  res = PQexec(state->conn, query);
1360  free(query);
1361 
1362  /* Execute the code to create the table */
1363  if (PQresultStatus(res) != PGRES_COMMAND_OK)
1364  {
1365  snprintf(state->message, SHPDUMPERMSGLEN, _("Error executing user query: %s"), PQresultErrorMessage(res));
1366  PQclear(res);
1367  return SHPDUMPERERR;
1368  }
1369  }
1370  else
1371  {
1372  /* Simply point the state to copies of the supplied schema and table */
1373  state->table = strdup(state->config->table);
1374  if (state->config->schema)
1375  state->schema = strdup(state->config->schema);
1376  }
1377 
1378 
1379  /* Get the list of columns and their types for the selected table */
1380  if (state->schema)
1381  {
1382  int r = asprintf(&query, "SELECT a.attname, a.atttypid, "
1383  "a.atttypmod, a.attlen FROM "
1384  "pg_attribute a, pg_class c, pg_namespace n WHERE "
1385  "n.nspname = '%s' AND a.attrelid = c.oid AND "
1386  "n.oid = c.relnamespace AND "
1387  "a.atttypid != 0 AND "
1388  "a.attnum > 0 AND c.relname = '%s'", state->schema, state->table);
1389  (void)r;
1390  }
1391  else
1392  {
1393  int r = asprintf(&query, "SELECT a.attname, a.atttypid, "
1394  "a.atttypmod, a.attlen FROM "
1395  "pg_attribute a, pg_class c WHERE "
1396  "a.attrelid = c.oid and a.attnum > 0 AND "
1397  "a.atttypid != 0 AND "
1398  "c.relname = '%s' AND "
1399  "pg_catalog.pg_table_is_visible(c.oid)", state->table);
1400  (void)r;
1401  }
1402 
1403  LWDEBUGF(3, "query is: %s\n", query);
1404 
1405  res = PQexec(state->conn, query);
1406  free(query);
1407 
1408  if (PQresultStatus(res) != PGRES_TUPLES_OK)
1409  {
1410  snprintf(state->message, SHPDUMPERMSGLEN, _("Error querying for attributes: %s"), PQresultErrorMessage(res));
1411  PQclear(res);
1412  return SHPDUMPERERR;
1413  }
1414 
1415  if (!PQntuples(res))
1416  {
1417  snprintf(state->message, SHPDUMPERMSGLEN, _("Table %s does not exist"), state->table);
1418  PQclear(res);
1419  return SHPDUMPERERR;
1420  }
1421 
1422  /* If a shapefile name was specified, use it. Otherwise simply use the table name. */
1423  if (state->config->shp_file != NULL)
1424  state->shp_file = state->config->shp_file;
1425  else
1426  state->shp_file = state->table;
1427 
1428  /* Create the dbf file: */
1429  /* If there's a user-specified encoding hanging around, try and use that. */
1430  /* Otherwise, just use UTF-8 encoding, since that's usually our client encoding. */
1431  if ( getenv("PGCLIENTENCODING") )
1432  {
1433  char *codepage = encoding2codepage(getenv("PGCLIENTENCODING"));
1434  state->dbf = DBFCreateEx(state->shp_file, codepage);
1435  }
1436  else
1437  {
1438  state->dbf = DBFCreateEx(state->shp_file, "UTF-8");
1439  }
1440 
1441  if (!state->dbf)
1442  {
1443  snprintf(state->message, SHPDUMPERMSGLEN, _("Could not create dbf file %s"), state->shp_file);
1444  return SHPDUMPERERR;
1445  }
1446 
1447  /* Mimic old behaviour and skip the EOF character (1A) */
1448  DBFSetWriteEndOfFileChar(state->dbf, 0);
1449 
1450  /*
1451  * Scan the result setting fields to be returned in mainscan
1452  * query, filling the type_ary, and creating .dbf and .shp files.
1453  */
1454  state->dbffieldnames = malloc(sizeof(char *) * PQntuples(res));
1455  state->dbffieldtypes = malloc(sizeof(int) * PQntuples(res));
1456  state->pgfieldnames = malloc(sizeof(char *) * PQntuples(res));
1457  state->pgfieldlens = malloc(sizeof(int) * PQntuples(res));
1458  state->pgfieldtypmods = malloc(sizeof(int) * PQntuples(res));
1459  state->fieldcount = 0;
1460  int tmpint = 1;
1461 
1462  for (i = 0; i < PQntuples(res); i++)
1463  {
1464  char *ptr;
1465 
1466  int pgfieldtype, pgtypmod, pgfieldlen;
1467  char *pgfieldname;
1468 
1469  int dbffieldtype, dbffieldsize, dbffielddecs;
1470  char *dbffieldname;
1471 
1472  pgfieldname = PQgetvalue(res, i, 0);
1473  pgfieldtype = atoi(PQgetvalue(res, i, 1));
1474  pgtypmod = atoi(PQgetvalue(res, i, 2));
1475  pgfieldlen = atoi(PQgetvalue(res, i, 3));
1476  dbffieldtype = -1;
1477  dbffieldsize = 0;
1478  dbffielddecs = 0;
1479 
1480  /*
1481  * This is a geometry/geography column
1482  */
1483  if (pgfieldtype == state->geom_oid || pgfieldtype == state->geog_oid)
1484  {
1485  /* If no geometry/geography column has been found yet... */
1486  if (!state->geo_col_name)
1487  {
1488  /* If either no geo* column name was provided (in which case this is
1489  the first match) or we match the provided column name, we have
1490  found our geo* column */
1491  if (!state->config->geo_col_name || !strcmp(state->config->geo_col_name, pgfieldname))
1492  {
1493  dbffieldtype = 9;
1494 
1495  state->geo_col_name = strdup(pgfieldname);
1496  }
1497  }
1498  }
1499 
1500  /*
1501  * Everything else (non geometries) will be
1502  * a DBF attribute.
1503  */
1504 
1505  /* Skip gid (if not asked to do otherwise */
1506  if (!strcmp(pgfieldname, "gid") )
1507  {
1508  gidfound = 1;
1509 
1510  if (!state->config->includegid)
1511  continue;
1512  }
1513 
1514  /* Unescape any reserved column names */
1515  ptr = pgfieldname;
1516  if (!state->config->unescapedattrs)
1517  {
1518  if (*ptr == '_')
1519  ptr += 2;
1520  }
1521 
1522  /*
1523  * This needs special handling since both xmin and _xmin
1524  * becomes __xmin when escaped
1525  */
1526 
1527  /* Limit dbf field name to 10-digits */
1528  dbffieldname = malloc(11);
1529  strncpy(dbffieldname, ptr, 10);
1530  dbffieldname[10] = '\0';
1531 
1532  /* If a column map file has been passed in,
1533  * use this to create the dbf field name from
1534  * the PostgreSQL column name */
1535  {
1536  const char *mapped = colmap_dbf_by_pg(&state->column_map, pgfieldname);
1537  if (mapped)
1538  {
1539  strncpy(dbffieldname, mapped, 10);
1540  dbffieldname[10] = '\0';
1541  }
1542  }
1543 
1544  /*
1545  * make sure the fields all have unique names,
1546  */
1547  tmpint = 1;
1548  for (j = 0; j < state->fieldcount; j++)
1549  {
1550  if (!strncasecmp(dbffieldname, state->dbffieldnames[j], 10))
1551  {
1552  sprintf(dbffieldname, "%.7s_%.2d", ptr, abs(tmpint) % 100);
1553  tmpint++;
1554  continue;
1555  }
1556  }
1557 
1558  /* make UPPERCASE if keep_fieldname_case = 0 */
1559  if (!state->config->keep_fieldname_case)
1560  {
1561  size_t nameit;
1562  for (nameit = 0; nameit < strlen(dbffieldname); nameit++)
1563  dbffieldname[nameit] = toupper(dbffieldname[nameit]);
1564  }
1565 
1566  /* Issue warning if column has been renamed */
1567  if (strcasecmp(dbffieldname, pgfieldname))
1568  {
1569  snprintf(buf, sizeof(buf), _("Warning, field %s renamed to %s\n"), pgfieldname, dbffieldname);
1570  /* Note: we concatenate all warnings from the main loop as this is useful information */
1571  if (SHPDUMPERMSGLEN > (strlen(state->message) + 1))
1572  strncat(state->message, buf, SHPDUMPERMSGLEN - (strlen(state->message) + 1));
1573 
1574  ret = SHPDUMPERWARN;
1575  }
1576 
1577 
1578  /*
1579  * Find appropriate type of dbf attributes
1580  */
1581 
1582  /* int2 type */
1583  if (pgfieldtype == 21)
1584  {
1585  /*
1586  * Longest text representation for
1587  * an int2 type (16bit) is 6 bytes
1588  * (-32768)
1589  */
1590  dbffieldtype = FTInteger;
1591  dbffieldsize = 6;
1592  dbffielddecs = 0;
1593  }
1594 
1595  /* int4 type */
1596  else if (pgfieldtype == 23)
1597  {
1598  /*
1599  * Longest text representation for
1600  * an int4 type (32bit) is 11 bytes
1601  * (-2147483648)
1602  */
1603  dbffieldtype = FTInteger;
1604  dbffieldsize = 11;
1605  dbffielddecs = 0;
1606  }
1607 
1608  /* int8 type */
1609  else if (pgfieldtype == 20)
1610  {
1611  /*
1612  * Longest text representation for
1613  * an int8 type (64bit) is 20 bytes
1614  * (-9223372036854775808)
1615  */
1616  dbffieldtype = FTInteger;
1617  dbffieldsize = 19;
1618  dbffielddecs = 0;
1619  }
1620 
1621  /*
1622  * double or numeric types:
1623  * 700: float4
1624  * 701: float8
1625  * 1700: numeric
1626  *
1627  *
1628  * TODO: stricter handling of sizes
1629  */
1630  else if (pgfieldtype == 700 || pgfieldtype == 701 || pgfieldtype == 1700)
1631  {
1632  dbffieldtype = FTDouble;
1633  dbffieldsize = 32;
1634  dbffielddecs = 10;
1635  }
1636 
1637  /*
1638  * Boolean field, we use FTLogical
1639  */
1640  else if (pgfieldtype == 16)
1641  {
1642  dbffieldtype = FTLogical;
1643  dbffieldsize = 1;
1644  dbffielddecs = 0;
1645  }
1646 
1647  /*
1648  * Date field
1649  */
1650  else if (pgfieldtype == 1082)
1651  {
1652  dbffieldtype = FTDate;
1653  dbffieldsize = 8;
1654  dbffielddecs = 0;
1655  }
1656 
1657  /*
1658  * time, timetz, timestamp, or timestamptz field.
1659  */
1660  else if (pgfieldtype == 1083 || pgfieldtype == 1266 || pgfieldtype == 1114 || pgfieldtype == 1184)
1661  {
1662  int secondsize;
1663 
1664  switch (pgtypmod)
1665  {
1666  case -1:
1667  secondsize = 6 + 1;
1668  break;
1669  case 0:
1670  secondsize = 0;
1671  break;
1672  default:
1673  secondsize = pgtypmod + 1;
1674  break;
1675  }
1676 
1677  /* We assume the worst case scenario for all of these:
1678  * date = '5874897-12-31' = 13
1679  * date = '294276-11-20' = 12 (with --enable-interger-datetimes)
1680  * time = '00:00:00' = 8
1681  * zone = '+01:39:52' = 9 (see Europe/Helsinki around 1915)
1682  */
1683 
1684  /* time */
1685  if (pgfieldtype == 1083)
1686  {
1687  dbffieldsize = 8 + secondsize;
1688  }
1689  /* timetz */
1690  else if (pgfieldtype == 1266)
1691  {
1692  dbffieldsize = 8 + secondsize + 9;
1693  }
1694  /* timestamp */
1695  else if (pgfieldtype == 1114)
1696  {
1697  dbffieldsize = 13 + 1 + 8 + secondsize;
1698  }
1699  /* timestamptz */
1700  else if (pgfieldtype == 1184)
1701  {
1702  dbffieldsize = 13 + 1 + 8 + secondsize + 9;
1703  }
1704 
1705  dbffieldtype = FTString;
1706  dbffielddecs = 0;
1707  }
1708 
1709  /*
1710  * uuid type 36 bytes (12345678-9012-3456-7890-123456789012)
1711  */
1712  else if (pgfieldtype == 2950)
1713  {
1714  dbffieldtype = FTString;
1715  dbffieldsize = 36;
1716  dbffielddecs = 0;
1717  }
1718 
1719  /*
1720  * For variable-sized fields we know about, we use
1721  * the maximum allowed size.
1722  * 1042 is bpchar, 1043 is varchar
1723  */
1724  else if ((pgfieldtype == 1042 || pgfieldtype == 1043) && pgtypmod != -1)
1725  {
1726  /*
1727  * mod is maximum allowed size, including
1728  * header which contains *real* size.
1729  */
1730  dbffieldtype = FTString;
1731  dbffieldsize = pgtypmod - 4; /* 4 is header size */
1732  dbffielddecs = 0;
1733  }
1734 
1735  /* For all other valid non-geometry/geography fields... */
1736  else if (dbffieldtype == -1)
1737  {
1738  /*
1739  * For types we don't know anything about, all
1740  * we can do is query the table for the maximum field
1741  * size.
1742  */
1743  dbffieldsize = getMaxFieldSize(state->conn, state->schema, state->table, pgfieldname);
1744  if (dbffieldsize == -1)
1745  {
1746  free(dbffieldname);
1747  return 0;
1748  }
1749 
1750  if (!dbffieldsize)
1751  dbffieldsize = 32;
1752 
1753  /* might 0 be a good size ? */
1754 
1755  dbffieldtype = FTString;
1756  dbffielddecs = 0;
1757 
1758  /* Check to make sure the final field size isn't too large */
1759  if (dbffieldsize > MAX_DBF_FIELD_SIZE)
1760  {
1761  /* Note: we concatenate all warnings from the main loop as this is useful information */
1762  snprintf(buf, sizeof(buf), _("Warning: values of field '%s' exceeding maximum dbf field width (%d) "
1763  "will be truncated.\n"), dbffieldname, MAX_DBF_FIELD_SIZE);
1764 
1765  if (SHPDUMPERMSGLEN > (strlen(state->message) + 1))
1766  strncat(state->message, buf, SHPDUMPERMSGLEN - (strlen(state->message)+1));
1767 
1768  dbffieldsize = MAX_DBF_FIELD_SIZE;
1769 
1770  ret = SHPDUMPERWARN;
1771  }
1772  }
1773 
1774  LWDEBUGF(3, "DBF FIELD_NAME: %s, SIZE: %d\n", dbffieldname, dbffieldsize);
1775 
1776  if (dbffieldtype != 9)
1777  {
1778  /* Add the field to the DBF file */
1779  if (DBFAddField(state->dbf, dbffieldname, dbffieldtype, dbffieldsize, dbffielddecs) == -1)
1780  {
1781  snprintf(state->message, SHPDUMPERMSGLEN, _("Error: field %s of type %d could not be created."), dbffieldname, dbffieldtype);
1782 
1783  return SHPDUMPERERR;
1784  }
1785 
1786  /* Add the field information to our field arrays */
1787  state->dbffieldnames[state->fieldcount] = dbffieldname;
1788  state->dbffieldtypes[state->fieldcount] = dbffieldtype;
1789  state->pgfieldnames[state->fieldcount] = pgfieldname;
1790  state->pgfieldlens[state->fieldcount] = pgfieldlen;
1791  state->pgfieldtypmods[state->fieldcount] = pgtypmod;
1792 
1793  state->fieldcount++;
1794  }
1795  }
1796 
1797  /* Now we have generated the field lists, grab some info about the table */
1798  status = getTableInfo(state);
1799  if (status == SHPDUMPERERR)
1800  return SHPDUMPERERR;
1801 
1802  LWDEBUGF(3, "rows: %d\n", state->rowcount);
1803  LWDEBUGF(3, "shptype: %c\n", state->outtype);
1804  LWDEBUGF(3, "shpouttype: %d\n", state->outshptype);
1805 
1806  /* If we didn't find a geometry/geography column... */
1807  if (!state->geo_col_name)
1808  {
1809  if (state->config->geo_col_name)
1810  {
1811  /* A geo* column was specified, but not found */
1812  snprintf(state->message, SHPDUMPERMSGLEN, _("%s: no such attribute in table %s"), state->config->geo_col_name, state->table);
1813 
1814  return SHPDUMPERERR;
1815  }
1816  else
1817  {
1818  /* No geo* column specified so we can only create the DBF section -
1819  but let's issue a warning... */
1820  snprintf(buf, sizeof(buf), _("No geometry column found.\nThe DBF file will be created but not the shx or shp files.\n"));
1821  if (SHPDUMPERMSGLEN > (strlen(state->message) + 1))
1822  strncat(state->message, buf, SHPDUMPERMSGLEN - (strlen(state->message)+1));
1823 
1824  state->shp = NULL;
1825 
1826  ret = SHPDUMPERWARN;
1827  }
1828  }
1829  else
1830  {
1831  /* Since we have found a geo* column, open the shapefile */
1832  state->shp = SHPCreate(state->shp_file, state->outshptype);
1833  if (!state->shp)
1834  {
1835  snprintf(state->message, SHPDUMPERMSGLEN, _("Could not open shapefile %s!"), state->shp_file);
1836 
1837  return SHPDUMPERERR;
1838  }
1839  }
1840 
1841  /* Now we have the complete list of fieldnames, let's generate the SQL query. First let's make sure
1842  we reserve enough space for tables with lots of columns */
1843  j = 0;
1844 
1845  /*TODO: this really should be rewritten to use stringbuffer */
1846  for (i = 0; i < state->fieldcount; i++)
1847  j += strlen( state->pgfieldnames[i]) + 10; /*add extra space for the quotes to quote identify and any embedded quotes that may need escaping */
1848 
1849  state->main_scan_query = malloc(1024 + j);
1850 
1851  sprintf(state->main_scan_query, "DECLARE cur ");
1852  if (state->config->binary)
1853  strcat(state->main_scan_query, "BINARY ");
1854 
1855  strcat(state->main_scan_query, "CURSOR FOR SELECT ");
1856 
1857  for (i = 0; i < state->fieldcount; i++)
1858  {
1859  /* Comma-separated column names */
1860  if (i > 0)
1861  strcat(state->main_scan_query, ",");
1862 
1863  if (state->config->binary)
1864  sprintf(buf, "%s::text", quote_identifier(state->pgfieldnames[i]) ) ;
1865  else
1866  sprintf(buf, "%s", quote_identifier(state->pgfieldnames[i]) );
1867 
1868  strcat(state->main_scan_query, buf);
1869  }
1870 
1871  /* If we found a valid geometry/geography column then use it */
1872  if (state->geo_col_name)
1873  {
1874  /* If this is the (only) column, no need for the initial comma */
1875  if (state->fieldcount > 0)
1876  strcat(state->main_scan_query, ",");
1877 
1878 #ifdef WORDS_BIGENDIAN
1879  if (state->pgis_major_version > 0)
1880  {
1881  sprintf(buf, "ST_asEWKB(ST_SetSRID(%s::geometry, 0), 'XDR') AS _geoX", quote_identifier(state->geo_col_name) );
1882  }
1883  else
1884  {
1885  sprintf(buf, "asbinary(%s::geometry, 'XDR') AS _geoX",
1886  quote_identifier(state->geo_col_name) );
1887  }
1888 #else
1889  if (state->pgis_major_version > 0)
1890  {
1891  sprintf(buf, "ST_AsEWKB(ST_SetSRID(%s::geometry, 0), 'NDR') AS _geoX", quote_identifier(state->geo_col_name) ) ;
1892  }
1893  else
1894  {
1895  sprintf(buf, "asbinary(%s::geometry, 'NDR') AS _geoX",
1896  quote_identifier(state->geo_col_name) );
1897  }
1898 #endif
1899 
1900  strcat(state->main_scan_query, buf);
1901  }
1902 
1903  if (state->schema)
1904  {
1905  sprintf(buf, " FROM \"%s\".\"%s\"", state->schema, state->table);
1906  }
1907  else
1908  {
1909  sprintf(buf, " FROM \"%s\"", state->table);
1910  }
1911 
1912  strcat(state->main_scan_query, buf);
1913 
1914  /* Order by 'gid' (if found) */
1915  if (gidfound)
1916  {
1917  sprintf(buf, " ORDER BY \"gid\"");
1918  strcat(state->main_scan_query, buf);
1919  }
1920 
1921  /* Now we've finished with the result set, we can dispose of it */
1922  PQclear(res);
1923 
1924  LWDEBUGF(3, "FINAL QUERY: %s\n", state->main_scan_query);
1925 
1926  /*
1927  * Begin the transaction
1928  * (a cursor can only be defined inside a transaction block)
1929  */
1930  res = PQexec(state->conn, "BEGIN");
1931  if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
1932  {
1933  snprintf(state->message, SHPDUMPERMSGLEN, _("Error starting transaction: %s"), PQresultErrorMessage(res));
1934  PQclear(res);
1935  return SHPDUMPERERR;
1936  }
1937 
1938  PQclear(res);
1939 
1940  /* Execute the main scan query */
1941  res = PQexec(state->conn, state->main_scan_query);
1942  if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
1943  {
1944  snprintf(state->message, SHPDUMPERMSGLEN, _("Error executing main scan query: %s"), PQresultErrorMessage(res));
1945  PQclear(res);
1946  return SHPDUMPERERR;
1947  }
1948 
1949  PQclear(res);
1950 
1951  /* Setup initial scan state */
1952  state->currow = 0;
1953  state->curresrow = 0;
1954  state->currescount = 0;
1955  state->fetchres = NULL;
1956 
1957  /* Generate the fetch query */
1958  tmpint = asprintf(&(state->fetch_query), "FETCH %d FROM cur", state->config->fetchsize);
1959 
1960  return SHPDUMPEROK;
1961 }
char * r
Definition: cu_in_wkt.c:24
int SHPAPI_CALL DBFAddField(DBFHandle psDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
Definition: dbfopen.c:788
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszFilename, const char *pszCodePage)
Definition: dbfopen.c:662
void SHPAPI_CALL DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
Definition: dbfopen.c:2297
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void * malloc(YYSIZE_T)
void free(void *)
tuple res
Definition: window.py:79
static int getMaxFieldSize(PGconn *conn, char *schema, char *table, char *fname)
static int getTableInfo(SHPDUMPERSTATE *state)
char * quote_identifier(const char *s)
#define MAX_DBF_FIELD_SIZE
#define SHPDUMPERMSGLEN
#define SHPDUMPEROK
#define SHPDUMPERERR
#define SHPDUMPERWARN
SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType)
Definition: shpopen.c:981
@ FTDouble
Definition: shapefil.h:641
@ FTString
Definition: shapefil.h:639
@ FTLogical
Definition: shapefil.h:642
@ FTDate
Definition: shapefil.h:643
@ FTInteger
Definition: shapefil.h:640
char * encoding2codepage(const char *encoding)
Definition: shpcommon.c:343
int colmap_read(const char *filename, colmap *map, char *errbuf, size_t errbuflen)
Read the content of filename into a symbol map.
Definition: shpcommon.c:213
const char * colmap_dbf_by_pg(colmap *map, const char *pgname)
Definition: shpcommon.c:185
#define _(String)
Definition: shpcommon.h:24
char * column_map_filename
SHPDUMPERCONFIG * config
PGresult * fetchres
char message[SHPDUMPERMSGLEN]

References _, shp_dumper_config::binary, colmap_dbf_by_pg(), colmap_read(), shp_dumper_state::column_map, shp_dumper_config::column_map_filename, shp_dumper_state::config, shp_dumper_state::conn, shp_dumper_state::currescount, shp_dumper_state::curresrow, shp_dumper_state::currow, shp_dumper_state::dbf, DBFAddField(), DBFCreateEx(), shp_dumper_state::dbffieldnames, shp_dumper_state::dbffieldtypes, DBFSetWriteEndOfFileChar(), encoding2codepage(), shp_dumper_state::fetch_query, shp_dumper_state::fetchres, shp_dumper_config::fetchsize, shp_dumper_state::fieldcount, free(), FTDate, FTDouble, FTInteger, FTLogical, FTString, shp_dumper_config::geo_col_name, shp_dumper_state::geo_col_name, shp_dumper_state::geog_oid, shp_dumper_state::geom_oid, getMaxFieldSize(), getTableInfo(), shp_dumper_config::includegid, shp_dumper_config::keep_fieldname_case, LWDEBUGF, shp_dumper_state::main_scan_query, malloc(), MAX_DBF_FIELD_SIZE, shp_dumper_state::message, shp_dumper_state::outshptype, shp_dumper_state::outtype, shp_dumper_state::pgfieldlens, shp_dumper_state::pgfieldnames, shp_dumper_state::pgfieldtypmods, shp_dumper_state::pgis_major_version, quote_identifier(), r, window::res, shp_dumper_state::rowcount, shp_dumper_config::schema, shp_dumper_state::schema, shp_dumper_state::shp, shp_dumper_config::shp_file, shp_dumper_state::shp_file, SHPCreate(), SHPDUMPERERR, SHPDUMPERMSGLEN, SHPDUMPEROK, SHPDUMPERWARN, shp_dumper_config::table, shp_dumper_state::table, shp_dumper_config::unescapedattrs, and shp_dumper_config::usrquery.

Referenced by main(), and pgui_action_export().

Here is the call graph for this function:
Here is the caller graph for this function: