From:             roberto at spadim dot com dot br
Operating system: linux
PHP version:      5.1.6
PHP Bug Type:     MySQL related
Bug description:  mysql_pconnect with "bug"

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

-- 
Edit bug report at http://bugs.php.net/?id=39315&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39315&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39315&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39315&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39315&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39315&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39315&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39315&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39315&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39315&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39315&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39315&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39315&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39315&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39315&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39315&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39315&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39315&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39315&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39315&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39315&r=mysqlcfg

Reply via email to