mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-02 23:45:08 -04:00
DBD::mysql 5 refuses to connect to a MariaDB server and upstream does not consider that a bug, so a MariaDB system needs DBD::MariaDB. Prefer it when present; it drives both servers. ZM_DB_TYPE cannot select it, which is why setting it to MariaDB does not work: the same value builds the PHP PDO dsn, where the only valid driver is mysql whichever server is in use. Swapping the dsn scheme is not enough on its own. DBD::MariaDB spells DBD::mysql's mysql_* parameters mariadb_* and ignores parameters it does not recognise, so a dsn built with the wrong prefix does not fail: it drops the socket path and the TLS settings and connects over plain TCP. Build the dsn in one place from the chosen driver, renaming caller supplied options too, since zmupdate.pl asks for mysql_multi_statements. Read the id of an inserted row through DBI's last_insert_id rather than the mysql_insertid handle attribute, which DBD::MariaDB does not have and would answer undef for, leaving events and objects with no Id. DBD::MariaDB is always utf8mb4, so it takes no mysql_enable_utf8mb4 attribute. Let cmake accept either driver instead of requiring DBD::mysql, checking in the same order, and warn when neither is installed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019URmtYqza6Rzi6F7cmabSm