← Back to team overview

phpdevshell team mailing list archive

Re: [Question #209172]: How can I interact with a remote database in my own plugins?

 

Question #209172 on PHPDevShell changed:
https://answers.launchpad.net/phpdevshell/+question/209172

    Status: Answered => Open

pystone is still having a problem:
No, actually it does not work either. I have tried this before but it
still connected to the master database.

Maybe you can solve this problem from these perspective:
1.Noting that the function applyConfig has a parameter '$db_config', this can change the database it will connect to. Yet, in the model php I cannot pass the parameter to the factory function. So I wonder if you can add a variable named 'db_config' in the PHPDS_query class and I can change the value of it as I can do with 'connector'. And this variable can be passed to the constructor of PHPDS_legacyConnector class.
(A simple test can prove that writing a deprived class of PHPDS_legacyConnector does not work: add "echo 'testing~';" in the applyConfig of the deprived class and run the page, there is no output of "testing~". This means that the overwritten function isn't running at all.)

2.In a single session of php, only one mysql connection is permitted. If we want to get another connection at the same time, we should add the fourth parameter 'true' in the mysql_connect() to force to open a new connection. 
(I have tried to add this parameter in both the deprived class and PHPDS_legacyConnector class, but none of them worked. So I still reckon that if the first problem can be solved, the whole problem can be solved.)

Waiting for your good news~ :)

-- 
You received this question notification because you are a member of
PHPDevShell, which is an answer contact for PHPDevShell.