mirror of
https://github.com/Mibew/design.git
synced 2025-01-23 02:20:34 +03:00
Added the ability to use persistent connections
This commit is contained in:
parent
11fa45cb19
commit
b54cd674e6
@ -344,12 +344,18 @@ function getgetparam($name, $default = '')
|
|||||||
|
|
||||||
function connect()
|
function connect()
|
||||||
{
|
{
|
||||||
global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb, $dbencoding, $force_charset_in_connection;
|
global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb, $dbencoding, $force_charset_in_connection, $use_persistent_connection;
|
||||||
if (!extension_loaded("mysql")) {
|
if (!extension_loaded("mysql")) {
|
||||||
die('Mysql extension is not loaded');
|
die('Mysql extension is not loaded');
|
||||||
}
|
}
|
||||||
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass)
|
if ($use_persistent_connection) {
|
||||||
or die('Could not connect: ' . mysql_error());
|
$link = @mysql_pconnect($mysqlhost, $mysqllogin, $mysqlpass);
|
||||||
|
}else{
|
||||||
|
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass);
|
||||||
|
}
|
||||||
|
if (! $link) {
|
||||||
|
die('Could not connect: ' . mysql_error());
|
||||||
|
}
|
||||||
mysql_select_db($mysqldb, $link) or die('Could not select database');
|
mysql_select_db($mysqldb, $link) or die('Could not select database');
|
||||||
if ($force_charset_in_connection) {
|
if ($force_charset_in_connection) {
|
||||||
mysql_query("SET NAMES '$dbencoding'", $link);
|
mysql_query("SET NAMES '$dbencoding'", $link);
|
||||||
|
@ -41,6 +41,8 @@ $mysqlprefix = "";
|
|||||||
$dbencoding = "utf8";
|
$dbencoding = "utf8";
|
||||||
$force_charset_in_connection = true;
|
$force_charset_in_connection = true;
|
||||||
|
|
||||||
|
$use_persistent_connection = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mailbox
|
* Mailbox
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user