1218{
1220 char *tmpvalue;
1221
1222
1224
1225
1226 state->
conn = PQconnectdb(connstring);
1227 if (PQstatus(state->
conn) == CONNECTION_BAD)
1228 {
1232 }
1233
1234
1235 res = PQexec(state->
conn,
"SET DATESTYLE='ISO'");
1236 if (PQresultStatus(res) != PGRES_COMMAND_OK)
1237 {
1239 PQclear(res);
1242 }
1243
1244 PQclear(res);
1245
1246
1247 res = PQexec(state->
conn,
"SELECT postgis_version()");
1248 if (PQresultStatus(res) != PGRES_TUPLES_OK)
1249 {
1251 PQclear(res);
1254 }
1255
1256 tmpvalue = PQgetvalue(res, 0, 0);
1258
1259 PQclear(res);
1260
1261
1262 res = PQexec(state->
conn,
"SELECT oid FROM pg_type WHERE typname = 'geometry'");
1263 if (PQresultStatus(res) != PGRES_TUPLES_OK)
1264 {
1266 PQclear(res);
1269 }
1270
1271 if (PQntuples(res) > 0)
1272 {
1273 tmpvalue = PQgetvalue(res, 0, 0);
1275 }
1276 else
1277 {
1279 PQclear(res);
1282 }
1283
1284 PQclear(res);
1285
1286
1287 res = PQexec(state->
conn,
"SELECT oid FROM pg_type WHERE typname = 'geography'");
1288 if (PQresultStatus(res) != PGRES_TUPLES_OK)
1289 {
1290 snprintf(state->
message,
SHPDUMPERMSGLEN,
_(
"Error looking up geography oid: %s"), PQresultErrorMessage(res));
1291 PQclear(res);
1294 }
1295
1296 if (PQntuples(res) > 0)
1297 {
1298
1299 tmpvalue = PQgetvalue(res, 0, 0);
1301 }
1302
1303 PQclear(res);
1304
1306
1308}
char * ShpDumperGetConnectionStringFromConn(SHPCONNECTIONCONFIG *conn)
SHPCONNECTIONCONFIG * conn
char message[SHPDUMPERMSGLEN]