Definition at line 1548 of file shp2pgsql-core.c.
1549{
1554 char *escval;
1555 char *geometry=NULL, *ret;
1556 char *utf8str;
1558 int rv;
1559
1560
1565
1566
1568 {
1569 *strrecord = NULL;
1571 }
1572
1573
1575 {
1577 if (!obj)
1578 {
1581 }
1582
1583
1585 {
1587
1588 *strrecord = NULL;
1590 }
1591 }
1592
1593
1595 {
1597 {
1600 }
1601 else
1602 {
1605 }
1606 }
1607
1608
1609
1611 {
1612
1614 {
1617 else
1619 }
1620 else
1621 {
1622
1623 switch (state->
types[i])
1624 {
1629 {
1632 }
1633
1634
1635 if (val[0] == '\0')
1636 {
1637 val[0] = '0';
1638 val[1] = '\0';
1639 }
1640
1641
1642 if (val[strlen(val) - 1] == '.')
1643 val[strlen(val) - 1] = '\0';
1644 break;
1645
1650 {
1653 }
1654 break;
1655
1659 {
1662 }
1663 if (strlen(val) == 0)
1664 {
1667 else
1669 goto done_cell;
1670 }
1671 break;
1672
1673 default:
1675
1676
1681 }
1682
1684 {
1685 char *encoding_msg =
_(
"Try \"LATIN1\" (Western European), or one of the values described at http://www.postgresql.org/docs/current/static/multibyte.html.");
1686
1688
1690 {
1692 snprintf(state->
message,
SHPLOADERMSGLEN,
_(
"Unable to convert data value \"%s\" to UTF-8 (iconv reports \"%s\"). Current encoding is \"%s\". %s"), utf8str, strerror(errno), state->
config->
encoding, encoding_msg);
1694 snprintf(state->
message,
SHPLOADERMSGLEN,
_(
"Unable to convert data value to UTF-8 (iconv reports \"%s\"). Current encoding is \"%s\". %s"), strerror(errno), state->
config->
encoding, encoding_msg);
1695 else
1697
1700
1701
1706 }
1710
1711 }
1712
1713
1715 {
1718 }
1719 else
1720 {
1723 }
1724
1725
1726 if (val != escval)
1728 }
1729
1730done_cell:
1731
1732
1734 {
1737 else
1739 }
1740
1741
1742 }
1743
1744
1745
1747 {
1748
1749 char *oldlocale = setlocale(LC_NUMERIC, "C");
1750
1751
1753 {
1756 else
1758 }
1759 else
1760 {
1761
1763 {
1768 break;
1769
1774 break;
1775
1779
1782 break;
1783
1788 break;
1789
1790 default:
1795
1797 }
1798
1800 {
1801
1805
1807 }
1808
1809
1811 {
1813 {
1815 }
1817 }
1818
1820
1822 {
1824
1825
1827 {
1828
1829
1830
1833 else
1835 }
1836 }
1837
1839 }
1840
1841
1843
1844 setlocale(LC_NUMERIC, oldlocale);
1845 }
1846
1847
1850
1851
1852
1856
1857 *strrecord = ret;
1858
1859
1861 {
1864
1866 }
1867 else
1868 {
1869
1871
1873 }
1874}
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
const char SHPAPI_CALL1 * DBFReadStringAttribute(DBFHandle psDBF, int iRecord, int iField){ return STATIC_CAST(const char *, DBFReadAttribute(psDBF, iRecord, iField, 'C')
int SHPAPI_CALL DBFIsAttributeNULL(DBFHandle psDBF, int iRecord, int iField)
int SHPAPI_CALL DBFIsRecordDeleted(DBFHandle psDBF, int iShape)
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
SHPObject SHPAPI_CALL1 * SHPReadObject(SHPHandle hSHP, int iShape);int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, SHPObject *psObject
static int utf8(const char *fromcode, char *inputbuf, char **outputbuf)
int GeneratePointGeometry(SHPLOADERSTATE *state, SHPObject *obj, char **geometry, int force_multi)
Generate an allocated geometry string for shapefile object obj using the state parameters if "force_m...
char * escape_insert_string(char *str)
Escape input string suitable for INSERT.
int GeneratePolygonGeometry(SHPLOADERSTATE *state, SHPObject *obj, char **geometry)
Generate an allocated geometry string for shapefile object obj using the state parameters.
char * escape_copy_string(char *str)
Escape input string suitable for COPY.
int GenerateLineStringGeometry(SHPLOADERSTATE *state, SHPObject *obj, char **geometry)
Generate an allocated geometry string for shapefile object obj using the state parameters.
#define SHPLOADERRECISNULL
#define SHPLOADERRECDELETED
stringbuffer_t * stringbuffer_create(void)
Allocate a new stringbuffer_t.
void stringbuffer_clear(stringbuffer_t *s)
Reset the stringbuffer_t.
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
const char * stringbuffer_getstring(stringbuffer_t *s)
Returns a reference to the internal string being managed by the stringbuffer.
void stringbuffer_destroy(stringbuffer_t *s)
Free the stringbuffer_t and all memory managed within it.
char message[SHPLOADERMSGLEN]
References _, shp_loader_state::col_names, shp_loader_state::config, DBFGetFieldCount(), DBFIsAttributeNULL(), DBFIsRecordDeleted(), DBFReadStringAttribute(), shp_loader_config::dump_format, shp_loader_config::encoding, escape_copy_string(), escape_insert_string(), free(), shp_loader_state::from_srid, FTDate, FTDouble, FTInteger, FTLogical, FTString, GenerateLineStringGeometry(), GeneratePointGeometry(), GeneratePolygonGeometry(), shp_loader_config::geography, shp_loader_state::hDBFHandle, shp_loader_state::hSHPHandle, lwfree(), malloc(), MAXVALUELEN, shp_loader_state::message, tagSHPObject::nSHPType, shp_loader_config::null_policy, tagSHPObject::nVertices, POLICY_NULL_SKIP, shp_loader_config::readshape, shp_loader_config::schema, SHPDestroyObject(), SHPLOADERERR, SHPLOADERMSGLEN, SHPLOADEROK, SHPLOADERRECDELETED, SHPLOADERRECISNULL, SHPLOADERWARN, SHPReadObject(), 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_loader_config::simple_geometries, stringbuffer_aprintf(), stringbuffer_clear(), stringbuffer_create(), stringbuffer_destroy(), stringbuffer_getstring(), shp_loader_config::table, shp_loader_state::to_srid, shp_loader_state::types, utf8(), UTF8_BAD_RESULT, UTF8_GOOD_RESULT, and UTF8_NO_RESULT.
Referenced by main(), and pgui_action_import().