Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Delete All in category

Quote Reply
Delete All in category
I just did a huge odp import and I was wondering how you can completely wipe out a category with all links and subcategories?
Quote Reply
Re: Delete All in category In reply to
This is probably best done in the SQL monitor with a command such as:

DELETE FROM Links where CategoryID=nn

And you can do a delete in the Categories table something like:

DELETE FROM Categories where Name RLIKE '^category_name/'

That should get rid of all the subcategories that begin with that top-level category.

You'll probably have to delete the top-level category youself, since it doesn't have the trailing '\'

You might want to try this on a test database before doing it for real....

You can also look in the FAQ for some hints and tips on the 'delete' commands, since this has come up before.



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Delete All in category In reply to
Is it preferable to empty the tables that way vs. using phpMyAdmin? Any advantage or disadvantage one way or the other?

Dan
Quote Reply
Re: Delete All in category In reply to
It gives me this error when I use the Category SQL Monitor. Query Error: Table 'links.Categories' doesn't exist

I've successfuly deleted the links in the categories by using the range id technique..

Does anyone know of a good "learning sql resource" ?
Quote Reply
Re: Delete All in category In reply to
There is only one MySQL book -- check the FAQ for the specifics .. it's in the PERL reference section.

SQL is a very, very broad thing, but this book gives you just about all you need to know to do what you have to do with Links.

Emptying the tables any way you want doesn't affect Links -- as long as you re-index and re-build once you do.

You can then check the lost links features of the Admin area to make sure you didn't lose anything.

The category table is "Category" ... I don't know why I typed Categories.... So, Links.Category should work.

You can always check the DEFS directory for a summary of what is going on in the MySQL database.... That gives a list of the tables Links uses, as well as the definitions Links is using for those tables.

NOTE: I said the "definitions Links is using for those tables." If you've made changes to the database outside of Links, the .def files might not really be what the database looks like..... That's the reason for resync (but resync loses all the weights and other defaults you've changed).



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/