summaryrefslogtreecommitdiffstats
path: root/mycli/sqlexecute.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-07 09:38:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-09-07 09:39:08 +0000
commitf0ae12072ba1868526f2ae57615538777d9538f4 (patch)
treef639c1078fc22f434d074470d7b50f58f0ac6e4e /mycli/sqlexecute.py
parentReleasing debian version 1.25.0-1. (diff)
downloadmycli-f0ae12072ba1868526f2ae57615538777d9538f4.tar.xz
mycli-f0ae12072ba1868526f2ae57615538777d9538f4.zip
Merging upstream version 1.26.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mycli/sqlexecute.py')
-rw-r--r--mycli/sqlexecute.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/mycli/sqlexecute.py b/mycli/sqlexecute.py
index 9461438..c019707 100644
--- a/mycli/sqlexecute.py
+++ b/mycli/sqlexecute.py
@@ -28,6 +28,7 @@ class ServerSpecies(enum.Enum):
MySQL = 'MySQL'
MariaDB = 'MariaDB'
Percona = 'Percona'
+ TiDB = 'TiDB'
Unknown = 'MySQL'
@@ -55,6 +56,7 @@ class ServerInfo:
re_species = (
(r'(?P<version>[0-9\.]+)-MariaDB', ServerSpecies.MariaDB),
+ (r'(?P<version>[0-9\.]+)[a-z0-9]*-TiDB', ServerSpecies.TiDB),
(r'(?P<version>[0-9\.]+)[a-z0-9]*-(?P<comment>[0-9]+$)',
ServerSpecies.Percona),
(r'(?P<version>[0-9\.]+)[a-z0-9]*-(?P<comment>[A-Za-z0-9_]+)',
@@ -338,10 +340,16 @@ class SQLExecute(object):
def reset_connection_id(self):
# Remember current connection id
_logger.debug('Get current connection id')
- res = self.run('select connection_id()')
- for title, cur, headers, status in res:
- self.connection_id = cur.fetchone()[0]
- _logger.debug('Current connection id: %s', self.connection_id)
+ try:
+ res = self.run('select connection_id()')
+ for title, cur, headers, status in res:
+ self.connection_id = cur.fetchone()[0]
+ except Exception as e:
+ # See #1054
+ self.connection_id = -1
+ _logger.error('Failed to get connection id: %s', e)
+ else:
+ _logger.debug('Current connection id: %s', self.connection_id)
def change_db(self, db):
self.conn.select_db(db)