Welcome Guest, Not a member yet? Register   Sign In
Multiple database + pconnect issues
#15

[eluser]Nanodeath[/eluser]
Okay, sorry, that was perhaps a little pedantic.

Here's an example of how I implement what you said with a multidimensional array:
Code:
function db_select()

{
    static $selected_db = array();
    if($this->_persistent){
        if(@$selected_db[$this->hostname][$this->username][$this->password] != $this->database) {
            $selected_db[$this->hostname][$this->username][$this->password] = $this->database;
        } else {
            return TRUE;
        }
    }

    return @mysql_select_db($this->database, $this->conn_id);

}

As for the new connection stuff, mysql_connect does have a $new_link argument, pg_connect has a PGSQL_CONNECT_FORCE_NEW flag, and pg_pconnect also has a PGSQL_CONNECT_FORCE_NEW flag, but there's no way that I can see to force a new connection for mysql_pconnect, as it does not have a $new_link argument.

It's *possible* for a SQL server to "go away" (connection times out..?) but since CI doesn't worry about this happening (i.e. you don't see mysql_ping before performing a query), I don't think we have to either. Could happen for extremely long pages or something, but I'm really not an expert.


Messages In This Thread
Multiple database + pconnect issues - by El Forum - 02-20-2008, 10:16 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 06:10 AM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 09:51 AM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 10:33 AM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 02:19 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 03:47 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 04:25 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 04:39 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 05:00 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 05:20 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 05:25 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 05:40 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 06:16 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 06:47 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 06:58 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 07:04 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 07:14 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 07:24 PM
Multiple database + pconnect issues - by El Forum - 02-21-2008, 07:39 PM
Multiple database + pconnect issues - by El Forum - 05-01-2008, 08:48 AM
Multiple database + pconnect issues - by El Forum - 05-19-2008, 09:35 PM
Multiple database + pconnect issues - by El Forum - 05-20-2008, 06:26 AM
Multiple database + pconnect issues - by El Forum - 06-11-2008, 09:39 AM
Multiple database + pconnect issues - by El Forum - 06-11-2008, 02:19 PM
Multiple database + pconnect issues - by El Forum - 07-28-2008, 02:47 AM
Multiple database + pconnect issues - by El Forum - 07-28-2008, 03:06 AM
Multiple database + pconnect issues - by El Forum - 07-28-2008, 09:24 PM
Multiple database + pconnect issues - by El Forum - 07-29-2008, 01:11 AM
Multiple database + pconnect issues - by El Forum - 07-29-2008, 07:07 PM
Multiple database + pconnect issues - by El Forum - 07-30-2008, 02:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB