Re: [PHP-DEV] Re: Proposal to Create a MariaDB Alias for the MySQL PDO Driver

2024-04-30 Thread Kamil Tekiela
I see absolutely no reason to do this. There is no difference between
MySQL and MariaDB in terms of PDO. Sure, the actual RDBMSs have
differences, but they play no role when it comes to PDO.
If MariaDB decides to change the protocol some day then we would need
a new driver to replace mysqlnd. Only then it would make sense to have
PDO_mariadb extension. But that is unlikely to happen any time soon.
The purpose of PDO subclasses is to offer driver specific
functionality and differentiate SQL syntax flavours. MariaDB and MySQL
use the same driver so they offer the same functionality and they use
the same SQL syntax (at least the parts that matter). And we must
remember that MariaDB is not the only MySQL-like DB out there. We are
not going to create a name alias for every possible fork of MySQL that
ever exists. It would be pointless.


[PHP-DEV] Re: Proposal to Create a MariaDB Alias for the MySQL PDO Driver

2024-04-30 Thread Arvids Godjuks
On Tue, 30 Apr 2024 at 21:32, Matteo Beccati  wrote:

> Hi Arvids,
>
> 
>
> It's not clear to me what divergences need to be addressed at the PDO
> level at this point. Could you please shed some light?
>
> Is it just identification? If so, I think the best place to do it is
> some user-land configuration.
>

I'm no expert in the matter, but here's some stuff I found:
https://aws.amazon.com/compare/the-difference-between-mariadb-vs-mysql/#summary-of-differences-mysql-mariadb
https://www.cloudways.com/blog/mariadb-vs-mysql/#mariadb-vs-mysql

One thing that comes to mind that I run into is that both have a different
set of functions they support to work with JSON objects and they store them
differently.
As time goes on, there are more and more database specific differences.
Again, this is about giving people ability to develop stuff based on PDO
driver subclass, clearly delineating what is supported for what database.
You will not have to look at the code and try to figure out if this works
in MySQL or MariaDB or both - you will be able to see that it uses either
MySQL driver or MariaDB driver.
As far as PDO development goes, it's more of an organisational change.
Larry has given a pretty clear explanation why it's good to have this.
-- 

Arvīds Godjuks
+371 26 851 664
arvids.godj...@gmail.com
Telegram: @psihius https://t.me/psihius


[PHP-DEV] Re: Proposal to Create a MariaDB Alias for the MySQL PDO Driver

2024-04-30 Thread Matteo Beccati

Hi Arvids,

Il 30/04/2024 18:50, Arvids Godjuks ha scritto:

Hello,

I'm splitting this discussion from https://externals.io/message/123183 
, see details at 
https://externals.io/message/123183#123234 
 and 
https://externals.io/message/123183#123236 
 to keep the original thread 
clean.


There's a clear divergence in functionality between MySQL and MariaDB. 
As PDO evolves to accommodate database-specific drivers, it's sensible 
to introduce a MariaDB alias for the MySQL driver. Although the mysqlnd 
library handles networking protocols for both, practical higher level 
usage increasingly demands differentiation at the database layer, much 
like Doctrine's recent updates requiring distinct identification of 
MariaDB vs. MySQL.


I propose establishing a MariaDB namespace. This would allow for 
explicit implementation of database-specific functions and help in 
correctly mapping methods and queries to the respective database.


Thoughts? Questions?


It's not clear to me what divergences need to be addressed at the PDO 
level at this point. Could you please shed some light?


Is it just identification? If so, I think the best place to do it is 
some user-land configuration.



Cheers
--
Matteo Beccati

Development & Consulting - http://www.beccati.com/


Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type

2024-04-30 Thread Arvids Godjuks
On Tue, 30 Apr 2024 at 09:19, Rowan Tommins [IMSoP] 
wrote:

>
>
> On 28 April 2024 07:47:40 GMT-07:00, Robert Landers <
> landers.rob...@gmail.com> wrote:
>
> >I'm not so sure this could be implemented as an extension, there just
> >isn't the right hooks for it.
>
> The whole point of my email was that "this" is not one single feature, but
> a whole series of them. Some of them can be implemented as an extension
> right now; some could be implemented as an extension by adding more hooks
> which would also be useful for other extensions; some would need changes to
> the core of the language.
>
> If the aim is "everything you could possibly want in a decimal type", it
> certainly can't be an extension; if the aim is "better support for
> decimals", then it possibly can.
>
> Regards,
> Rowan Tommins
> [IMSoP]
>

