mediamonks / symfony-mssql-bundle Goto Github PK
View Code? Open in Web Editor NEWGreatly improves mssql support for Symfony on Unix using pdo_dblib
License: MIT License
Greatly improves mssql support for Symfony on Unix using pdo_dblib
License: MIT License
Running this in the Dockerphp:7.4-apache
image with dblib configured.
PHP: 7.4.12
Symfony: 5.2.3
MSSQL: 12.00.6118
After running the command bin/console dbal:run-sql "SELECT TOP 1 * FROM table
I get this response:
In PDOConnection.php line 53:
[AssertionError (1)]
assert($result !== false)
Exception trace:
at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:53
assert() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:53
Doctrine\DBAL\Driver\PDOConnection->exec() at /var/www/html/vendor/mediamonks/mssql-bundle/Helper/ConnectionHelper.php:16
MediaMonks\MssqlBundle\Helper\ConnectionHelper::setConnectionOptions() at /var/www/html/vendor/mediamonks/mssql-bundle/Doctrine/DBAL/Driver/PDODblib/Driver.php:70
MediaMonks\MssqlBundle\Doctrine\DBAL\Driver\PDODblib\Driver->connectUnix() at /var/www/html/vendor/mediamonks/mssql-bundle/Doctrine/DBAL/Driver/PDODblib/Driver.php:34
MediaMonks\MssqlBundle\Doctrine\DBAL\Driver\PDODblib\Driver->connect() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:362
Doctrine\DBAL\Connection->connect() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1853
Doctrine\DBAL\Connection->getWrappedConnection() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1241
Doctrine\DBAL\Connection->executeQuery() at /var/www/html/vendor/mediamonks/mssql-bundle/Doctrine/DBAL/Connection.php:17
MediaMonks\MssqlBundle\Doctrine\DBAL\Connection->executeQuery() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:978
Doctrine\DBAL\Connection->fetchAllAssociative() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php:91
Doctrine\DBAL\Tools\Console\Command\RunSqlCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:989
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:96
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:290
Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:82
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:166
Symfony\Component\Console\Application->run() at /var/www/html/bin/console:43
This is triggered when the ConnectionHelper starts running this query:
$connection->exec('SET ANSI_WARNINGS ON');
As a workaround I've created my own class extending MediaMonks\MssqlBundle\Doctrine\DBAL\Driver\PDODblib\Driver
and overwriting the connectUnix
method to exclude ConnectionHelper::setConnectionOptions($connection);
In the following code, what was the reason for pre-pending the values with N?
https://github.com/mediamonks/symfony-mssql-bundle/blob/master/Helper/ConnectionHelper.php
/**
* @param $query
* @param array $values
* @return void|mixed
*/
public static function updateQuery($query, array $values = [])
{
if (PlatformHelper::isWindows()) {
return $query;
}
for ($i = 0, $offset = 0; $pos = strpos($query, '?', $offset); $i++) {
$offset = $pos + 1;
if (isset($values[$i]) && is_string($values[$i])) {
$query = substr_replace($query, 'N?', $pos, 1);
$offset++;
}
}
return $query;
}
We're using this bundle on Ubuntu servers, and it's failing due to the pre-pended 'N' on the values, when we remove the isWindows() check is seems to work fine.
Should this logic be here? Was it for an older version of doctrine?
We're using:
"doctrine/orm": "^2.5.11",
"doctrine/doctrine-bundle": "^1.6.10",
Hi,
i am using your bundle with no bigger problems so far but when i switched to PHP7 i got some strange encoding issue with persisting my entities. When i create the entity all strings with accents are converted to some kind of chinese, and while editing with properties containing accents there is 500 error (while parsing update database query).
The problem doesnt occur on php5 nor php7 with mysql so i think that might be issue with the bundle. Do you have any idea what might be wrong?
I am using your bundle for mssql server support, but we want also to use "single table inheritance" feature from Doctrine, but there is an issue, I found what it is, and I'm asking if it can be fixed in the feature?
The issue is that your bundle overwrite Doctrine\ORM\Persisters\Entity\SingleTablePersister, in different files from "/doctrine/orm/lib/", with MediaMonks\MssqlBundle\Doctrine\ORM\Persisters\Entity\SingleTablePersister, but this class doesn't exists there, so we receive an error. This is done in MediaMonks\MssqlBundle\Composer\ScriptHandler.
So, can this be fixed?
Thank you.
Best regards,
Paul
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.