Re: MySQL stored procedures OUT or INOUT parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



By using TUDBC (http://www.tudbc.org), you can call stored procedureseasily. Better yet, it works on any flavors of PHP (original,Phalanger, or Quercus). Even better, you would use the same style ofcoding for any DBMSes or programming languages. Have fun!
For an example in MySQL (just change the connection string for other DBMSes),
     TestSumOut(IN x int, IN y int, OUT total int)
The PHP codes (using EZ Style) are
$vault = new TUDBCConnectionVaultSingle("tudbc:mysqli://localhost//tudbcguest,helloworld/tudbcdemo");$conn = $vault->getConnection();$ezsql = $conn->getSQL_EZ(    "call TestSumOut(<*<?int:x>*>, <*<?int:y>*>, <*<??int:total>*>)",    "TestSumOutSprocSQL");$ezsql->getStatement()->parameterSetValues($x, $y);$result = $ezsql->getStatement()->executeUpdate();$total = $ezsql->getStatement()->sprocGetOutputParameter(2)->getInt();$ezsql->close();$conn->close();$vault->close();
You will find other examples in the demo codes on the website.
TUDBC

Below is the declaration of the example stored procedure
DELIMITER $$DROP PROCEDURE IF EXISTS TestSumOut` $$CREATE PROCEDURE `TestSumOut`(x int, y int, OUT total int )BEGIN	set total = x + y;END $$DELIMITER;

On 9/19/08, "Stanisław T. Findeisen" <stf@xxxxxxxxxxxxxxxxxxxxxxx> wrote:> Thodoris wrote:>> > I think that the manual is quite clear on this:> >> > http://dev.mysql.com/doc/refman/5.1/en/call.html> >> > You use a way to query the database like PDO or mysqli and you wite sql.> >>>  Yes, I've already found that multi-step way before... I was just wondering> if anything got better since with regard to this.>>  Apparently not.>>  STF>> =======================================================================>  http://eisenbits.homelinux.net/~stf/ . My PGP key> fingerprint is:>  9D25 3D89 75F1 DF1D F434  25D7 E87F A1B9 B80F 8062> =======================================================================>>  -->  PHP Database Mailing List (http://www.php.net/)>  To unsubscribe, visit: http://www.php.net/unsub.php>>

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux