[GRASS-SVN] r67408 - grass/branches/releasebranch_7_0/lib/python/script
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Dec 29 01:18:32 PST 2015
Author: martinl
Date: 2015-12-29 01:18:32 -0800 (Tue, 29 Dec 2015)
New Revision: 67408
Modified:
grass/branches/releasebranch_7_0/lib/python/script/db.py
Log:
pythonlib: implement db_begin/commit_transaction (see #2759)
(merge r67370 from trunk)
Modified: grass/branches/releasebranch_7_0/lib/python/script/db.py
===================================================================
--- grass/branches/releasebranch_7_0/lib/python/script/db.py 2015-12-29 09:15:27 UTC (rev 67407)
+++ grass/branches/releasebranch_7_0/lib/python/script/db.py 2015-12-29 09:18:32 UTC (rev 67408)
@@ -10,7 +10,7 @@
grass.db_describe(table)
...
-(C) 2008-2009, 2012 by the GRASS Development Team
+(C) 2008-2015 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
@@ -196,3 +196,23 @@
return used
else:
return None
+
+def db_begin_transaction(driver):
+ """Begin transaction.
+
+ :return: SQL command as string
+ """
+ if driver in ('sqlite', 'pg'):
+ return 'BEGIN'
+ if driver == 'mysql':
+ return 'START TRANSACTION'
+ return ''
+
+def db_commit_transaction(driver):
+ """Commit transaction.
+
+ :return: SQL command as string
+ """
+ if driver in ('sqlite', 'pg', 'mysql'):
+ return 'COMMIT'
+ return ''
More information about the grass-commit
mailing list