Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Request #6773 a small feature to list views from a given table as an optional parameter
Submitted: 2006-02-13 21:18 UTC
From: msaraujo Assigned: lsmith
Status: Closed Package: MDB2_Driver_pgsql (version CVS)
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    

 [2006-02-13 21:18 UTC] msaraujo
Description: ------------ I have added in listViews method, the parameter table as optional . It will return views from a specific table or views from the current database (if table is null). Class : MDB2_Driver_Manager_pgsql Method: listViews() Test script: --------------- --- pgsql_cvs.php 2006-02-13 19:21:39.000000000 -0200 +++ pgsql.php 2006-02-13 19:21:37.000000000 -0200 @@ -350,11 +350,12 @@ /** * list the views in the database - * + * + * @param string table (optional) * @return mixed MDB2_OK on success, a MDB2 error on failure * @access public **/ - function listViews() + function listViews($table = null) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { @@ -362,6 +363,9 @@ } $query = 'SELECT viewname FROM pg_views'; + if(!is_null($table)) { + $query .= " NATURAL JOIN pg_tables WHERE tablename = '{$table}'"; + } $result = $db->queryCol($query); if (PEAR::isError($result)) { return $result;


 [2006-03-17 08:22 UTC] lsmith
I am still not 100% sure if we should also support a $database parameter as well similar to listTables() in mysql.
 [2006-04-16 10:03 UTC] lsmith (Lukas Smith)
Ok, I have decided that the first parameter should be $database just like in listTables(). A second parameter could be $tables. I dont think its necessary to add listTableViews() since then we would still have to support the same parameters. Would be nice if you could adapt the patch.
 [2006-04-16 10:13 UTC] lsmith (Lukas Smith)
Actually looking at the API of the other listTable*() methods it does make sense to add this feature as a new method listTableViews() and only add $database support to listTables()
 [2006-04-18 17:16 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. I have implemented listTableViews()