[GRASS-SVN] r48065 - grass/trunk/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Sep 2 10:58:39 EDT 2011
Author: neteler
Date: 2011-09-02 07:58:39 -0700 (Fri, 02 Sep 2011)
New Revision: 48065
Modified:
grass/trunk/lib/python/db.py
Log:
new function db_table_exist
Modified: grass/trunk/lib/python/db.py
===================================================================
--- grass/trunk/lib/python/db.py 2011-09-02 14:24:58 UTC (rev 48064)
+++ grass/trunk/lib/python/db.py 2011-09-02 14:58:39 UTC (rev 48065)
@@ -66,6 +66,20 @@
# run "db.connect -p" and parse output
+def db_table_exist(table, **args):
+ """!Return True if database table exists, False otherwise
+
+ @param table table name
+ @param args
+
+ @return True for success, False otherwise
+ """
+ result = run_command('db.describe', flags = 'c', table = table, **args)
+ if result == 0:
+ return True
+ else:
+ return False
+
def db_connection():
"""!Return the current database connection parameters
(interface to `db.connect -p'). Example:
More information about the grass-commit
mailing list