[DBAL-239] CI 2 + DOCTRINE 2 + SQLSERVER 2005 PDO_SQLSRV.DLL Created: 23/Mar/12  Updated: 08/Sep/13  Resolved: 08/Sep/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: M. David Zainuri Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: None
Environment:

os:windows xp
sqlserver2005



 Description   

Hi, master...

Please help me,
i was integration : ci2+doctrine2+pdo_mysql status is OK http://103.28.148.89/ci2doctrine2
php.ini http://103.28.148.89 ===> phpinfo()

But ci2+doctrine2+pdo_sqlsrv. Show bugs this :

"Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[IMSSP]: This extension requires either the Microsoft SQL Server 2008 Native Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native Client ODBC Driver to communicate with SQL Server. Neither of those ODBC Drivers are currently installed. Access the following URL to download the Microsoft SQL Server 2008 R2 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712' in C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Driver\PDOConnection.php:36 Stack trace: #0 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Driver\PDOConnection.php(36): PDO->_construct('sqlsrv:server=B...', 'sa', 'password', Array) #1 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Driver\PDOSqlsrv\Driver.php(38): Doctrine\DBAL\Driver\PDOConnection->_construct('sqlsrv:server=B...', 'sa', 'password', Array) #2 C:\xampp\htdocs\sqlserver\application\third_party\doct in C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Driver\PDOConnection.php on line 36"

Thanks
GBU



 Comments   
Comment by M. David Zainuri [ 25/Mar/12 ]

This Problem is resolve with SQL Server 2008.

But i have new problem, paging is Error

"Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part identifier "c0_.group_company_code" could not be bound.' in C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Connection.php:577 Stack trace: #0 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Connection.php(577): PDO->query('WITH outer_tbl ...') #1 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\ORM\Query\Exec\SingleSelectExecutor.php(46): Doctrine\DBAL\Connection->executeQuery('WITH outer_tbl ...', Array, Array) #2 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\ORM\Query.php(274): Doctrine\ORM\Query\Exec\SingleSelectExecutor->execute(Object(Doctrine\DBAL\Connection), Array, Array) #3 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\ORM\AbstractQuery.php(539): Doctrine\ORM\Query->_doExecute() #4 C:\xampp\htdocs\sqlserver\application\third_party\doctri in C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Connection.php on line 577"

This link http://103.28.148.89/sqlserver/index.php/company_group/posts/list_company_group

Any body help...

Thanks

Comment by M. David Zainuri [ 25/Mar/12 ]

Problem Resolve

go into:
Doctrine\DBAL\Platforms\MsSqlPlatform

Find:

$over = preg_replace('/\"[^,]*\".\"([^,]*)\"/i', '"inner_tbl"."$1"', $orderby);

Add before:

                    # Get Columns
                    $columns = array();
                    if(preg_match_all('/([a-zA-Z][0-9]+_\.[a-zA-Z0-9\-_]+)\sAS\s([a-zA-Z0-9\-\_]+)/', $query, $matched)) {
                        for($i=0; $i<count($matched[1]); ++$i)
                        {
                            $columns[$matched[1][$i]] = $matched[2][$i];
                        }
                    }
                    
                    # Replace columns with their alias in the "orderby" statement
                    if(preg_match_all('/([a-zA-Z][0-9]+_\.[a-zA-Z0-9\-_]+)\s/i', $orderby, $matches)) {
                        foreach($matches[1] as $column)
                        {
                            $orderby = preg_replace('/'.$column.'/', $columns[$column], $orderby);
                        }
                    }

Thanks on issue this link "http://www.doctrine-project.org/jira/browse/DBAL-82?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel"

Comment by Benjamin Eberlei [ 05/May/12 ]

CAn you post the query that leads to this error? I cant reproduce it with SQL Server 2008

Comment by Benjamin Eberlei [ 01/May/13 ]

This was fixed in other issues already

Generated at Mon Sep 22 22:27:50 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.