1548{
1553 char *escval;
1554 char *geometry=NULL, *ret;
1555 char *utf8str;
1557 int rv;
1558
1559
1564
1565
1567 {
1568 *strrecord = NULL;
1570 }
1571
1572
1574 {
1576 if (!obj)
1577 {
1580 }
1581
1582
1584 {
1586
1587 *strrecord = NULL;
1589 }
1590 }
1591
1592
1594 {
1596 {
1599 }
1600 else
1601 {
1604 }
1605 }
1606
1607
1608
1610 {
1611
1613 {
1616 else
1618 }
1619 else
1620 {
1621
1622 switch (state->
types[i])
1623 {
1624 case FTInteger:
1625 case FTDouble:
1628 {
1631 }
1632
1633
1634 if (val[0] == '\0')
1635 {
1636 val[0] = '0';
1637 val[1] = '\0';
1638 }
1639
1640
1641 if (val[strlen(val) - 1] == '.')
1642 val[strlen(val) - 1] = '\0';
1643 break;
1644
1645 case FTString:
1646 case FTLogical:
1649 {
1652 }
1653 break;
1654
1655 case FTDate:
1658 {
1661 }
1662 if (strlen(val) == 0)
1663 {
1666 else
1668 goto done_cell;
1669 }
1670 break;
1671
1672 default:
1674
1675
1680 }
1681
1683 {
1684 char *encoding_msg =
_(
"Try \"LATIN1\" (Western European), or one of the values described at http://www.postgresql.org/docs/current/static/multibyte.html.");
1685
1687
1689 {
1691 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);
1693 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);
1694 else
1696
1699
1700
1705 }
1709
1710 }
1711
1712
1714 {
1717 }
1718 else
1719 {
1722 }
1723
1724
1725 if (val != escval)
1727 }
1728
1729done_cell:
1730
1731
1733 {
1736 else
1738 }
1739
1740
1741 }
1742
1743
1744
1746 {
1747
1748 char *oldlocale = setlocale(LC_NUMERIC, "C");
1749
1750
1752 {
1755 else
1757 }
1758 else
1759 {
1760
1762 {
1767 break;
1768
1773 break;
1774
1778
1781 break;
1782
1787 break;
1788
1789 default:
1794
1796 }
1797
1799 {
1800
1804
1806 }
1807
1808
1810 {
1812 {
1814 }
1816 }
1817
1819
1821 {
1823
1824
1826 {
1827
1828
1829
1832 else
1834 }
1835 }
1836
1838 }
1839
1840
1842
1843 setlocale(LC_NUMERIC, oldlocale);
1844 }
1845
1846
1849
1850
1851
1855
1856 *strrecord = ret;
1857
1858
1860 {
1863
1865 }
1866 else
1867 {
1868
1870
1872 }
1873}
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
const char SHPAPI_CALL1 * DBFReadStringAttribute(DBFHandle psDBF, int iRecord, int iField){ return((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]