I think setting some expectations in the proper context is warranted here.

1. Would a native decimal type be good for the language? I would say we
probably are not going to find many if any people who would be against it.
2. Is there a need for it? Well, the whole world of e-commerce, accounting
and all kinds of business systems that deal with money in PHP world do not
leave any room for doubt - https://packagist.org/?query=money . The use
case is right there :)
3. In most cases people need decimal precision math in the bounds of what
the decimal128 standard provides. Most of us just do not want the float
drift and while a signed 64-bit integer is big, it has it's limitations and
a need for edge layer transformations be it presentation, API endpoints or
storing it in the database or other storage mediums.
4. Is it a lot of engine work? Yes, yes it is. Is it worth it? I think yes,
especially if we get buying from most of the active maintainers and get a
project going for it. This is not going to be the first or last big engine
project. But this might warrant a PHP 9 release in the end :)
5. But BCMath/GMP/etc!!! Well, extensions are optional. They are also not
as fast and they deal with strings. They are not as fast and you will have
to rely on that extension's methods that most math functions are
implemented and all that stuff. Frankly, I never had a use case where
BCMath was not an overkill. And doing number crunching with BCMath is just
slow due to them being strings internally. The use cases are just
different. They solve a different problem than a decimal128 does for the
language.

I think all the discussions on the subject have shown that BCMath RFC is
it's own thing and adding a decimal type to the PHP language/engine is it's
own thing. They are not mutually exclusive and solve different problems.

-- 

Arvīds Godjuks
+371 26 851 664
arvids.godj...@gmail.com
Telegram: @psihius https://t.me/psihius


Re: [PHP-DEV] Proposal to Create a MariaDB Alias for the MySQL PDO Driver

2024-04-30 Thread Larry Garfield
On Tue, Apr 30, 2024, at 4:50 PM, Arvids Godjuks wrote:
> Hello,
>
> I'm splitting this discussion from https://externals.io/message/123183, 
> see details at https://externals.io/message/123183#123234 and 
> https://externals.io/message/123183#123236 to keep the original thread 
> clean.
>
> There's a clear divergence in functionality between MySQL and MariaDB. 
> As PDO evolves to accommodate database-specific drivers, it's sensible 
> to introduce a MariaDB alias for the MySQL driver. Although the mysqlnd 
> library handles networking protocols for both, practical higher level 
> usage increasingly demands differentiation at the database layer, much 
> like Doctrine's recent updates requiring distinct identification of 
> MariaDB vs. MySQL.
>
> I propose establishing a MariaDB namespace. This would allow for 
> explicit implementation of database-specific functions and help in 
> correctly mapping methods and queries to the respective database.
>
> Thoughts? Questions?

I agree with this.  Even if the wire protocol isn't different right now, the 
SQL syntax is.  Giving a "native" hook point for people to vary their DB is 
useful, and sets us up for when there are wire or parser differences later.

Bear in mind that MySQL now also has the mysqlx protocol, which is basically a 
native query builder that bypasses an SQL string entirely.  MariaDB has no such 
thing.  I don't know how that would play into PDO at all, but this sort of 
split would give us a natural starting point to figure that out in the future.

--Larry Garfield


[PHP-DEV] Proposal to Create a MariaDB Alias for the MySQL PDO Driver

2024-04-30 Thread Arvids Godjuks
Hello,

I'm splitting this discussion from https://externals.io/message/123183, see
details at https://externals.io/message/123183#123234 and
https://externals.io/message/123183#123236 to keep the original thread
clean.

There's a clear divergence in functionality between MySQL and MariaDB. As
PDO evolves to accommodate database-specific drivers, it's sensible to
introduce a MariaDB alias for the MySQL driver. Although the mysqlnd
library handles networking protocols for both, practical higher level usage
increasingly demands differentiation at the database layer, much like
Doctrine's recent updates requiring distinct identification of MariaDB vs.
MySQL.

