diff options
Diffstat (limited to 'bin/sql_db.py')
| -rw-r--r-- | bin/sql_db.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/sql_db.py b/bin/sql_db.py index 6d2d8b779ef..59d7bcaac1f 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -310,6 +310,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'): |
