فهرست منبع

v.external.out & v.out.ogr: print warning for dsn with prefix PG: when format is not PostgreSQL

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52567 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 سال پیش
والد
کامیت
08eb45d7a5
2فایلهای تغییر یافته به همراه13 افزوده شده و 1 حذف شده
  1. 6 0
      vector/v.external.out/link.c
  2. 7 1
      vector/v.out.ogr/main.c

+ 6 - 0
vector/v.external.out/link.c

@@ -20,6 +20,12 @@ void make_link(const char *dsn_opt,
     
     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

+ 7 - 1
vector/v.out.ogr/main.c

@@ -90,7 +90,13 @@ int main(int argc, char *argv[])
     
     /* 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]) {