diff options
Diffstat (limited to 'bin/sql_db.py')
| -rw-r--r-- | bin/sql_db.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/sql_db.py b/bin/sql_db.py index 93b031e0673..a84547b0b7c 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -170,6 +170,7 @@ class Cursor(object): sqllogs[type].clear() sum = timedelta(microseconds=sum) log("SUM %s:%s/%d [%d]" % (type, str(sum), self.sql_log_count, sql_counter)) + sqllogs[type].clear() process('from') process('into') self.sql_log_count = 0 @@ -315,6 +316,15 @@ class Connection(object): def serialized_cursor(self): return self.cursor(True) + def __nonzero__(self): + """Check if connection is possible""" + try: + cr = self.cursor() + cr.close() + return True + except: + return False + _dsn = '' for p in ('host', 'port', 'user', 'password'): |
