emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sql.el MariaDB support


From: Michael Mauger
Subject: Re: sql.el MariaDB support
Date: Sun, 10 Jun 2018 20:26:49 -0400

On June 7, 2018 4:48 AM, Robert Cochran <address@hidden> wrote:
> ​​
> ... 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 had to move the mariadb defvaraliases before the mysql defvar because that is 
the order expected. 

> 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.
>     

This is obviously the potential gotcha here, but if you are flipping between 
the two,
you have enough other problems that I don't think Emacs will be you biggest. :)

> 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?
> 

That's a hold-over from the original and I'm not sure it has any impact today. 
Let
me know if you have any problems...

> 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.
> 

Keeping it loose is okay, anchoring it to the start of the line thru the "> " 
text is
really all that's needed.

> Well, here goes. Hopefully this won't need tons of rework cycles.
> 

I had to rearrange the declarations a bit and correct a couple of 
spelling/cut-n-paste 
issues, but it looks fine. I went ahead and committed the code and gave you 
credit.

> > 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 avery casual user, so I'd
> honestly have no idea where to even start with that. Sorry. :(
> 

I took care of this. Basically the font-lock variables have long lists of 
keywords, 
functions, and data types that are converted at build time to a massive regexp.
I updated the lists from the MySQL and MariaDB documentation. Let me know if 
you find any of the highlighting to be distracting or seeming incorrect. 
Without a 
serious increase in complexity of the matching, there will always be some odd 
cases.

> 
> ~Robert Cochran

Thank you very much, I greatly appreciate your contribution.

Happy Hacking!
​-- 
address@hidden // FSF and EFF member // GNU Emacs sql.el maintainer​



reply via email to

[Prev in Thread] Current Thread [Next in Thread]