1237{
1239
1240 char *connstring, *tmpvalue;
1241
1242
1244
1245
1246 state->
conn = PQconnectdb(connstring);
1247 if (PQstatus(state->
conn) == CONNECTION_BAD)
1248 {
1252 }
1253
1254
1255 res = PQexec(state->
conn,
"SET DATESTYLE='ISO'");
1256 if (PQresultStatus(res) != PGRES_COMMAND_OK)
1257 {
1259 PQclear(res);
1262 }
1263
1264 PQclear(res);
1265
1266
1267 res = PQexec(state->
conn,
"SELECT postgis_version()");
1268 if (PQresultStatus(res) != PGRES_TUPLES_OK)
1269 {
1271 PQclear(res);
1274 }
1275
1276 tmpvalue = PQgetvalue(res, 0, 0);
1278
1279 PQclear(res);
1280
1281
1282 res = PQexec(state->
conn,
"SELECT oid FROM pg_type WHERE typname = 'geometry'");
1283 if (PQresultStatus(res) != PGRES_TUPLES_OK)
1284 {
1286 PQclear(res);
1289 }
1290
1291 if (PQntuples(res) > 0)
1292 {
1293 tmpvalue = PQgetvalue(res, 0, 0);
1295 }
1296 else
1297 {
1299 PQclear(res);
1302 }
1303
1304 PQclear(res);
1305
1306
1307 res = PQexec(state->
conn,
"SELECT oid FROM pg_type WHERE typname = 'geography'");
1308 if (PQresultStatus(res) != PGRES_TUPLES_OK)
1309 {
1310 snprintf(state->
message,
SHPDUMPERMSGLEN,
_(
"Error looking up geography oid: %s"), PQresultErrorMessage(res));
1311 PQclear(res);
1314 }
1315
1316 if (PQntuples(res) > 0)
1317 {
1318
1319 tmpvalue = PQgetvalue(res, 0, 0);
1321 }
1322
1323 PQclear(res);
1324
1326
1328}
char * ShpDumperGetConnectionStringFromConn(SHPCONNECTIONCONFIG *conn)
SHPCONNECTIONCONFIG * conn
char message[SHPDUMPERMSGLEN]