Default repository for execsql.py
Révision | d59d88d7dd1f831f9cd59da1336c33c10460d151 (tree) |
---|---|
l'heure | 2016-08-09 05:15:59 |
Auteur | Dreas Nielsen <dnielsen@inte...> |
Commiter | Dreas Nielsen |
Added logging of database close with AUTOCOMMIT OFF, and added NOT the the SQL_ERROR() conditional.
@@ -27,8 +27,8 @@ | ||
27 | 27 | # |
28 | 28 | # =============================================================================== |
29 | 29 | |
30 | -__version__ = "1.7.3.0" | |
31 | -__vdate = "2016-08-05" | |
30 | +__version__ = "1.7.5.0" | |
31 | +__vdate = "2016-08-08" | |
32 | 32 | |
33 | 33 | import os |
34 | 34 | import os.path |
@@ -1859,6 +1859,8 @@ | ||
1859 | 1859 | return self.conn.cursor() |
1860 | 1860 | def close(self): |
1861 | 1861 | 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()) | |
1862 | 1864 | self.conn.close() |
1863 | 1865 | self.conn = None |
1864 | 1866 | def execute(self, sql): |
@@ -2954,7 +2956,7 @@ | ||
2954 | 2956 | self.pool = {} |
2955 | 2957 | self.initial_db = None |
2956 | 2958 | self.current_db = None |
2957 | - self.do_rollback = False | |
2959 | + self.do_rollback = True | |
2958 | 2960 | def __repr__(self): |
2959 | 2961 | return u"DatabasePool()" |
2960 | 2962 | def add(self, db_alias, db_obj): |
@@ -6352,9 +6354,12 @@ | ||
6352 | 6354 | conditionals.append(MetaCommand(r'^\s*(?P<invert>NOT\s+)?HASROWS\((?P<queryname>.+)\)\s*$', xf_hasrows)) |
6353 | 6355 | |
6354 | 6356 | def xf_sqlerror(**kwargs): |
6357 | + invert = kwargs["invert"] | |
6358 | + if invert: | |
6359 | + return not status.sql_error | |
6355 | 6360 | return status.sql_error |
6356 | 6361 | |
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)) | |
6358 | 6363 | |
6359 | 6364 | def xf_fileexists(**kwargs): |
6360 | 6365 | filename = kwargs["filename"] |