fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [15429] API: more on db


From: sigurdne
Subject: [Fmsystem-commits] [15429] API: more on db
Date: Sat, 6 Aug 2016 19:06:38 +0000 (UTC)

Revision: 15429
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15429
Author:   sigurdne
Date:     2016-08-06 19:06:38 +0000 (Sat, 06 Aug 2016)
Log Message:
-----------
API: more on db

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.db_pdo.inc.php

Modified: trunk/phpgwapi/inc/class.db_pdo.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db_pdo.inc.php     2016-08-05 16:54:58 UTC (rev 
15428)
+++ trunk/phpgwapi/inc/class.db_pdo.inc.php     2016-08-06 19:06:38 UTC (rev 
15429)
@@ -269,10 +269,45 @@
                */
                protected function _connect_adodb()
                {
+                       $dsn = '';
+                       $port ='';
+                       $host = $this->Host;
+                       switch ($this->Type)
+                       {
+                               case 'mysql':
+                                       $type = 'mysqli';
+                                       break;
+                               case 'mssql':
+                                       $type = 'odbc_mssql';
+                                       $dsn = "Driver={SQL 
Server};Server={$this->Host};Database={$this->Database};";
+                                       break;
+                               case 'oci8':
+                               case 'oracle':
+                                       $type = 'oci8';
+                                       $port = $this->Port ? $this->Port : 
1521;
+                                       break;
+                               default:
+                                       $type = $this->Type;
+                                       break;
+                       }
+
+                       if($port)
+                       {
+                               $host .= ":{$port}";
+                       }
                        require_once PHPGW_API_INC . '/adodb/adodb.inc.php';
-                       $this->adodb = newADOConnection($this->Type);
+                       $this->adodb = newADOConnection($type);
                        $this->adodb->SetFetchMode(ADODB_FETCH_BOTH);
-                       return @$this->adodb->connect($this->Host, $this->User, 
$this->Password, $this->Database);
+                       if($dsn)
+                       {
+                               $ret = @$this->adodb->connect($dsn, 
$this->User, $this->Password);
+
+                       }
+                       else
+                       {
+                               $ret = @$this->adodb->connect($host, 
$this->User, $this->Password, $this->Database);
+                       }
+                       return $ret;
                }
 
                /**




reply via email to

[Prev in Thread] Current Thread [Next in Thread]