Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Duplicates in CatLinks

Quote Reply
Duplicates in CatLinks
hello

When you import your links & catlinkss from a dump, manually created by an editor or affiliate, it could happen that he/she entered duplicate CatLinks entries like:

INSERT INTO CatLinks VALUES('40','11');
INSERT INTO CatLinks VALUES('40','11');


Link with ID 40 are listed twice in category with ID 11

seen an example of this at:
http://www.ridesworld.com/cgi-bin/ridesworld/page.cgi?g=1%2F11%2Findex.html&t=links&d=1

Is there a solution to avoid this?
I get this severalk times after an import, & it's lot of work to check the entries.
Quote Reply
Re: [ridesworld] Duplicates in CatLinks In reply to
You may change in you database the LinkID properties in table lsql_CatLinks.
If you set it as UNIQUE, it should only add 1 entry for each link, and may report an error, if dupe found at import.

Not sure if is works, but give it a try on a test database.
This should be the easiest solution, without the need to write a script...

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: May 2, 2003, 8:25 AM
Quote Reply
Re: [webmaster33] Duplicates in CatLinks In reply to
Hello webmaster33

Your suggestion could be worth, but I realize one thing:

when i set in CatLinks the LinkID and/or CategoryID to unique, you can add a link only in one category.

example:


INSERT INTO CatLinks VALUES('8','464');
INSERT INTO CatLinks VALUES('8','364');
INSERT INTO CatLinks VALUES('12,'464');

would not work, I have LinkID 8 twice & CategoryID 464 twice, but both different entries.

only this should be disabled, example:

INSERT INTO CatLinks VALUES('8','464');
INSERT INTO CatLinks VALUES('8','464');

Now I'm just playing around with the duplicate check in Tools.pm & try to create a code block (sub) to usein build.cgi?do=repair
Quote Reply
Re: [ridesworld] Duplicates in CatLinks In reply to
Quote:
set in CatLinks the LinkID and/or CategoryID to unique
The 'and/or' approach is wrong. Only LinkID may be set unique.

If you set the unique for LinkID temporarily, then do the import, and disable unique again, so you can use LSQL as usual again. I suggested it as quick solution. If it doesn't fit, check below.

Further solutions:
- pre-import solution: an easy script should be done to check the .sql file for duplicate entries
- post-import solution: dupe checking with a plugin or script. BTW: Andy has a dupe checking plugin. You may contact him. He could tell more about the plugin.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...