adodb PrepareSP calling SP in mysql problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

adodb PrepareSP calling SP in mysql problem

Post by yacahuma »

Hello,


This problem is specific to adodb library. I've called stored procedures from oracle without problems. Now I am using a mysql stored procedure. It seems my syntax is wrong.

The stored procedure
create_order_from_basket(
IN P_customer_id INT,
OUT P_order_id INT,
OUT P_out_status CHAR(1),
OUT P_out_status_code VARCHAR(32))

The code

Code: Select all

 
  //tried this
  $stmt = $this->cn->PrepareSP('call create_order_from_basket '); 
 
  //and this (option2)
  $stmt = $this->cn->PrepareSP(' create_order_from_basket '); 
 
  //and this
  $stmt = $this->cn->PrepareSP(' create_order_from_basket ((:P_customer_id,:P_order_id,:P_out_status,:P_out_status_code)) '); 
 
     $this->cn->InParameter($stmt,$customer_id,'P_customer_id');
     $this->cn->OutParameter($stmt,$P_order_id,'P_order_id');
     $this->cn->OutParameter($stmt,$P_out_status,'P_out_status');
     $this->cn->OutParameter($stmt,$P_out_status_code,'P_out_status_code');
 
none of the option above seems to work. Sometimes i get sql syntax error. In option 2 I get an error saying the the procedure is expecting 4 parameters and zero are sent.


Any ideas?


Thank you
ederrafo
Forum Newbie
Posts: 1
Joined: Thu Jan 26, 2012 5:22 pm

Re: adodb PrepareSP calling SP in mysql problem

Post by ederrafo »

hello.
that code is valid when using Oracle but not with mysql.
I do so
//$stmt = "CALL sp_epe_ContrastChain('1,2,3',@ProductCode)";
//$rsstmt = "select @ProductCode AS label";
//$rs = $db->Execute($stmt);
//$rsstmt = $db->Execute($rsstmt);
//$dato = $rsstmt->GetRows();
if you, did you find a function that makes adodb, let me know please
Post Reply