On 2 October 2017 at 22:48, BohwaZ/PHP <p...@bohwaz.net> wrote:
>
> If you follow your logic, then PDO::sqliteCreateFunction shouldn't exist,
> and this would make the PDO sqlite driver pretty much useless as SQLite is
> missing a number of important functions.


That's taking it to the illogical conclusion.

Taking it to a better solution is that the method sqliteCreateFunction
shouldn't exist on the PDO class, but instead on a PDOSqlite that
extends PDO.

class PDOSqlite extends PDO {
     public function createFunction(...) {...}
}

class PDO {
    public static function connect(string $dsn [, string $username [,
string $password [, array $options ]]]) {
       // if connecting to SQLite DB {
           return new PDOSqlite(...);
       }
    }
}

This might be a mistake in how it was implemented originally. Looking
back it seems that it was implemented before we had the RFC
process....and is exactly the type of 'sub-optimal' implementation the
RFC process is meant to prevent.

> This is why I am pushing for PDO to be feature-full, so that you have the
> choice to use PDO and not have to implement your own abstraction layer just
> because you need one specific feature in one single case :)
>

That's a great aim!

But rather thank just hack in new features building on sub-optimal
ways of doing things, I think it would be better to create a plan to
clean up the way that connection specific methods are available, with
something along the lines of that which I mentioned above.

cheers
Dan
Ack

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to