[GRASS-SVN] r52567 - in grass/trunk/vector: v.external.out v.out.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 6 11:51:29 PDT 2012


Author: martinl
Date: 2012-08-06 11:51:29 -0700 (Mon, 06 Aug 2012)
New Revision: 52567

Modified:
   grass/trunk/vector/v.external.out/link.c
   grass/trunk/vector/v.out.ogr/main.c
Log:
v.external.out & v.out.ogr: print warning for dsn with prefix PG: when format is not PostgreSQL


Modified: grass/trunk/vector/v.external.out/link.c
===================================================================
--- grass/trunk/vector/v.external.out/link.c	2012-08-06 16:52:11 UTC (rev 52566)
+++ grass/trunk/vector/v.external.out/link.c	2012-08-06 18:51:29 UTC (rev 52567)
@@ -20,6 +20,12 @@
     
     key_val = G_create_key_value();
 
+    /* check for weird options */
+    if (G_strncasecmp(dsn_opt, "PG:", 3) == 0 &&
+        strcmp(format, "PostgreSQL") != 0)
+        G_warning(_("Data source starts with \"PG:\" prefix, expecting \"PostgreSQL\" "
+                    "format (\"%s\" given)"), format);
+    
     /* use OGR ? */
     if (strcmp(format, "PostgreSQL") == 0) {
 #if defined HAVE_OGR && defined HAVE_POSTGRES

Modified: grass/trunk/vector/v.out.ogr/main.c
===================================================================
--- grass/trunk/vector/v.out.ogr/main.c	2012-08-06 16:52:11 UTC (rev 52566)
+++ grass/trunk/vector/v.out.ogr/main.c	2012-08-06 18:51:29 UTC (rev 52567)
@@ -90,7 +90,13 @@
     
     /* parse & read options */
     parse_args(argc, argv, &options, &flags);
-
+    
+    /* check for weird options */
+    if (G_strncasecmp(options.dsn->answer, "PG:", 3) == 0 &&
+        strcmp(options.format->answer, "PostgreSQL") != 0)
+        G_warning(_("Data source starts with \"PG:\" prefix, expecting \"PostgreSQL\" "
+                    "format (\"%s\" given)"), options.format->answer);
+    
     /* parse dataset creation options */
     i = 0;
     while (options.dsco->answers[i]) {



More information about the grass-commit mailing list