Add z/OS compatibility to DB2 Service Provider
This commit is contained in:
parent
92f6800a01
commit
81cb89a639
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Cooperl\Database\DB2;
|
namespace Cooperl\Database\DB2;
|
||||||
|
|
||||||
|
use Cooperl\Database\DB2\Query\Processors\DB2ZOSProcessor;
|
||||||
use PDO;
|
use PDO;
|
||||||
|
|
||||||
use Illuminate\Database\Connection;
|
use Illuminate\Database\Connection;
|
||||||
@ -110,6 +111,10 @@ class DB2Connection extends Connection
|
|||||||
*/
|
*/
|
||||||
protected function getDefaultPostProcessor()
|
protected function getDefaultPostProcessor()
|
||||||
{
|
{
|
||||||
|
if ($this->config['driver'] == 'odbczos') {
|
||||||
|
return new DB2ZOSProcessor();
|
||||||
|
}
|
||||||
|
|
||||||
return new DB2Processor();
|
return new DB2Processor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace Cooperl\Database\DB2;
|
|||||||
|
|
||||||
use Cooperl\Database\DB2\Connectors\ODBCConnector;
|
use Cooperl\Database\DB2\Connectors\ODBCConnector;
|
||||||
use Cooperl\Database\DB2\Connectors\IBMConnector;
|
use Cooperl\Database\DB2\Connectors\IBMConnector;
|
||||||
|
use Cooperl\Database\DB2\Connectors\ODBCZOSConnector;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Config;
|
use Config;
|
||||||
|
|
||||||
@ -50,8 +51,8 @@ class DB2ServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
// Extend the connections with pdo_odbc and pdo_ibm drivers
|
// Extend the connections with pdo_odbc and pdo_ibm drivers
|
||||||
foreach (Config::get('database.connections') as $conn => $config) {
|
foreach (Config::get('database.connections') as $conn => $config) {
|
||||||
// Only use configurations that feature a "odbc" or "ibm" driver
|
// Only use configurations that feature a "odbc", "ibm" or "odbczos" driver
|
||||||
if (!isset($config['driver']) || !in_array($config['driver'], ['odbc', 'ibm'])) {
|
if (!isset($config['driver']) || !in_array($config['driver'], ['odbc', 'ibm', 'odbczos'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +62,10 @@ class DB2ServiceProvider extends ServiceProvider
|
|||||||
case 'odbc':
|
case 'odbc':
|
||||||
$connector = new ODBCConnector();
|
$connector = new ODBCConnector();
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'odbczos':
|
||||||
|
$connector = new ODBCZOSConnector();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'ibm':
|
case 'ibm':
|
||||||
default:
|
default:
|
||||||
|
@ -57,11 +57,11 @@ PDO::CASE_NATURAL
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'connections' => [
|
'connections' => [
|
||||||
|
|
||||||
'ibmi' => [
|
'ibmi' => [
|
||||||
'driver' => 'odbc' / 'ibm',
|
'driver' => 'odbc' / 'ibm' / 'odbczos',
|
||||||
'driverName' => '{IBM i Access ODBC Driver}' / '{iSeries Access ODBC Driver}',
|
'driverName' => '{IBM i Access ODBC Driver}' / '{iSeries Access ODBC Driver}',
|
||||||
// General settings
|
// General settings
|
||||||
'host' => 'server',
|
'host' => 'server',
|
||||||
@ -71,6 +71,7 @@ return [
|
|||||||
'database' => 'WRKRDBDIRE entry',
|
'database' => 'WRKRDBDIRE entry',
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
'schema' => 'default schema',
|
'schema' => 'default schema',
|
||||||
|
'port' => 50000,
|
||||||
'signon' => 3,
|
'signon' => 3,
|
||||||
'ssl' => 0,
|
'ssl' => 0,
|
||||||
'commitMode' => 2,
|
'commitMode' => 2,
|
||||||
|
Loading…
Reference in New Issue
Block a user