• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
working w/stored proc that return multiple result sets

#1
Huh  I've been working on converting an old dot net application to php/mysql and CI3. 

the dot net application is using mysql with a number of stored procedures that for the most part work just fine when called using $this->db->query("call xxxx()"); However, a number of those stored procs return multiple result sets that  are relatively simple to use in the dot net/c# environment. not so much using this particular db interface. or at least, that I've discovered. 

Any ideas or suggestions as to how to accomplish this?  I do know that I can do this within a loop using the mysql pdo interface. is this something I should use just for this particular situation?

please be kind, as I'm new to 3.x and never really encountered this  when learning 2.x.. 

regards,


OM.
OM...

-------------------------
And on the pedestal these words appear:
'My name is Ozymandias, king of kings:
Look on my works, ye Mighty, and despair!'
Nothing beside remains. Round the decay
Of that colossal wreck, boundless and bare
The lone and level sands stretch far away.
Reply

#2
You should be able to call more than one stored procedure, just by calling ->next_result(). I'm not sure if CI3 has ->next_result(), but if it doesn't you will need a hack:
PHP Code:
/*/system/database/drivers/mysqli/mysqli_result.php

This is the only system hack, and was necessary because CodeIgniter
does not currently allow more than one stored procedure to be run 
during the same request.

The following method was added to the CI_DB_mysqli_result class:*/


/**
 * Read the next result
 *
 * @return  null
 */
   
function next_result()
{
    if (is_object($this->conn_id))
    {
        return mysqli_next_result($this->conn_id);
    }
}

// -------------------------------------------------------------------- 
Reply

#3
(12-07-2015, 03:43 PM)skunkbad Wrote: You should be able to call more than one stored procedure, just by calling ->next_result(). I'm not sure if CI3 has ->next_result(), but if it doesn't you will need a hack:
PHP Code:
/*/system/database/drivers/mysqli/mysqli_result.php

This is the only system hack, and was necessary because CodeIgniter
does not currently allow more than one stored procedure to be run 
during the same request.

The following method was added to the CI_DB_mysqli_result class:*/


/**
 * Read the next result
 *
 * @return  null
 */
   
function next_result()
{
    if (is_object($this->conn_id))
    {
        return mysqli_next_result($this->conn_id);
    }
}

// -------------------------------------------------------------------- 

thanks! I'll give it a go and see what happens tonight...
OM...

-------------------------
And on the pedestal these words appear:
'My name is Ozymandias, king of kings:
Look on my works, ye Mighty, and despair!'
Nothing beside remains. Round the decay
Of that colossal wreck, boundless and bare
The lone and level sands stretch far away.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.