ok, now i got it done :-)
it turned out that calling consequent stored procedure using $model->query(
$queryStr ) is causing memory issues through the execution of the controller
accessing the target associated model, to solve this issue i have created a
method inside my user defined model, call it manageMysqlResult, from within
this method you call "mysqli_next_result" which in its turn prepares the
next result set from a previous call to mysqli_multi_query(), here is
exactly how i have constructed my model:
*class Video extends AppModel {
var $name = 'Video';
var $useTable = 'videos';
function manageMysqlResult**() {
$db =& ConnectionManager::getDataSource(
$this->useDbConfig );
$lastResult = mysqli_next_result( $db->connec );
}
}
*and from within my controller i call it like this:
*// get most watched videos
$mostWatched = $this->Video->query('CALL SP_getMostViewedVideos(1,3)');
$this->Video->**manageMysqlResult**();
$this->set('mostWatched' , $mostWatched);
// get most rated videos
$mostRated = $this->Video->query('CALL SP_getMostRatedVideos(1,3)');
$this->Video->**manageMysqlResult**();
$this->set('mostRated' , $mostRated);
// get recent added videos
$resentAdded = $this->Video->query('CALL SP_getMostRecentVideos(1,3)');
$this->Video->**manageMysqlResult**();
$this->set('resentAdded' , $resentAdded);
*hopefully that will help someone someday passing through this if facing
any!
Thanks for all the help "AD7six" really much appreciated, i owe you the
hottest cup of coffee ever :-)
- soosa
*
*
On Tue, May 20, 2008 at 4:14 AM, Ma'moon <[EMAIL PROTECTED]> wrote:
> According to this link "
> http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html" the sql
> result set should be freed from memory in order to execute consequent
> queries after each other, am not sure if this is a bug in CakePHP or not but
> it seems that the result set is not being freed from memory after executing
> the queries consequently.
> is there any way that i can call mysql_free_result from the controller in
> order to the following:
>
> $mostWatched = $this->Video->query('CALL SP_getMostViewedVideos(1,3)');
> *$this->Video->freeUserDefinedQueryResultSet();*
> $mostRated = $this->Video->query('CALL SP_getMostRatedVideos(1,3)');
> *$this->Video->freeUserDefinedQueryResultSet();*
> $resentAdded = $this->Video->query('CALL SP_getMostRecentVideos(1,3)');
> *$this->Video->freeUserDefinedQueryResultSet();*
>
> though this should be done from the core but it doesn't seem to be working!
>
> i am using version 1.1.19.6305, i forgot to say so above and am sorry for
> that, anyone?
>
>
> On Mon, May 19, 2008 at 6:06 AM, Ma'moon <[EMAIL PROTECTED]> wrote:
>
>> Hello guys,
>> i have a problem where i am trying to execute the following queries in my
>> controller "consequently!":
>> $mostWatched = $this->Video->query('CALL SP_getMostViewedVideos(1,3)');
>> $mostRated = $this->Video->query('CALL SP_getMostRatedVideos(1,3)');
>> $resentAdded = $this->Video->query('CALL SP_getMostRecentVideos(1,3)');
>> and it results to "*SQL Error: 2014: Commands out of sync; you can't run
>> this command now in cake/libs/model/datasources/dbo_source.php on line 440
>> *"
>>
>> i would really appreciate it if any one can tell me why this is happening
>> and how to solve it!
>>
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---