Bläddra i källkod

dbdriver(pg): ignore topogeometry columns

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51440 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 år sedan
förälder
incheckning
dd866864cf
3 ändrade filer med 12 tillägg och 3 borttagningar
  1. 4 1
      db/drivers/postgres/db.c
  2. 5 0
      db/drivers/postgres/describe.c
  3. 3 2
      db/drivers/postgres/globals.h

+ 4 - 1
db/drivers/postgres/db.c

@@ -99,7 +99,7 @@ int db__driver_open_database(dbHandle * handle)
 		 "'float4', 'float8', 'numeric', "
 		 "'char', 'bpchar', 'varchar', 'text', "
 		 "'time', 'date', 'timestamp', "
-		 "'bool', 'geometry' ) order by oid");
+		 "'bool', 'geometry', 'topogeometry') order by oid");
     
     if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) {
 	db_d_append_error(_("Unable to select data types"));
@@ -118,6 +118,7 @@ int db__driver_open_database(dbHandle * handle)
 
 	pg_types[row][0] = pgtype;
 
+        G_debug(3, "row = %d value = %s", row, PQgetvalue(res, row, 1));
 	if (strcmp(PQgetvalue(res, row, 1), "bit") == 0)
 	    type = PG_TYPE_BIT;
 	else if (strcmp(PQgetvalue(res, row, 1), "int2") == 0)
@@ -154,6 +155,8 @@ int db__driver_open_database(dbHandle * handle)
 	    type = PG_TYPE_BOOL;
 	else if (strcmp(PQgetvalue(res, row, 1), "geometry") == 0)
 	    type = PG_TYPE_POSTGIS_GEOM;
+	else if (strcmp(PQgetvalue(res, row, 1), "topogeometry") == 0)
+	    type = PG_TYPE_POSTGIS_TOPOGEOM;
 	else
 	    type = PG_TYPE_UNKNOWN;
 

+ 5 - 0
db/drivers/postgres/describe.c

@@ -113,6 +113,11 @@ int describe_table(PGresult * res, dbTable ** table, cursor * c)
 			"will not be converted", fname);
 		continue;
 	    }
+	    else if (gpgtype == PG_TYPE_POSTGIS_TOPOGEOM) {
+		G_debug(1, "PostgreSQL driver: PostGIS column '%s', type 'topogeometry' "
+			"will not be converted", fname);
+		continue;
+	    }
 	    else {
 		/* Warn, ignore and continue */
 		G_warning(_("PostgreSQL driver: column '%s', type %d is not supported"),

+ 3 - 2
db/drivers/postgres/globals.h

@@ -18,7 +18,7 @@ typedef struct
 } PGCONN;
 
 /* PostgreSQL data types defined in GRASS
-   (see also: /usr/include/pgsql/server/catalog/pg_type.h)
+   (see also: /usr/include/postgresql/<version>/server/catalog/pg_type.h)
    PostGIS types are encoded as 17xxx.
    Types/OIDs are fetched in db.c from server.
  */
@@ -48,7 +48,8 @@ typedef enum
 
     PG_TYPE_BOOL,		/* bool, boolean */
 
-    PG_TYPE_POSTGIS_GEOM	/* geometry column of PostGIS, GRASS internal type */
+    PG_TYPE_POSTGIS_GEOM,	/* geometry column of PostGIS, GRASS internal type */
+    PG_TYPE_POSTGIS_TOPOGEOM	/* topogeometry column of PostGIS, GRASS internal type */
 } PG_TYPES;