PostGIS  2.1.10dev-r@@SVN_REVISION@@
char* ShpDumperGetConnectionStringFromConn ( SHPCONNECTIONCONFIG config)

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

References shp_connection_state::database, shp_connection_state::host, 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().

1274 {
1275  char *connstring;
1276  int connlen;
1277 
1278  connlen = 64 +
1279  (conn->host ? strlen(conn->host) : 0) + (conn->port ? strlen(conn->port) : 0) +
1280  (conn->username ? strlen(conn->username) : 0) + (conn->password ? strlen(conn->password) : 0) +
1281  (conn->database ? strlen(conn->database) : 0);
1282 
1283  connstring = malloc(connlen);
1284  memset(connstring, 0, connlen);
1285 
1286  if (conn->host)
1287  {
1288  strcat(connstring, " host=");
1289  strcat(connstring, conn->host);
1290  }
1291 
1292  if (conn->port)
1293  {
1294  strcat(connstring, " port=");
1295  strcat(connstring, conn->port);
1296  }
1297 
1298  if (conn->username)
1299  {
1300  strcat(connstring, " user=");
1301  strcat(connstring, conn->username);
1302  }
1303 
1304  if (conn->password)
1305  {
1306  strcat(connstring, " password='");
1307  strcat(connstring, conn->password);
1308  strcat(connstring, "'");
1309  }
1310 
1311  if (conn->database)
1312  {
1313  strcat(connstring, " dbname=");
1314  strcat(connstring, conn->database);
1315  }
1316 
1317  return connstring;
1318 }
static SHPCONNECTIONCONFIG * conn

Here is the caller graph for this function: