Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added support for optional use of persistent connections
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1135 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed Jun 14, 2002
1 parent 31dc1a6 commit 5dc5285
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions core_database_API.php
Expand Up @@ -18,7 +18,8 @@ function db_connect($p_hostname='', $p_username='',
$p_password='', $p_database='',
$p_port='' ) {

global $g_hostname, $g_db_username, $g_db_password, $g_database_name, $g_port;
global $g_hostname, $g_db_username, $g_db_password, $g_database_name, $g_port,
$g_use_persistent_connections;

if ( empty( $p_hostname ) ) {
$p_hostname = $g_hostname;
Expand All @@ -36,8 +37,15 @@ function db_connect($p_hostname='', $p_username='',
$p_port = $g_port;
}

$t_result = mysql_connect( $p_hostname.':'.$p_port,
# @@@ Will change this hack, when I combine all database opens
# in one place.
if ( OFF == $g_use_persistent_connections ) {
$t_result = mysql_connect( $p_hostname.':'.$p_port,
$p_username, $p_password );
} else {
$t_result = mysql_pconnect( $p_hostname.':'.$p_port,
$p_username, $p_password );
}

if ( !$t_result ) {
echo 'ERROR: FAILED CONNECTION TO DATABASE: ';
Expand Down Expand Up @@ -139,4 +147,4 @@ function db_close() {
$t_result = mysql_close();
}
# --------------------
?>
?>

0 comments on commit 5dc5285

Please sign in to comment.