Return True if the given connection is on the version given or greater. This only checks the server version string provided when the connection is established, therefore any check for a version tuple greater than (5, 5, 5) will always fail on MariaDB, as it always
(self, conn, version_tuple)
| 28 | ] |
| 29 | |
| 30 | def mysql_server_is(self, conn, version_tuple): |
| 31 | """Return True if the given connection is on the version given or |
| 32 | greater. |
| 33 | |
| 34 | This only checks the server version string provided when the |
| 35 | connection is established, therefore any check for a version tuple |
| 36 | greater than (5, 5, 5) will always fail on MariaDB, as it always |
| 37 | starts with 5.5.5, e.g. 5.5.5-10.7.1-MariaDB-1:10.7.1+maria~focal. |
| 38 | |
| 39 | e.g.:: |
| 40 | |
| 41 | if self.mysql_server_is(conn, (5, 6, 4)): |
| 42 | # do something for MySQL 5.6.4 and above |
| 43 | """ |
| 44 | server_version = conn.get_server_info() |
| 45 | server_version_tuple = tuple( |
| 46 | (int(dig) if dig is not None else 0) |
| 47 | for dig in re.match(r"(\d+)\.(\d+)\.(\d+)", server_version).group(1, 2, 3) |
| 48 | ) |
| 49 | return server_version_tuple >= version_tuple |
| 50 | |
| 51 | def get_mysql_vendor(self, conn): |
| 52 | server_version = conn.get_server_info() |