ID:               39858
 Comment by:       denis dot podgurskiy at cofelab dot ru
 Reported By:      develar at gmail dot com
 Status:           Assigned
 Bug Type:         PDO related
 Operating System: Windows XP SP2
 PHP Version:      5.2.0
 Assigned To:      wez
 New Comment:

Hi there
I have had the same problem but as far as I use PHP 5 why do not create
your own class to work with PDO. See example - this is a part of class.
I just stupidly catch the required error, make re-init of the Zend_Db
and run this quesry once again...Really stupidly, but this bug meets on
Windows only and for Nix this case wont' work so nothing serious:)
Good luck, Denis

public function ExecuteStoredProcedure($spName, $args)
        {
                $ch = ',:';
                $sp_str = "";
                if(sizeof($args) > 0) {
                        $sp_str = 'CALL '.$spName.' (:'.implode($ch,
array_keys($args)).')';
                }
                else{
                        $sp_str = 'CALL '.$spName.'()';
                }
                $command = null;

                $command = $this -> Db -> prepare( $sp_str );
                $command -> setFetchMode ( Zend_Db::FETCH_ASSOC );
                foreach($args as $key => $par ){
                        if(!is_object($par)) {
                                trigger_error('Wrong parameters type in 
:'.$spName, E_USER_ERROR);
                        }
                        $command -> bindParam($par -> name, $par -> value, $par 
-> type,
$par -> size, array(
                                                PDO::ATTR_EMULATE_PREPARES => 
true) );  
                }
                try{
                        $command -> execute();
                } 

                catch(PDOException $e) {
                        if($e -> errorInfo[0] == !'HY000' && $e->errorInfo[0] 
!== '2013'){
                                echo "www";
                                throw($e);
                        } 
                        else {
                                $command = $this -> Db -> prepare( $sp_str );
                                $command -> setFetchMode ( Zend_Db::FETCH_ASSOC 
);
                                try { 
                                        $command -> execute();
                                } 
                                catch(PDOException $e) {
                                        if($e -> errorInfo[0] == !'HY000' && 
$e->errorInfo[0] !==
'2013'){
                                                throw($e);
                                        }       
                                        $command = null;
                                        $this -> Init();                        
        
                                }
                        }
                }
                $rows = array();
                if($command != null){
                        $rows = $command -> fetchAll();
                        $command -> closeCursor();
                        $this -> Init();
                }
                $command = null;
                return $rows;
        }


Previous Comments:
------------------------------------------------------------------------

[2006-12-18 12:26:21] mike at we11er dot co dot uk

Here are two more bug reports on pecl:

http://pecl.php.net/bugs/bug.php?id=7976
http://pecl.php.net/bugs/bug.php?id=5827

Again it seems intermittant with some people. I got a SQL error log
which showed this:

061213 11:27:36 [Warning] Aborted connection 1 to db: 'test' user:
'test' host: 'localhost' (Got an error reading communication packets)

Before anyone asks, I have been rd /s'ing the PHP directory when I try
a snapshot to make sure I'm running a clean version of everything.

Adding $this->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, TRUE);
does not stop the error.

nextRowset() isn't implemented so we can't fetch all the results
manually.

That is all.

------------------------------------------------------------------------

[2006-12-18 12:18:06] mike at we11er dot co dot uk

I'm having this issue as well.

My bug report here: http://bugs.php.net/bug.php?id=39759 has some more
information. To recap:

I've tested this with php 5.2 release, as well as various recent
snapshots. I've tested with mysql 5.0.22 and 5.0.27. I've tested with
the libmysql.dll files that php ships with, as well as the libmysql.dll
that mysql ships with - they produce two different errors but the
problem is the same.

When using PHP's libmysql.dll the error is: SQLSTATE[HY000]:
General error: 2013 Lost connection to MySQL server during query

When using MySQL's libmysql.dll the error is: SQLSTATE[HY000]: General
error: 2014 Cannot execute queries while other
unbuffered queries are active.

When running through apache I get this error 100% of the time. When
running through the PHP command line interface, I get it about 50% of
the time, so perhaps there are performance issues here. I'm running on
a celeron 2.4GHz with 512 ram. Windows XP.

Please fix this!

------------------------------------------------------------------------

[2006-12-18 09:28:00] develar at gmail dot com

Почитайте
http://phpclub.ru/talk/showthread.php?s=&threadid=92764&rand=10

It always worked normally on linux. My first message: "I read #35333
#35637 #35203, but why the given code
fine works in Debian?" Only in windows.

------------------------------------------------------------------------

[2006-12-18 09:20:54] [EMAIL PROTECTED]

Works just fine on Linux.
Make sure you're really running the snapshot.

------------------------------------------------------------------------

[2006-12-18 08:43:52] develar at gmail dot com

It is not fixed.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/39858

-- 
Edit this bug report at http://bugs.php.net/?id=39858&edit=1

Reply via email to