PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
calling nextResult(), MDB2 stored procedures

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Database
View previous topic :: View next topic  
Author Message
InDaLight



Joined: 18 Nov 2008
Posts: 1

PostPosted: Tue Nov 18, 2008 8:48 pm    Post subject: calling nextResult(), MDB2 stored procedures Reply with quote

Hi all,

While multiple experiments i getting MDB2 MySql stored procs to work.

Now i have code like this:
Code:

            $result = Commons::$dbConnection->executeStoredProc('get_all_material_types');
            if (MDB2::isError($result)){
                throw new Exception($result->getMessage());
            }

            if ($result->numRows() == 0){
               return (array());
            }else{
                $typesArray = $result->fetchAll();
               
                //this:
                $result->nextResult();

                $objsArray = array();
                foreach ($typesArray as $oneType){
                    $curObj = new self($oneType['name'], $oneType['name_in_url']);
                    $curObj->_setId($oneType['id']);
                    $curObj->_setIsDBRecord();
                    $objsArray[] = $curObj;
                }
                return $objsArray;
            }


But i confused about line:
Code:

                $result->nextResult();


Without this line any query after this failed with error:
"Commands out of sync; you can't run this command now"

But i think calling $result->nextResult() after every query looks some
strange, because there are no any "next result" is present, and
$result->nextResult() return me NULL.

Calling $result->free() not solve this problem.

Can anyone tell me:
1. What next result is mean is if not senseless?
2. Is the another way exist? Instead of calling nextResult()?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Database All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software