Re: Re: [PATCH] optional parameter to mysql_connect() to create truly new link
| From: | Lenar Lõhmus | Date: | Wed, 21 Nov 2001 14:53:22 +0000 |
| Subject: | Re: Re: [PATCH] optional parameter to mysql_connect() to create truly new link | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-71222@lists.php.net to get a copy of this message | ||
Hi,
I think no magic needed, optional parameter is good enough solution and
gives the control to the hands of programmer. Just - there should be this
flag for both: mysql_connect() and mysql_pconnect(). And I agree different
usernames is not the right thing to suggest.
Lenar
Markus Fischer wrote:
> On Wed, Nov 21, 2001 at 12:16:51PM +0200, Lenar Lõhmus wrote :
>> Markus Fischer wrote:
>>
>> > Hi,
>> >
>> > The attached patch against current CVS adds an optional
>> > parameter to mysql_connect() to specify if a truly new link
>> > to the database should be established. The patch changes the
>> > prototype to:
>> >
>> > resource mysql_connect ([string hostname [, string username [,
>> > string password [, bool new_link ]]]]);
>> >
>> > There is no BC issue. The optional parameter is ignored when
>> > using mysql_pconnect().
>>
>> I think it's not right to ignore this with mysql_pconnect().
>> In this case the meaning of this flag should be: 'return existing mysql
>> resource (or create new) not yet returned by similar call during this
>> request'
>
> Sure. It's just a matter of altering the logic (just a
> oneliner).
>
> The problem, with the current implementation you _can't_ work
> this around from PHP side. Only with different database users
> which is, IMHO, not the right solution. PHP traps traps you
> into this and its not hard to fix and has no BC issues at
> all.
>
> I already received mail that its "stupid to add a new param
> to the Function." and that "its better that PHP detects this
> problem self."
>
> I don't see such a problem with an optional parameter.
>
> And, I don't think its possible for PHP to do magic and
> detect itself what to do.
>
> I wonder what others think?
>
>
> - Markus