View Single Post
  #1 (permalink)  
Old 03-06-2008, 06:52 AM
Sach_in_webfarm Sach_in_webfarm is offline
Junior Member
 
Join Date: Mar 2008
Posts: 6
Question how to stored procedure using Mysqli or PDO successfully

Hi, All
I've been working with zend framework for couple of months.

Now what I did is When I run the SQL Query it runs fine with zend framework. But I stuck with problem mean while I’m going to execute the Stored Procedure in Zend framework, it doesn’t allow me. I’m using Zend_Db_Mysqli_Adapter and what I got is an error(s).I also tried to use the PDO adeapter but the problem is when I execute multiple stored procedure it says me something like “query should be buffered using PDO::MYSQL_ATTR_USE_BUFFERED_QUERY” even I set the following snippets in my boot-strap file(index.php).

=============================

$pdoParams = array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true);

//Load the config

$configArray = array(

'development' => true,

'database' => array(

'host' => 'localhost',

'port' => '',

'dbname' => 'mydb',

'username' => 'root',

'password' => '',

'driver_options' => $pdoParams,

'profiler' => Custom_Debug::check(Custom_Debug:B_PROFILE)

)

);

$config = new Zend_Config($configArray);

$registry->set('config', $config);

unset($configArray);



$db = Zend_Db::factory('pdo_mysql', $config->database->toArray()); // I also tried Mysqli

=============================



And to run the Store-procedure in my controller what I write is



$stmt=$this->dbObj->query("call sp1('param');");

$stmt->fetchAll();



This runs fine for PDO(for one sp). But then If I try to run another SP, it’s give me error.And for the Mysqli adapter it shows me error.



Little Help Appreciate to run the stored procedure in zend framework. I gave the millions of hit to the Google but I found nothing.Even there isn’t any example given in Zend manual documentation to run database stored procedure.



Thanks,
Reply With Quote