Michael Mauger writes: > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > On June 6, 2018 10:53 AM, Eli Zaretskii wrote: >> ​​ >> > From: Robert Cochran robert-emacs@cochranmail.com >> > Date: Tue, 05 Jun 2018 20:07:50 -0700 >> > >> > I've decided that I want to spend a little bit of time improving the >> > MariaDB support in sql.el to make a nicer experience, namely changing >> > the prompt regexps so that the prompts will actually show up without >> > having to fiddle with sql-prompt-regexp. >> > What I'm not so sure about, and thus asking here, is whether or not to >> > put the MariaDB changes in with the MySQL product? MariaDB is still a >> > drop-in replacement for MySQL AFAIK, so in my mind it wouldn't be >> > unreasonable to lump those two together as a single product. But I'm not >> > well-versed on what doing that may imply. >> > TBH, I'd rather lump them together, as really all I'm intending to do is >> > modify the continuation prompt regexps to work for either database, and >> > making a whole separate MariaDB product would be overkill in my mind. >> > >> > Thoughts? >> >> I hope Micheal (CC'ed) will have comments on your proposal. > > Great idea! My recommendation is to create a new sql product/dialect akin > to mysql in sql.el and either reuse the mysql settings/variables where > appropriate, or create defvaralias's for the mariadb variables pointing back > to the mysql variables. > > That is, reuse the font-locking and login setup, but override the prompt string. Alright, I went that route. I made a copy of the MySQL entry and modified it to fit MariaDB. I then made most all of the MariaDB variables defvaralias-es of the MySQL ones. `sql-comint-mariadb' just calls into `sql-comint-mysql'. MariaDB is almost no different than MySQL except for the prompt. > I'd also encourage you to update the shared font-lock settings to get it > up-to-date with the latest features. It's been a very long time since I used > MySQL so there is some bit-rot there. I'm probably not your guy on this one. I'm a *very* casual user, so I'd honestly have no idea where to even start with that. Sorry. :( So my first attempt is attached below. Doubtless I've done at least a handful of things wrong, but I can just fix them as we go. A couple of things I've been thinking about that might be wrong/need changing: 1) Should we try to support a configuration where the MariaDB and MySQL configuration options differ (aka making MariaDB variables not mere aliases for the MySQL ones)? Simple-minded me thinks not, that there wouldn't really be a point in doing that since MariaDB is supposed to be able to drop-in replace MySQL. But I'm asking anyways. 2) Will it be problematic that the MariaDB entry doesn't have a :prompt-length? The MariaDB prompt contains the current database, so there's no real knowing ahead of time how long the prompt will be. Looking at how it's used, it appears that query text on continuation lines will be messed up. Maybe it would be close enough to have :prompt-length be (length "MariaDB []> ") - everything except the database name? 3) To that end, is it okay that my regexp for matching the database name is pretty loose? I figured on the first pass that being a little generous with the match criterion is acceptable, but I wouldn't be surprised if that wasn't good enough for a final solution. Well, here goes. Hopefully this won't need tons of rework cycles. HTH, -- ~Robert Cochran GPG Fingerprint - BD0C 5F8B 381C 64F0 F3CE E7B9 EC9A 872C 41B2 77C2