Sfoglia il codice sorgente

libgis: introduce G_OPT_DB_SQL
use standarized option in db.select


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51940 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 13 anni fa
parent
commit
0a8dfa6a4f
3 ha cambiato i file con 13 aggiunte e 7 eliminazioni
  1. 1 7
      db/db.select/main.c
  2. 1 0
      include/gis.h
  3. 11 0
      lib/gis/parser_standard_options.c

+ 1 - 7
db/db.select/main.c

@@ -191,13 +191,7 @@ static void parse_command_line(int argc, char **argv)
     /* Initialize the GIS calls */
     G_gisinit(argv[0]);
 
-    sql = G_define_option();
-    sql->key = "sql";
-    sql->type = TYPE_STRING;
-    sql->required = NO;
-    sql->label = _("SQL select statement ('-' for standard input)");
-    sql->description =
-	_("For example: 'select * from rybniky where kapri = 'hodne'");
+    sql = G_define_standard_option(G_OPT_DB_SQL);
     sql->guisection = _("Query");
 
     input = G_define_standard_option(G_OPT_F_INPUT);

+ 1 - 0
include/gis.h

@@ -172,6 +172,7 @@ static const char *GRASS_copyright __attribute__ ((unused))
 /**/ typedef enum
 {
     G_OPT_UNDEFINED,
+    G_OPT_DB_SQL,		/* SQL statements /*
     G_OPT_DB_WHERE,		/* SQL where conditions */
     G_OPT_DB_TABLE,		/* table name */
     G_OPT_DB_DRIVER,		/* driver name */

+ 11 - 0
lib/gis/parser_standard_options.c

@@ -30,6 +30,7 @@
   be returned (not NULL).
   
   - database:
+   - G_OPT_DB_SQL
    - G_OPT_DB_WHERE
    - G_OPT_DB_TABLE
    - G_OPT_DB_DRIVER
@@ -123,6 +124,16 @@ struct Option *G_define_standard_option(int opt)
     Opt = G_define_option();
 
     switch (opt) {
+    case G_OPT_DB_SQL:
+        Opt->key = "sql";
+        Opt->type = TYPE_STRING;
+        Opt->key_desc = "sql_query";
+        Opt->required = NO;
+        Opt->label = _("SQL select statement");
+        Opt->description =
+            _("For example: 'select * from rybniky where kapri = 'hodne'\n"
+              "\t\t('-' for standard input)");
+      break;
     case G_OPT_DB_WHERE:
 	Opt->key = "where";
 	Opt->type = TYPE_STRING;