Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Can I rebuild the Full_Name field?

Quote Reply
Can I rebuild the Full_Name field?
I've done a lot of manual editing within the Category table, to change the spelling of hundreds of categories. I haven't changed any other fields - just Name. This had to be done outside of Links SQL via some custom PHP programs.

I've now realised that the Full_Name field is out of date because it still contains references to the old data!

Is there a way of automatically rebuilding the Full_Name field to fix this? It will take me days to type everything by hand!

I must say, I'm a little disappointed that Links SQL sees a need to maintain a Full_Name field when the information can be derived from the rest of the database. Duplicating information like this is slightly against the rules of good database design.
Quote Reply
Re: [RobSchifreen] Can I rebuild the Full_Name field? In reply to
>> Duplicating information like this is slightly against the rules of good database design.

Agreed, but it's a performance thing, like the .def files. Since it _can_ be reconstructed, and it's simply a representation of a node's location, it's not a "haunting" problem -- unless you try to edit the stuff manually ;) It's a *much* simpler and less resource intensive solution than trying to store a b-tree or n-tree representation of the database for node look up -- especially with thousands of categories.

I've wanted a category rebuild function like that, for just these reasons.

Maybe Andy can work one up -- ugly even -- since he's just spent a lot of time redoing the category routines in some of his plugins :)

A category stores it's "FatherID" (parent) node information, so it can go backwards. *BUT* there is no mechanism for going forward ;) You need to search the database and do a select to find out potential down-stream links.

Anyway, I agree; it's a necessary evil at the moment; maybe Andy can solve the problem ;)


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [RobSchifreen] Can I rebuild the Full_Name field? In reply to
So you would be looking at something that would go through the whole lsql_Category table, and then from that, regenerate the Full_Name field for all the categories? I'm not sure how easy that will be to do... but I'll give anything a go.

Its a bank holiday over here tomorrow, but I'll still be working. I have a couple of other jobs that I need to get done first, and then get the documentation done for Ace_PPC (v2); but after that, I may find some time to take a look at it :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [RobSchifreen] Can I rebuild the Full_Name field? In reply to
Thanks Andy - that would be great! I spent some time looking at the idea today, and I guess it's not terribly difficult to do if you know what you're doing (which I don't, really!).

For each record in the Category table you go backwards up the tree, building Full_Name from the Name field and then going up to the record with an id of the current record's FatherID. When FatherID is zero, you're at the top of the tree so you write the new Full_Name into the record and move onto the next one.

At least, that's how I'd do it. What confuses me is whether you also need to escape or delimit certain "illegal" characters which might appear in category names but which aren't allowed in Full_Name for some reason.

For what it's worth, this is a feature that I think should be part of the Rebuild Database command, as it's something which can't otherwise be handled by admins. And it would make it much easier for people to mess with the category table outside of Links SQL, such as importing category names or descriptions.


Rob


PS: While you're at it over the weekend, Andy, how about amending the template editor dropdown so that I can choose to see only those templates which I have already edited? As things stand, the list is huge, especially if I have a couple of plugins loaded too. Yet I tend to spend 99% of my time editing just a handful of templates.

Oh, and one more wishlist item while I think of it: The browser tree for editing categories and links. It would be nice if the currently selected entry on the tree could be in bold type, or a different colour, so it's obvious where I need to scroll to each time the tree redraws itself. Pleeeease???

PS/2: Brilliant bit of software. I'm working on a system which is hopefully going to be rolled out to 24,000 students at a university in the UK shortly.

:)
Quote Reply
Re: [RobSchifreen] Can I rebuild the Full_Name field? In reply to
Quote:
Thanks Andy - that would be great! I spent some time looking at the idea today, and I guess it's not terribly difficult to do if you know what you're doing (which I don't, really!).

LOL.. I wish Wink

Quote:
For each record in the Category table you go backwards up the tree, building Full_Name from the Name field and then going up to the record with an id of the current record's FatherID. When FatherID is zero, you're at the top of the tree so you write the new Full_Name into the record and move onto the next one.

Yeah, thats along the right lines, although I don't think it will be that easy. Remember, you need to take into account the amount of memory that will be required, so using a 'while' loop would be better, especially if a site has a lot of categories.

Quote:
PS: While you're at it over the weekend, Andy, how about amending the template editor dropdown so that I can choose to see only those templates which I have already edited? As things stand, the list is huge, especially if I have a couple of plugins loaded too. Yet I tend to spend 99% of my time editing just a handful of templates.

Oh, and one more wishlist item while I think of it: The browser tree for editing categories and links. It would be nice if the currently selected entry on the tree could be in bold type, or a different colour, so it's obvious where I need to scroll to each time the tree redraws itself. Pleeeease???

LOL.. I don't work for GT Wink

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [RobSchifreen] Can I rebuild the Full_Name field? In reply to
Mate.. this is gonna take longer than I was expecting :(

I've been working on this since 9am, and its almost 11am now.... my hear is hurting Pirate

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [RobSchifreen] Can I rebuild the Full_Name field? In reply to
Done Smile

This has to be one of the most horrible plugins I have ever had to write ... lol.

The price is $35 (believe it or not, its taken longer to write than the MyFaves plugin!). If you would like to get hold of a copy before I add it to the online shop, please PM me, and I'll get a copy sent over.

Quote:
I must say, I'm a little disappointed that Links SQL sees a need to maintain a Full_Name field when the information can be derived from the rest of the database. Duplicating information like this is slightly against the rules of good database design.

If you look into it a bit deeper, you will find that its a good idea (GT know their stuff about database management/organization).

Think about it. Someone calls /page.cgi?g=/home/test/cat

... now, if we didn't have Full_Name, then how would you grab the appropriate category details with just the one 'select' statement? This is how LSQL does it currently (using Full_Name);

SELECT * FROM prefix_Category WHERE Full_Name = '/home/test/cat'

Trust me, if you had to write the plugin that I just did, you would feel grateful they have it working the way they do Wink The way my plugin works, you are limited to 7 sub-category folders (can be changed to a higher number if required)... with the system GT have put into LinksSQL, you can have *unlimited* sub-category depths Wink

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Can I rebuild the Full_Name field? In reply to
Thanks Andy! I wasn't aware you were going to charge for this, though, so I'll have to check next week whether I can get my employers to pay the $35. Otherwise I'll have to reinvent your wheel!

For what it's worth, I still don't like the idea of the full_name field. Yes, I can see why it's done that way. But at the very least, the Build All feature should rebuild this field automatically if it needs fixing.