Browse Source

new function db_table_exist

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48065 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 13 years ago
parent
commit
c09ff8a280
1 changed files with 14 additions and 0 deletions
  1. 14 0
      lib/python/db.py

+ 14 - 0
lib/python/db.py

@@ -66,6 +66,20 @@ def db_describe(table, **args):
 
 # 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: