PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@
shpcommon.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * Copyright (C) 2014 Sandro Santilli <strk@kbt.io>
7  * Copyright (C) 2010 Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU General Public Licence. See the COPYING file.
11  *
12  **********************************************************************/
13 
14 #ifndef SHPCOMMON_H
15 #define SHPCOMMON_H
16 
17 /* For internationalization */
18 #ifdef ENABLE_NLS
19 #include <libintl.h>
20 #include <locale.h>
21 #define _(String) gettext(String)
22 #define PACKAGE "shp2pgsql"
23 #else
24 #define _(String) String
25 #endif
26 
27 
28 
29 typedef struct shp_connection_state
30 {
31  /* PgSQL username to log in with */
32  char *username;
33 
34  /* PgSQL password to log in with */
35  char *password;
36 
37  /* PgSQL database to connect to */
38  char *database;
39 
40  /* PgSQL port to connect to */
41  char *port;
42 
43  /* PgSQL server to connect to */
44  char *host;
45 
47 
48 /* External shared functions */
49 char *escape_connection_string(char *str);
50 
51 /* Column map between pgsql and dbf */
52 typedef struct colmap_t {
53 
54  /* Column map pgfieldnames */
55  char **pgfieldnames;
56 
57  /* Column map dbffieldnames */
58  char **dbffieldnames;
59 
60  /* Number of entries within column map */
61  int size;
62 
63 } colmap;
64 
95 int colmap_read(const char *fname, colmap *map, char *ebuf, size_t ebuflen);
96 
97 void colmap_init(colmap *map);
98 
99 void colmap_clean(colmap *map);
100 
101 const char *colmap_dbf_by_pg(colmap *map, const char *pgname);
102 
103 const char *colmap_pg_by_dbf(colmap *map, const char *dbfname);
104 
105 char *codepage2encoding(const char *cpg);
106 char *encoding2codepage(const char *encoding);
107 
108 #endif
void colmap_clean(colmap *map)
Definition: shpcommon.c:167
int size
Definition: shpcommon.h:61
struct shp_connection_state SHPCONNECTIONCONFIG
char * codepage2encoding(const char *cpg)
Definition: shpcommon.c:288
int colmap_read(const char *fname, colmap *map, char *ebuf, size_t ebuflen)
Read the content of filename into a symbol map.
Definition: shpcommon.c:213
void colmap_init(colmap *map)
Definition: shpcommon.c:159
char ** pgfieldnames
Definition: shpcommon.h:55
struct colmap_t colmap
char * escape_connection_string(char *str)
Escape strings that are to be used as part of a PostgreSQL connection string.
Definition: shpcommon.c:109
char * encoding2codepage(const char *encoding)
Definition: shpcommon.c:343
char ** dbffieldnames
Definition: shpcommon.h:58
const char * colmap_pg_by_dbf(colmap *map, const char *dbfname)
Definition: shpcommon.c:199
const char * colmap_dbf_by_pg(colmap *map, const char *pgname)
Definition: shpcommon.c:185