[GRASS-SVN] r53607 - in grass/trunk/db: db.createdb db.dropdb
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Oct 29 07:59:57 PDT 2012
Author: martinl
Date: 2012-10-29 07:59:56 -0700 (Mon, 29 Oct 2012)
New Revision: 53607
Modified:
grass/trunk/db/db.createdb/db.createdb.html
grass/trunk/db/db.createdb/main.c
grass/trunk/db/db.dropdb/db.dropdb.html
grass/trunk/db/db.dropdb/main.c
Log:
db.createdb/db.dropdb: major update
now modules are functional for SQLite/PostgreSQL driver
Modified: grass/trunk/db/db.createdb/db.createdb.html
===================================================================
--- grass/trunk/db/db.createdb/db.createdb.html 2012-10-29 14:57:47 UTC (rev 53606)
+++ grass/trunk/db/db.createdb/db.createdb.html 2012-10-29 14:59:56 UTC (rev 53607)
@@ -1,38 +1,62 @@
<h2>DESCRIPTION</h2>
-<em>db.createdb</em> allows the user to create a new empty database through
-different drivers. A working database connection needs to be established.
+<em>db.createdb</em> allows the user to create a new empty database
+through different drivers. A working database connection needs to be
+established, see <em><a href="db.login.html">db.login</a></em>.
-<h2>EXAMPLE</h2>
+<p>
+Currently only <a href="grass-sqlite.html">SQLite</a>
+and <a href="grass-pg.html">PostgreSQL</a> database drivers are
+supported.
-<em>Create a new PostgreSQL database (if PostgreSQL connection is established
-through odbc driver)</em><br>
+<h2>EXAMPLES</h2>
+<h3>Create a new SQLite file-based database</h3>
+
<div class="code"><pre>
-db.createdb driver=odbc database=grass60test
+db.createdb driver=sqlite database=/opt/sqlite.db
</pre></div>
-<p>
-<em>Create a new PostgreSQL database (if PostgreSQL connection is established
-through pg driver)</em><br>
+<h3>Create a new PostgreSQL database</h3>
+
+Create a new PostgreSQL database (if PostgreSQL connection is
+established through <em>odbc</em> driver):
+
<div class="code"><pre>
-db.createdb driver=pg database='host=pgserver.itc.it,dbname=grass60test'
+db.createdb driver=odbc database=grasstest
</pre></div>
+Create a new PostgreSQL database (if PostgreSQL connection is established
+through <em>pg</em> driver):
+
+<div class="code"><pre>
+db.createdb driver=pg database=grasstest
+</pre></div>
+
+<h2>TODO</h2>
+
+Support other database drivers too.
+
<h2>SEE ALSO</h2>
<em>
+<a href="db.dropdb.html">db.dropdb</a>,
<a href="db.columns.html">db.columns</a>,
<a href="db.describe.html">db.describe</a>,
<a href="db.drivers.html">db.drivers</a>,
<a href="db.droptable.html">db.droptable</a>,
<a href="db.execute.html">db.execute</a>,
<a href="db.login.html">db.login</a>,
-<a href="db.tables.html">db.tables</a>,
-<a href="sql.html">GRASS SQL interface</a></em>
+<a href="db.tables.html">db.tables</a>
+</em>
-<h2>AUTHOR</h2>
+<p>
+<a href="sql.html">GRASS SQL interface</a>
-Radim Blazek, ITC-Irst, Trento, Italy
+<h2>AUTHORS</h2>
-<p><i>Last changed: $Date$</i>
+Radim Blazek, ITC-Irst, Trento, Italy<br>
+SQLite and PostgreSQL support by Martin Landa, Czech Technical University in Prague, Czech Republic
+
+<p>
+<i>Last changed: $Date$</i>
Modified: grass/trunk/db/db.createdb/main.c
===================================================================
--- grass/trunk/db/db.createdb/main.c 2012-10-29 14:57:47 UTC (rev 53606)
+++ grass/trunk/db/db.createdb/main.c 2012-10-29 14:59:56 UTC (rev 53607)
@@ -61,7 +61,8 @@
driver = G_define_standard_option(G_OPT_DB_DRIVER);
driver->options = db_list_drivers();
driver->required = YES;
-
+ driver->answer = (char *) db_get_default_driver_name();
+
database = G_define_standard_option(G_OPT_DB_DATABASE);
database->required = YES;
@@ -71,7 +72,7 @@
G_add_keyword(_("attribute table"));
G_add_keyword(_("SQL"));
module->description = _("Creates an empty database.");
-
+
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
Modified: grass/trunk/db/db.dropdb/db.dropdb.html
===================================================================
--- grass/trunk/db/db.dropdb/db.dropdb.html 2012-10-29 14:57:47 UTC (rev 53606)
+++ grass/trunk/db/db.dropdb/db.dropdb.html 2012-10-29 14:59:56 UTC (rev 53607)
@@ -1,23 +1,47 @@
<h2>DESCRIPTION</h2>
-<em>db.dropdb</em> removes an existing database.
+<em>db.dropdb</em> removes an existing database using given
+database <b>driver</b>. Currently
+only <a href="grass-sqlite.html">SQLite</a>
+and <a href="grass-pg.html">PostgreSQL</a> database drivers are
+supported.
-<h2>EXAMPLE</h2>
+<h2>EXAMPLES</h2>
-<em>Remove an existing database connected through odbc</em><br>
-<b>db.dropdb driver=</b><em>odbc</em> <b>database=</b><em>g51test</em>
+<h3>Drop an existing database connected through SQLite driver</h3>
+<div class="code"><pre>
+db.dropdb driver=sqlite database=/opt/sqlite.db
+</pre></div>
+
+<h3>Drop an existing database connected through PostgreSQL driver</h3>
+
+<div class="code"><pre>
+db.dropdb driver=pg database=grasstest
+</pre></div>
+
+<h2>TODO</h2>
+
+Support other database drivers too.
+
<h2>SEE ALSO</h2>
+
<em>
+<a href="db.createdb.html">db.createdb</a>,
<a href="db.describe.html">db.describe</a>,
<a href="db.droptable.html">db.droptable</a>,
<a href="db.execute.html">db.execute</a>,
<a href="db.login.html">db.login</a>,
-<a href="db.tables.html">db.tables</a>,
-<a href="sql.html">GRASS SQL interface</a></em>
+<a href="db.tables.html">db.tables</a>
+</em>
-<h2>AUTHOR</h2>
+<p>
+<a href="sql.html">GRASS SQL interface</a>
-Radim Blazek, ITC-Irst, Trento, Italy
+<h2>AUTHORS</h2>
-<p><i>Last changed: $Date$</i>
+Radim Blazek, ITC-Irst, Trento, Italy<br>
+SQLite and PostgreSQL support by Martin Landa, Czech Technical University in Prague, Czech Republic
+
+<p>
+<i>Last changed: $Date$</i>
Modified: grass/trunk/db/db.dropdb/main.c
===================================================================
--- grass/trunk/db/db.dropdb/main.c 2012-10-29 14:57:47 UTC (rev 53606)
+++ grass/trunk/db/db.dropdb/main.c 2012-10-29 14:59:56 UTC (rev 53607)
@@ -61,6 +61,7 @@
driver = G_define_standard_option(G_OPT_DB_DRIVER);
driver->options = db_list_drivers();
driver->required = YES;
+ driver->answer = (char *) db_get_default_driver_name();
database = G_define_standard_option(G_OPT_DB_DATABASE);
database->required = YES;
@@ -70,7 +71,7 @@
G_add_keyword(_("database"));
G_add_keyword(_("attribute table"));
G_add_keyword(_("SQL"));
- module->description = _("Removes a database.");
+ module->description = _("Removes an existing database.");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
More information about the grass-commit
mailing list