dev-master
9999999-devMSSQL dbib module for zf
The Requires
- php >=5.5
- doctrine/doctrine-orm-module ^1.0.0
by Gugu Mabuza
mssql dblib zf
Wallogit.com
2017 © Pedro Peláez
MSSQL dbib module for zf
PDO DBlib Module for Zend, (*1)
Doctrine 2 does support any method of connecting to SQL Server on a Linux box. Here's a simple driver that supports PDO DBlib. Many tests fail, but most are related to shortcomings of the PDODBlib driver. There is a patch in the PHP repo to add transaction and lastInsertId support, but this package has some minor work arounds., (*2)
For Symphony Bundle: [PDODblibBundle] (https://github.com/trooney/PDODblibBundle) (latest master), (*3)
DBLib requires FreeTDS. We can't go into detail about configuring FreeTDS, but the connection configured should look something like following:, (*4)
[mssql_freetds]
host = 172.30.252.25
port = 1433
tds version = 8.0
client charset = UTF-8
text size = 20971520
Add this in your composer.json:, (*5)
"require": {
"mabuzagu/pdo-dblib-module": "dev-master",
}
Now tell composer to download PDODblibModule by running the command:, (*6)
$ php composer.phar update
Enabling it in your application.config.phpfile., (*7)
<?php
return [
'modules' => [
// ...
'DoctrineModule',
'DoctrineORMModule',
'PDODblibModule',
],
// ...
];
Add this to your autoload folder, (*8)
<?php
return [
'doctrine' => [
'connection' => [
'orm_default' => [
'driverClass' => PDODblibModule\Doctrine\DBAL\Driver\PDODblib\Driver::class,
'params' => [
'host' => '<host>',
'port' => '<port>',
'user' => '<user>',
'password' => '<password>',
'dbname' => '<dbname>',
],
],
],
],
];
Getting everything together wasn't easy. You need to complete the following steps, checking each installation is successful by connecting with the appropriate tools:, (*9)
You can find a patch for some of the short-comings of pdo_dblib on SVN., (*10)
http://svn.php.net/viewvc/php/php-src/trunk/ext/pdo_dblib/dblib_driver.c?view=log, (*11)
See: Revision 300647 - lastInsertId Revision 300628 - transaction support, (*12)
Doctrine2's test suite does not allow you to add database drivers on the fly. If you want to test this package, modify Doctrine/DBAL/Driver/DriverManager::$_driverMap as follows:, (*13)
final class DriverManager
{
private static $_driverMap = [
/* ... snip ... */
'pdo_dblib' => Doctrine\DBAL\Driver\PDODblib\Driver::class,
];
}
It's possible, but not easy. Here's what I did:, (*14)
MSSQL dbib module for zf
mssql dblib zf