]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17491 oracle connections - fix annoyance when multiple connections
authorEloy Lafuente <stronk7@moodle.org>
Sun, 8 Nov 2009 23:13:31 +0000 (23:13 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Sun, 8 Nov 2009 23:13:31 +0000 (23:13 +0000)
are used and enforce new connections by using oci_new_connect()

lib/dml/oci_native_moodle_database.php

index e9c5c408fe51fcb1f24c20f7b1e8ecc315643001..e2b52d5f309540552601f8c314061a739deca293 100644 (file)
@@ -180,19 +180,20 @@ class oci_native_moodle_database extends moodle_database {
         $pass = addcslashes($this->dbpass, "'\\");
 
         if (empty($this->dbhost)) {
-            // old style full address
+            // old style full address (TNS)
+            $dbstring = $this->dbname;
         } else {
             if (empty($this->dboptions['dbport'])) {
                 $this->dboptions['dbport'] = 1521;
             }
-            $this->dbname = '//'.$this->dbhost.':'.$this->dboptions['dbport'].'/'.$this->dbname;
+            $dbstring = '//'.$this->dbhost.':'.$this->dboptions['dbport'].'/'.$this->dbname;
         }
 
         ob_start();
         if (empty($this->dboptions['dbpersit'])) {
-            $this->oci = oci_connect($this->dbuser, $this->dbpass, $this->dbname, 'AL32UTF8');
+            $this->oci = oci_new_connect($this->dbuser, $this->dbpass, $dbstring, 'AL32UTF8');
         } else {
-            $this->oci = oci_pconnect($this->dbuser, $this->dbpass, $this->dbname, 'AL32UTF8');
+            $this->oci = oci_pconnect($this->dbuser, $this->dbpass, $dbstring, 'AL32UTF8');
         }
         $dberr = ob_get_contents();
         ob_end_clean();