[21002] Improvement: allow delay connect on db in case of connecting to different db, fix oracle-connection 4565:4680

Sigurd Nes <[email protected]> Sat, 30 Jan 2010 16:55:59 +0000
Newsgroups gmane.comp.web.phpgroupware.cvs
Message-ID <[email protected]>
Revision: 21002
          http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21002
Author:   sigurdne
Date:     2010-01-30 16:55:59 +0000 (Sat, 30 Jan 2010)
Log Message:
-----------
Improvement: allow delay connect on db in case of connecting to different db, fix oracle-connection 4565:4680

Modified Paths:
--------------
    people/sigurdne/modules/phpgwapi/trunk/inc/class.db.inc.php
    people/sigurdne/modules/phpgwapi/trunk/inc/class.db_adodb.inc.php
    people/sigurdne/modules/phpgwapi/trunk/inc/class.db_pdo.inc.php

Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.db.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.db.inc.php	2010-01-30 16:52:32 UTC (rev 21001)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.db.inc.php	2010-01-30 16:55:59 UTC (rev 21002)
@@ -108,7 +108,7 @@
 		* @param string $query query to be executed (optional)
 		* @param string $db_type the database engine being used
 		*/
-		public function __construct($query = null, $db_type = null)
+		public function __construct($query = null, $db_type = null, $delay_connect = null)
 		{
 			if ( is_null($db_type) )
 			{
@@ -137,7 +137,10 @@
 					//do nothing for now
 			}
 			
-			$this->connect();
+			if( !$delay_connect )
+			{
+				$this->connect();
+			}
 
 			if ( !is_null($query) )
 			{

Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.db_adodb.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.db_adodb.inc.php	2010-01-30 16:52:32 UTC (rev 21001)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.db_adodb.inc.php	2010-01-30 16:55:59 UTC (rev 21002)
@@ -36,9 +36,9 @@
 		* @param string $query query to be executed (optional)
 		* @param string $db_type the database engine being used
 		*/
-		public function __construct($query = null, $db_type = null)
+		public function __construct($query = null, $db_type = null, $delay_connect = null)
 		{
-			parent::__construct($query, $db_type);
+			parent::__construct($query, $db_type, $delay_connect);
 		}
 
 		/**

Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.db_pdo.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.db_pdo.inc.php	2010-01-30 16:52:32 UTC (rev 21001)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.db_pdo.inc.php	2010-01-30 16:55:59 UTC (rev 21002)
@@ -33,9 +33,9 @@
 		* @param string $query query to be executed (optional)
 		* @param string $db_type the database engine being used
 		*/
-		public function __construct($query = null, $db_type = null)
+		public function __construct($query = null, $db_type = null, $delay_connect = null)
 		{
-			parent::__construct($query, $db_type);
+			parent::__construct($query, $db_type, $delay_connect);
 		}
 
 		/**
@@ -129,7 +129,10 @@
 				case 'oracle':
 					try
 					{
-						$this->db = new PDO("OCI:dbname={$this->Database};charset=UTF-8", $this->User, $this->Password);
+						$_charset = ';charset=AL32UTF8';
+				//		$_charset = '';
+						$this->db = new PDO("oci:dbname={$this->Host}/{$this->Database}{$_charset}", $this->User, $this->Password);
+						unset($_charset);
 					}
 					catch(PDOException $e){}
 					break;