cvs: pearweb /include pear-database.php
| From: | Martin Jansen | Date: | Sun, 14 Sep 2003 08:01:59 +0000 |
| Subject: | cvs: pearweb /include pear-database.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-12709@lists.php.net to get a copy of this message | ||
mj Sun Sep 14 04:01:59 2003 EDT
Modified files:
/pearweb/include pear-database.php
Log:
* Adding category::isValid() and package::isValid()
Index: pearweb/include/pear-database.php
diff -u pearweb/include/pear-database.php:1.138 pearweb/include/pear-database.php:1.139
--- pearweb/include/pear-database.php:1.138 Fri Sep 12 08:43:14 2003
+++ pearweb/include/pear-database.php Sun Sep 14 04:01:58 2003
@@ -17,7 +17,7 @@
| Tomas V.V.Cox <cox@php.net> |
| Martin Jansen <mj@php.net> |
+----------------------------------------------------------------------+
- $Id: pear-database.php,v 1.138 2003/09/12 12:43:14 mj Exp $
+ $Id: pear-database.php,v 1.139 2003/09/14 08:01:58 mj Exp $
*/
require_once 'DB/storage.php';
@@ -285,6 +285,24 @@
}
// }}}
+ // {{{ *proto bool category::isValid(string)
+
+ /**
+ * Determines if the given category is valid
+ *
+ * @access public
+ * @param string Name of the category
+ * @return boolean
+ */
+ function isValid($category)
+ {
+ global $dbh;
+ $query = "SELECT id FROM categories WHERE name = ?";
+ $sth = $dbh->query($query, array($category));
+ return ($sth->numRows() > 0);
+ }
+
+ // }}}
}
/**
@@ -740,6 +758,24 @@
$recent[] = $row;
}
return $recent;
+ }
+
+ // }}}
+ // {{{ *proto bool package::isValid(string)
+
+ /**
+ * Determines if the given package is valid
+ *
+ * @access public
+ * @param string Name of the package
+ * @return boolean
+ */
+ function isValid($package)
+ {
+ global $dbh;
+ $query = "SELECT id FROM packages WHERE name = ?";
+ $sth = $dbh->query($query, array($package));
+ return ($sth->numRows() > 0);
}
// }}}