[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15428] API: more on db
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15428] API: more on db |
Date: |
Fri, 5 Aug 2016 16:54:58 +0000 (UTC) |
Revision: 15428
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15428
Author: sigurdne
Date: 2016-08-05 16:54:58 +0000 (Fri, 05 Aug 2016)
Log Message:
-----------
API: more on db
Modified Paths:
--------------
trunk/phpgwapi/inc/class.db_adodb.inc.php
Modified: trunk/phpgwapi/inc/class.db_adodb.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db_adodb.inc.php 2016-08-05 16:16:45 UTC (rev
15427)
+++ trunk/phpgwapi/inc/class.db_adodb.inc.php 2016-08-05 16:54:58 UTC (rev
15428)
@@ -122,12 +122,33 @@
$this->Password = $Password;
}
- $type = $this->Type;
- if ( $type == 'mysql' )
+ $dsn = '';
+ $port ='';
+ $host = $this->Host;
+ switch ($this->Type)
{
- // $type = 'mysqlt';
- $type = 'mysqli';
+ 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}";
+ }
+
$this->adodb = newADOConnection($type);
if($this->fetchmode == 'ASSOC')
@@ -143,7 +164,15 @@
{
try
{
- $ret =
$this->adodb->PConnect($this->Host, $this->User, $this->Password,
$this->Database);
+ if($dsn)
+ {
+ $ret =
$this->adodb->PConnect($dsn, $this->User, $this->Password);
+
+ }
+ else
+ {
+ $ret =
$this->adodb->PConnect($host, $this->User, $this->Password, $this->Database);
+ }
}
catch(Exception $e){}
}
@@ -151,7 +180,14 @@
{
try
{
- $ret =
$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);
+ }
}
catch(Exception $e){}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15428] API: more on db,
sigurdne <=