2008年7月30日星期三

Re: [fw-db] Oracle cursors returned from stored procedures

This is how I call a oracle procedure using PDO



$this->db->beginTransaction();   
                                  
        $stmt = $this->db->prepare("begin api.register_user(:email,:password,:firstname,:lastname,:phone,:job,:company,:authcode,:ipaddr,:role,:skip,:output); end;");                                                                                                                
        $stmt->bindParam(':email', $email,PDO::PARAM_STR);
        $stmt->bindParam(':password', $password, PDO::PARAM_STR);
        $stmt->bindParam(':firstname', $firstname, PDO::PARAM_STR);
        $stmt->bindParam(':lastname', $lastname, PDO::PARAM_STR);
        $stmt->bindParam(':phone', $phone, PDO::PARAM_STR);
        $stmt->bindParam(':job', $job, PDO::PARAM_STR);
        $stmt->bindParam(':company',$company,PDO::PARAM_STR);
        $stmt->bindParam(':authcode',$authcode,PDO::PARAM_STR);
        $stmt->bindParam(':ipaddr',$userip,PDO::PARAM_STR);
        $stmt->bindParam(':role',$role,PDO::PARAM_STR);
        $stmt->bindParam(':skip',$skip,PDO::PARAM_STR);
        $stmt->bindParam(':output', $output, PDO::PARAM_STR,200);                     
        $stmt->execute();                                                                                                                                                       
        $this->db->commit();




On Wed, Jul 30, 2008 at 11:50 AM, Bill Karwin <bill@karwin.com> wrote:



tr0gd0rr wrote:
>
> Has anyone worked with Oracle stored procedures that return result sets?
>

When I worked on Zend_Db, I never got around to supporting stored
procedures.

So you may have to use Zend_Db for the simple stuff, and access the
underlying connection object for calling procedures.  Call
$db->getConnection() to return the connection object, which is either of
type PDO or OCI8, depending on which Zend_Db adapter you're using.

That's all the advice I can offer on this subject.  Good luck.

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/Oracle-cursors-returned-from-stored-procedures-tp18634078p18737722.html
Sent from the Zend DB mailing list archive at Nabble.com.


没有评论: