Re: Category question
| From: | Davey | Date: | Sun, 18 May 2003 11:57:22 +0000 |
| Subject: | Re: Category question | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16439@lists.php.net to get a copy of this message | ||
I just noticed this in the source for pearweb (pear-database.php)
$sql = "UPDATE categories SET npackages = npackages + 1
WHERE id = $category";Seems to me theres already a categories table, I wonder if, rather than adding another table, we can change that one? it seems that the existing table is only used for counting how many packages are in any given category... wouldn't doing something like having the table below (gregs mail) and then just doing a: SELECT COUNT(pacid) WHERE catid='$category'; to get the amount of packages per category? Seems like the most efficient way to do this... - Davey Greg Beaver wrote:
Hi, a categorypackagelink table can be created which has two fields, the package id and the category id as a primary key, i.e. CREATE TABLE packagecategorylink ( catid UNSIGNED INT(11) NOT NULL, pacid UNSIGNED INT(11) NOT NULL, primary key (catid, pacid) ); Highly flexible solution, and is still pretty easy to use. Greg Xavier Noguer wrote:BIG +1 Although this makes me think PEAR's data model will have to change: $query = "INSERT INTO packages (id,name,category,license,summary,description,homepage) VALUES(?,?,?,?,?,?,?)"; It assumes packages belong to just one category. --------- Original Message -------- From: Greg Beaver <greg@chiaraquartet.net> To: pear-dev@lists.php.net <pear-dev@lists.php.net> Subject: [PEAR-DEV] Category question Date: 18/05/03 00:03Hi, I'd like to open a can of worms for future discussion :). When I'm trying to find a package, it is often difficult to figure out exactly which category it belongs in. Why not allow packages to fall into more than one category? For instance, the Tree class would logically be placed into Structures, DB, and XML since it is all three.link (likeI would really like to see PEAR become more user-friendly, andthis is definitely a way to do that. Perhaps documentation could also be generated in those categories as in: Tree docs are under Structures, and a "See Structures::Tree"the Yellow Pages under Cab says "See Taxi") is in XML and DBdocs for Tree.This would certainly cut down on the questions "is this inPEAR?" sincethings would be filed under the multiple categories they belong in. Most packages probably fit into one category, but this would also satisfy ambiguities like template engines, which really should be categorized under both HTML and Templates, for example. This would also allow placing core packages under their respective categories, and under core (or PFC or whatever it will be called). Greg -- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php