• R/O
  • SSH

execsql: Commit

Default repository for execsql.py


Commit MetaInfo

Révisiond59d88d7dd1f831f9cd59da1336c33c10460d151 (tree)
l'heure2016-08-09 05:15:59
AuteurDreas Nielsen <dnielsen@inte...>
CommiterDreas Nielsen

Message de Log

Added logging of database close with AUTOCOMMIT OFF, and added NOT the the SQL_ERROR() conditional.

Change Summary

Modification

diff -r bb4a3e9faf82 -r d59d88d7dd1f execsql/execsql.py
--- a/execsql/execsql.py Fri Aug 05 07:00:06 2016 -0700
+++ b/execsql/execsql.py Mon Aug 08 13:15:59 2016 -0700
@@ -27,8 +27,8 @@
2727 #
2828 # ===============================================================================
2929
30-__version__ = "1.7.3.0"
31-__vdate = "2016-08-05"
30+__version__ = "1.7.5.0"
31+__vdate = "2016-08-08"
3232
3333 import os
3434 import os.path
@@ -1859,6 +1859,8 @@
18591859 return self.conn.cursor()
18601860 def close(self):
18611861 if self.conn:
1862+ if not self.autocommit:
1863+ exec_log.log_status_info(u"Closing %s when AUTOCOMMIT is OFF; transactions may not have completed." % self.name())
18621864 self.conn.close()
18631865 self.conn = None
18641866 def execute(self, sql):
@@ -2954,7 +2956,7 @@
29542956 self.pool = {}
29552957 self.initial_db = None
29562958 self.current_db = None
2957- self.do_rollback = False
2959+ self.do_rollback = True
29582960 def __repr__(self):
29592961 return u"DatabasePool()"
29602962 def add(self, db_alias, db_obj):
@@ -6352,9 +6354,12 @@
63526354 conditionals.append(MetaCommand(r'^\s*(?P<invert>NOT\s+)?HASROWS\((?P<queryname>.+)\)\s*$', xf_hasrows))
63536355
63546356 def xf_sqlerror(**kwargs):
6357+ invert = kwargs["invert"]
6358+ if invert:
6359+ return not status.sql_error
63556360 return status.sql_error
63566361
6357-conditionals.append(MetaCommand(r'^sql_error\(\s*\)\s*$', xf_sqlerror))
6362+conditionals.append(MetaCommand(r'^\s*(?P<invert>NOT\s+)?sql_error\(\s*\)\s*$', xf_sqlerror))
63586363
63596364 def xf_fileexists(**kwargs):
63606365 filename = kwargs["filename"]
Afficher sur ancien navigateur de dépôt.