cvs: pear /MDB2/tests MDB2_nonstandard.php MDB2_nonstandard_ibase.php

From: Date: Sun, 04 Mar 2007 21:26:52 +0000
Subject: cvs: pear /MDB2/tests MDB2_nonstandard.php MDB2_nonstandard_ibase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44954@lists.php.net to get a copy of this message
quipo Sun Mar 4 21:26:52 2007 UTC Modified files: /pear/MDB2/tests MDB2_nonstandard.php MDB2_nonstandard_ibase.php Log: added createFunction() and dropFunction() http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_nonstandard.php?r1=1.4&r2=1.5&diff_format=u Index: pear/MDB2/tests/MDB2_nonstandard.php diff -u pear/MDB2/tests/MDB2_nonstandard.php:1.4 pear/MDB2/tests/MDB2_nonstandard.php:1.5 --- pear/MDB2/tests/MDB2_nonstandard.php:1.4 Tue Dec 19 22:47:46 2006 +++ pear/MDB2/tests/MDB2_nonstandard.php Sun Mar 4 21:26:52 2007 @@ -2,7 +2,7 @@ // +----------------------------------------------------------------------+ // | PHP versions 4 and 5 | // +----------------------------------------------------------------------+ -// | Copyright (c) 2006 Lorenzo Alberton | +// | Copyright (c) 2006-2007 Lorenzo Alberton | // | All rights reserved. | // +----------------------------------------------------------------------+ // | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB | @@ -41,7 +41,7 @@ // | Author: Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_nonstandard.php,v 1.4 2006/12/19 22:47:46 quipo Exp $ +// $Id: MDB2_nonstandard.php,v 1.5 2007/03/04 21:26:52 quipo Exp $ class MDB2_nonstandard { //contains the MDB2 object of the db once we have connected @@ -111,5 +111,20 @@ function dropView($view_name) { return $this->db->exec('DROP VIEW '.$view_name); } + + /** + * Create a FUNCTION + */ + function createFunction($name) { + return $this->db->raiseError(MDB2_ERROR_NOT_CAPABLE, null, null, + 'not capable', __FUNCTION__); + } + + /** + * Drop a FUNCTION + */ + function dropFunction($name) { + return $this->db->exec('DROP FUNCTION '.$name); + } } ?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_nonstandard_ibase.php?r1=1.3&r2=1.4&diff_format=u Index: pear/MDB2/tests/MDB2_nonstandard_ibase.php diff -u pear/MDB2/tests/MDB2_nonstandard_ibase.php:1.3 pear/MDB2/tests/MDB2_nonstandard_ibase.php:1.4 --- pear/MDB2/tests/MDB2_nonstandard_ibase.php:1.3 Sat Dec 9 21:58:23 2006 +++ pear/MDB2/tests/MDB2_nonstandard_ibase.php Sun Mar 4 21:26:52 2007 @@ -2,7 +2,7 @@ // +----------------------------------------------------------------------+ // | PHP versions 4 and 5 | // +----------------------------------------------------------------------+ -// | Copyright (c) 2006 Lorenzo Alberton | +// | Copyright (c) 2006-2007 Lorenzo Alberton | // | All rights reserved. | // +----------------------------------------------------------------------+ // | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB | @@ -41,7 +41,7 @@ // | Author: Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_nonstandard_ibase.php,v 1.3 2006/12/09 21:58:23 quipo Exp $ +// $Id: MDB2_nonstandard_ibase.php,v 1.4 2007/03/04 21:26:52 quipo Exp $ class MDB2_nonstandard_ibase extends MDB2_nonstandard { @@ -64,6 +64,35 @@ function dropTrigger($trigger_name, $table_name) { return $this->db->exec('DROP TRIGGER '.$trigger_name); } + + function createFunction($name) { + echo $query = 'CREATE PROCEDURE '.$name.'(N1 DECIMAL(6,2), N2 DECIMAL(6,2)) +RETURNS ( + res DECIMAL(6,2) +) +AS +BEGIN + FOR + SELECT (:N1 + :N2) FROM RDB$DATABASE INTO :res + DO + BEGIN + SUSPEND; + END +END'; +/* +RETURNS Decimal(6,2) +BEGIN + DECLARE @Result Decimal(6,2) + SET @Result = @Number1 + @Number2 + RETURN @Result +END +*/ + return $this->db->exec($query); + } + + function dropFunction($name) { + return $this->db->exec('DROP PROCEDURE '.$name); + } } ?> \ No newline at end of file

« previous php.pear.cvs (#44954) next »