I propose establishing a MariaDB namespace. This would allow for explicit
implementation of database-specific functions and help in correctly mapping
methods and queries to the respective database.

Thoughts? Questions?

-- 

Arvīds Godjuks
+371 26 851 664
arvids.godj...@gmail.com
Telegram: @psihius https://t.me/psihius


RE: External Message: Re: [PHP-DEV] PDO subclass names

2024-04-30 Thread Jeffrey Dafoe
> > This would allow people to use MariaDB and MySQL-specific functionality by
> using the respective driver namespace and remove any confusion about if this
> works with both or only one of them.
> >
> > I know it seems to be out of scope, but this deals with PDO subclass names
> and this seems to be a thing to consider here. Sure, we can have a separate
> RFC about it, but I think this is the right moment to handle this question.
> >
> 
> Has the network protocol diverged much? I know storage engines, query
> language, etc. might change, but the underlying protocol might be similar.

Saw this on a Jira ticket for MaxScale: "The MariaDB and MySQL protocols are 
mostly identical and the differences are of opt-in character." 


Re: [PHP-DEV] PDO subclass names

2024-04-30 Thread Calvin Buckley
On Apr 30, 2024, at 8:07 AM, Arvids Godjuks  wrote:
> On Tue, 30 Apr 2024 at 12:07, Matteo Beccati  wrote:
> Hi,
> 
> 
> > If MariaDB wants to maintain a specific PDO Driver they can do so 
> > themselves and publish it on PECL, same as how CUBRID (and others) does 
> > currently.
> 
> That is true, however it's mysqlnd the part that deals with the network 
> protocol, which they wouldn't be able to modify from PECL. That said, 
> I'm not an expert on mysql/maria, but I also doubt the changes are 
> significant enough that they need a separate driver.
> 
>  I wasn't proposing rolling a separate driver or anything like that, just an 
> alias that would reserve a namespace for MariaDB and if there's ever a need 
> to actually roll the driver, that alias be replaced with actual driver.
> The thing is at this point MySQL and MariaDB have a different set of 
> additional capabilities that are not compatible between the two. Doctrine, at 
> this point, actually makes a distinction between MariaDB and MySQL - those 
> are considered different databases.
> This would allow people to use MariaDB and MySQL-specific functionality by 
> using the respective driver namespace and remove any confusion about if this 
> works with both or only one of them.
> 
> I know it seems to be out of scope, but this deals with PDO subclass names 
> and this seems to be a thing to consider here. Sure, we can have a separate 
> RFC about it, but I think this is the right moment to handle this question.
> 

Has the network protocol diverged much? I know storage engines, query language, 
etc. might change, but the underlying protocol might be similar.

Re: [PHP-DEV] PDO subclass names

2024-04-30 Thread Saki Takamachi
Hi Arvīds,

>  I wasn't proposing rolling a separate driver or anything like that, just an 
> alias that would reserve a namespace for MariaDB and if there's ever a need 
> to actually roll the driver, that alias be replaced with actual driver.
> The thing is at this point MySQL and MariaDB have a different set of 
> additional capabilities that are not compatible between the two. Doctrine, at 
> this point, actually makes a distinction between MariaDB and MySQL - those 
> are considered different databases.
> This would allow people to use MariaDB and MySQL-specific functionality by 
> using the respective driver namespace and remove any confusion about if this 
> works with both or only one of them.
> 
> I know it seems to be out of scope, but this deals with PDO subclass names 
> and this seems to be a thing to consider here. Sure, we can have a separate 
> RFC about it, but I think this is the right moment to handle this question.

It's a very interesting subject, but off-topic for this thread. The purpose of 
this thread is to make a correction based on the Namespace RFC, since the RFC 
regarding namespaces and the RFC regarding PDO subclasses are in conflict with 
each other.

That is, the PDO subclass RFC was passed in violation of the namespace RFC, and 
we are proposing the appropriate fix for it.
(However, this is a very grey area. The Namespaces RFC "recommends" the use of 
namespaces, rather than mandating it.)

Personally, I believe this fix does not require a new RFC.

Regards,

Saki

Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-30 Thread Saki Takamachi
Hi Alex,

