cvs: pear /MDB2/MDB2/Driver/Manager mssql.php
| From: | Lorenzo Alberton | Date: | Sun, 04 Mar 2007 22:38:37 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Manager mssql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44961@lists.php.net to get a copy of this message | ||
quipo Sun Mar 4 22:38:37 2007 UTC
Modified files:
/pear/MDB2/MDB2/Driver/Manager mssql.php
Log:
implemented listFunctions()
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Manager/mssql.php?r1=1.84&r2=1.85&diff_format=u
Index: pear/MDB2/MDB2/Driver/Manager/mssql.php
diff -u pear/MDB2/MDB2/Driver/Manager/mssql.php:1.84 pear/MDB2/MDB2/Driver/Manager/mssql.php:1.85
--- pear/MDB2/MDB2/Driver/Manager/mssql.php:1.84 Sun Mar 4 20:00:22 2007
+++ pear/MDB2/MDB2/Driver/Manager/mssql.php Sun Mar 4 22:38:37 2007
@@ -44,7 +44,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
-// $Id: mssql.php,v 1.84 2007/03/04 20:00:22 quipo Exp $
+// $Id: mssql.php,v 1.85 2007/03/04 22:38:37 quipo Exp $
//
require_once 'MDB2/Driver/Manager/Common.php';
@@ -373,6 +373,42 @@
}
// }}}
+ // {{{ listFunctions()
+
+ /**
+ * list all functions in the current database
+ *
+ * @return mixed array of function names on success, a MDB2 error on failure
+ * @access public
+ */
+ function listFunctions()
+ {
+ $db =& $this->getDBInstance();
+ if (PEAR::isError($db)) {
+ return $db;
+ }
+
+ $query = "SELECT name
+ FROM sysobjects
+ WHERE objectproperty(id, N'IsMSShipped') = 0
+ AND (objectproperty(id, N'IsTableFunction') = 1
+ OR objectproperty(id, N'IsScalarFunction') = 1)";
+ /*
+ SELECT ROUTINE_NAME
+ FROM INFORMATION_SCHEMA.ROUTINES
+ WHERE ROUTINE_TYPE = 'FUNCTION'
+ */
+ $result = $db->queryCol($query);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
+ $result = array_map(($db->options['field_case'] == CASE_LOWER ?
'strtolower' : 'strtoupper'), $result);
+ }
+ return $result;
+ }
+
+ // }}}
// {{{ listTableTriggers()
/**
@@ -432,6 +468,12 @@
$query = "SELECT name
FROM sysobjects
WHERE xtype = 'V'";
+ /*
+ SELECT *
+ FROM sysobjects
+ WHERE objectproperty(id, N'IsMSShipped') = 0
+ AND objectproperty(id, N'IsView') = 1
+ */
$result = $db->queryCol($query);
if (PEAR::isError($result)) {