In creating some DDL-generating code for MySQL / MariaDB (inside WordPress as it happens) I need to find out whether the RDBMS server I'm talking to can support the newer Barracuda / DYNAMIC / InnoDB storage format. (That format allows indexing longer VARCHAR columns, whereas the older Antelope format requires prefix indexes for columns containing more than 768 bytes, 191 utfmb4 characters.)
Most users of this code aren't experts, and the majority of WordPress sites still use MySQL 5.5 or 5.6. (Because budget hosting vendors.)
Is there a good-practice way to query the RDBMS (via SQL) to determine whether Barracuda is available?
Now I have a nasty if-else cascade to figure this out, here written in pseudocode.
if mysql and version >= 8 then yes
else if mariadb and version >= 10.3 then yes
else if mariadb and version >= 10 and 'innodb_large_prefix' is ON or 1 then yes
else if version <= 5.5.62 then no
else if version <= 5.6.4 then no
else yes
Is there a better / cleaner / more reliable way to figure this out? Is there a standard -- best-practice -- way?
Notice that the very useful 'innodb_large_prefix' setting came and went; it's not in the latest versions.