PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ShpDumperGetConnectionStringFromConn()

char * ShpDumperGetConnectionStringFromConn ( SHPCONNECTIONCONFIG conn)

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

1182{
1183 char *connstring;
1184 int connlen;
1185
1186 connlen = 64 +
1187 (conn->host ? strlen(conn->host) : 0) + (conn->port ? strlen(conn->port) : 0) +
1188 (conn->username ? strlen(conn->username) : 0) + (conn->password ? strlen(conn->password) : 0) +
1189 (conn->database ? strlen(conn->database) : 0);
1190
1191 connstring = malloc(connlen);
1192 memset(connstring, 0, connlen);
1193
1194 if (conn->host)
1195 {
1196 strcat(connstring, " host=");
1197 strcat(connstring, conn->host);
1198 }
1199
1200 if (conn->port)
1201 {
1202 strcat(connstring, " port=");
1203 strcat(connstring, conn->port);
1204 }
1205
1206 if (conn->username)
1207 {
1208 strcat(connstring, " user=");
1209 strcat(connstring, conn->username);
1210 }
1211
1212 if (conn->password)
1213 {
1214 strcat(connstring, " password='");
1215 strcat(connstring, conn->password);
1216 strcat(connstring, "'");
1217 }
1218
1219 if (conn->database)
1220 {
1221 strcat(connstring, " dbname=");
1222 strcat(connstring, conn->database);
1223 }
1224
1225 if ( ! getenv("PGCLIENTENCODING") )
1226 {
1227 strcat(connstring, " client_encoding=UTF8");
1228 }
1229
1230 return connstring;
1231}
void * malloc(YYSIZE_T)
static SHPCONNECTIONCONFIG * conn

References conn, shp_connection_state::database, shp_connection_state::host, malloc(), shp_connection_state::password, shp_connection_state::port, and shp_connection_state::username.

Referenced by connection_test(), pgui_action_import(), ShpDumperConnectDatabase(), and update_table_chooser_from_database().

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