php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39315 mysql_pconnect with "bug"
Submitted: 2006-10-31 03:00 UTC Modified: 2006-11-08 14:25 UTC
From: roberto at spadim dot com dot br Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.1.6 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: roberto at spadim dot com dot br
New email:
PHP Version: OS:

 

 [2006-10-31 03:00 UTC] roberto at spadim dot com dot br
Description:
------------
FROM MANUAL (mysql_pconnect):
First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection.

that's ok, but i'm using pcntl with fork, one process is priority 20 and the other -20,
when i use mysql_query i first mysql_Select_db and after mysql_query, (with mysql_db_query the same thing occur)
one process is database "dev_comercial" and the other is "dev"

if mysql_pconnect add an new parameter that could be default_database and just use link resources with same default_database my error don't occur

when i select on process one and process two at samy time, one process get unknown table on dev when it must use dev_comercial database and not dev database

any idea? i'm using mysql_connect as an workaround but it get many connection and reconnection overhead

Reproduce code:
---------------
fork
pid 1:
mysql_pconnect()
mysql_db_select( dev_comercial )
mysql_Query
error: table "table" unknown on database "dev" (pid2 executed mysql_db_select after pid1 mysql_dbselect and before mysql_query)

pid 2:
mysql_pconnect()
mysql_db_select( dev )
mysql_Query

error: no error table is on dev database

Expected result:
----------------
get mysql_query from pid1 and pid2 without pid1 or pid2 changing database of pid1 or pid2

Actual result:
--------------
one mysql_select_db change database from pid1 and pid2 cause they are the same link resource
if i get diferent link resource no problem occur

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-08 14:25 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 10:01:30 2024 UTC