> Just one small note from me, for mod operation, related to scale there is a 
> mention of "Use the scale of the dividend as is".
> In reality, I think it should be the same as add and sub, "The larger scale 
> of the two values is applied".
> In this way, something like this can work by default: https://3v4l.org/NismE

Thanks for the good pointers! This was an oversight on my part. I will update 
the RFC.

Regards,

Saki

Re: [PHP-DEV] PDO subclass names

2024-04-30 Thread Arvids Godjuks
On Tue, 30 Apr 2024 at 12:07, Matteo Beccati  wrote:

> Hi,
>
>
> > If MariaDB wants to maintain a specific PDO Driver they can do so
> > themselves and publish it on PECL, same as how CUBRID (and others) does
> > currently.
>
> That is true, however it's mysqlnd the part that deals with the network
> protocol, which they wouldn't be able to modify from PECL. That said,
> I'm not an expert on mysql/maria, but I also doubt the changes are
> significant enough that they need a separate driver.
>

 I wasn't proposing rolling a separate driver or anything like that, just
an alias that would reserve a namespace for MariaDB and if there's ever a
need to actually roll the driver, that alias be replaced with actual driver.
The thing is at this point MySQL and MariaDB have a different set of
additional capabilities that are not compatible between the two. Doctrine,
at this point, actually makes a distinction between MariaDB and MySQL -
those are considered different databases.
This would allow people to use MariaDB and MySQL-specific functionality by
using the respective driver namespace and remove any confusion about if
this works with both or only one of them.

I know it seems to be out of scope, but this deals with PDO subclass names
and this seems to be a thing to consider here. Sure, we can have a separate
RFC about it, but I think this is the right moment to handle this question.



-- 

Arvīds Godjuks
+371 26 851 664
arvids.godj...@gmail.com
Telegram: @psihius https://t.me/psihius


Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-30 Thread Alexandru Pătrănescu
On Tue, Apr 30, 2024 at 7:31 AM Saki Takamachi  wrote:

> Hi,
>
> If there is no further discussion, I will start voting tomorrow. (I
> haven't decided on the time yet.)
> https://wiki.php.net/rfc/support_object_type_in_bcmath
>
>
>
Just one small note from me, for mod operation, related to scale there is a
mention of "Use the scale of the dividend as is".
In reality, I think it should be the same as add and sub, "The larger scale
of the two values is applied".
In this way, something like this can work by default: https://3v4l.org/NismE

Regards,
Alex


Re: [PHP-DEV] PDO subclass names

2024-04-30 Thread Matteo Beccati

Hi,

Il 29/04/2024 15:10, Gina P. Banyard ha scritto:


On Tuesday, 23 April 2024 at 15:59, Arvids Godjuks 
 wrote:
A thought crossed my mind, considering that MariaDB and MySQL are 
drifting more and more apart with features and nuances of how they 
work, would it be a good idea to create an alias to MySQL PDO driver 
under MariaDB name so we can create a MariaDB specific implementation 
down the road and so people can use DB specific features right away 
and not be confused why there are errors between those 2 if someone 
swaps one for the other.


IMHO, this is out of scope for this proposal.


Yes, indeed.


If MariaDB wants to maintain a specific PDO Driver they can do so 
themselves and publish it on PECL, same as how CUBRID (and others) does 
currently.


That is true, however it's mysqlnd the part that deals with the network 
protocol, which they wouldn't be able to modify from PECL. That said, 
I'm not an expert on mysql/maria, but I also doubt the changes are 
significant enough that they need a separate driver.



Cheers
--
Matteo Beccati

Development & Consulting - http://www.beccati.com/


Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type

2024-04-30 Thread Rowan Tommins [IMSoP]



On 28 April 2024 07:47:40 GMT-07:00, Robert Landers  
wrote:

>I'm not so sure this could be implemented as an extension, there just
>isn't the right hooks for it.

The whole point of my email was that "this" is not one single feature, but a 
whole series of them. Some of them can be implemented as an extension right 
now; some could be implemented as an extension by adding more hooks which would 
also be useful for other extensions; some would need changes to the core of the 
language.

If the aim is "everything you could possibly want in a decimal type", it 
certainly can't be an extension; if the aim is "better support for decimals", 
then it possibly can.

Regards,
Rowan Tommins
[IMSoP]