laravel-test-factory-helper icon indicating copy to clipboard operation
laravel-test-factory-helper copied to clipboard

[Proposal Solution] Exception: SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute Could not analyze class Modules\Pdm\Models\PickingList\PickingListItem

Open ijpatricio opened this issue 6 years ago • 0 comments

Hello @mpociot

Hope to find you well!

So, with DBAL, for SQL server, is needed to set some option. Already solver this before. For such connections, to work out of the box, something similar to this will work.

protected function setNeededPdoSettings()
    {
        $connectionsSqlServer = [
            'x3db_v11',
            'roots_sql_server',
            'imos',
        ];

        collect($connectionsSqlServer)
            ->each(function ($item, $key) {
                config()->set("database.connections.{$item}.options",[
                    \PDO::ATTR_PERSISTENT => true
                ]);
            });

    }

It puts that option on the fly, for the current execution. I could rewrite above snipper to apply such setting to every SQL Server connection, and make a PR. What do you think?

ijpatricio avatar Dec 11 '18 09:12 ijpatricio