[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9357] api: configurable db-port for oracle
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9357] api: configurable db-port for oracle |
Date: |
Thu, 10 May 2012 11:38:16 +0000 |
Revision: 9357
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9357
Author: sigurdne
Date: 2012-05-10 11:38:15 +0000 (Thu, 10 May 2012)
Log Message:
-----------
api: configurable db-port for oracle
Modified Paths:
--------------
trunk/phpgwapi/inc/class.db.inc.php
trunk/phpgwapi/inc/class.db_pdo.inc.php
Modified: trunk/phpgwapi/inc/class.db.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db.inc.php 2012-05-10 11:37:31 UTC (rev 9356)
+++ trunk/phpgwapi/inc/class.db.inc.php 2012-05-10 11:38:15 UTC (rev 9357)
@@ -84,6 +84,11 @@
var $Password;
/**
+ * @var integer $Port Port used to connect to database
+ */
+ var $Port;
+
+ /**
* @var bool $debug enable debugging
*/
var $debug = false;
@@ -200,8 +205,9 @@
* @param string $Host database host to connect to (optional)
* @param string $User name of database user (optional)
* @param string $Password password for database user (optional)
+ * @param int $Port Port for database host (optional)
*/
- abstract public function connect($Database = null, $Host =
null, $User = null, $Password = null);
+ abstract public function connect($Database = null, $Host =
null, $User = null, $Password = null, $Port = null);
/**
Modified: trunk/phpgwapi/inc/class.db_pdo.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db_pdo.inc.php 2012-05-10 11:37:31 UTC (rev
9356)
+++ trunk/phpgwapi/inc/class.db_pdo.inc.php 2012-05-10 11:38:15 UTC (rev
9357)
@@ -76,8 +76,9 @@
* @param string $Host database host to connect to (optional)
* @param string $User name of database user (optional)
* @param string $Password password for database user (optional)
+ * @param int $Port Port for database host (optional)
*/
- public function connect($Database = null, $Host = null, $User =
null, $Password = null)
+ public function connect($Database = null, $Host = null, $User =
null, $Password = null, $Port = null)
{
if ( !is_null($Database) )
{
@@ -99,6 +100,11 @@
$this->Password = $Password;
}
+ if ( !is_null($Port) )
+ {
+ $this->Port = $Port;
+ }
+
switch ( $this->Type )
{
case 'postgres':
@@ -131,9 +137,27 @@
case 'oracle':
try
{
+
+/*
+ $this->debug = true;
+ $tns = "
+ (DESCRIPTION =
+ (ADDRESS_LIST =
+ (ADDRESS =
(PROTOCOL = TCP)(HOST = {$this->Host})(PORT = 21521))
+ )
+ (CONNECT_DATA =
+ (SERVICE_NAME =
FELPROD)
+ )
+ )
+ ";
+
+ $this->db = new
PDO("oci:dbname=".$tns,$this->User,$this->Password);
+*/
+ $port = $this->Port ?
$this->Port : 1521;
+
$_charset = ';charset=AL32UTF8';
// $_charset = '';
- $this->db = new
PDO("oci:dbname={$this->Host}/{$this->Database}{$_charset}", $this->User,
$this->Password);
+ $this->db = new
PDO("oci:dbname={$this->Host}:{$port}/{$this->Database}{$_charset}",
$this->User, $this->Password);
unset($_charset);
}
catch(PDOException $e){}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9357] api: configurable db-port for oracle,
Sigurd Nes <=