 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
InDaLight
Joined: 18 Nov 2008 Posts: 1
|
Posted: Tue Nov 18, 2008 8:48 pm Post subject: calling nextResult(), MDB2 stored procedures |
|
|
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 |
|
 |
|
|
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
|
|