Added a new option to the db connection function

This commit is contained in:
Alejandro Gallardo Escobar 2015-06-02 18:02:38 +02:00
parent 6d47307ad2
commit ade22203c5
1 changed files with 6 additions and 2 deletions

View File

@ -14,7 +14,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function oracle_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null) {
function oracle_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null, $new_connection = true) {
global $config;
if ($host === null)
@ -30,7 +30,11 @@ function oracle_connect_db($host = null, $db = null, $user = null, $pass = null,
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
// If you want persistent connections change it to oci_pconnect().
$connect_id = oci_new_connect($user, $pass, '//' . $host . ':' . $port . '/' . $db);
if ($new_connection)
$connect_id = oci_new_connect($user, $pass, '//' . $host . ':' . $port . '/' . $db);
else
$connect_id = oci_connect($user, $pass, '//' . $host . ':' . $port . '/' . $db);
if (! $connect_id) {
return false;
}