Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Combining DMOZ and existing data...

Quote Reply
Combining DMOZ and existing data...
Hi,

I'm trying to combine DMOZ data with data already existing in my database, however the dmoz links/categories have the same ID's as the existing links/categories. Is there an easy way to go about combining the two without conflicts?

I have tried this:

UPDATE CatLinks SET LinkID=LinkID+9000;

This successfully updated the ID's so they didn't conflict with the dmoz ID's but when I try:

UPDATE Links SET ID=ID+9000;

and

UPDATE Category SET ID=ID+9000;

...I get the following error:

ERROR 1062: Duplicate entry '9001' for key 1

I know I'm missing something simple but I don't get why it works for CatLinks but not Links and Category. Is this re-numbering even necessary?





Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: Combining DMOZ and existing data... In reply to
Anyone Frown?

Joke
$_ = 'uyodrasdskucs'; $i = 0; while ($i++ < 11) { s/(.{2})(.)/$2$1/g; } print $_;

Quote Reply
Re: Combining DMOZ and existing data... In reply to
It's not really clear what you are doing.

But, if you are trying to add 9000 to your ID's, make sure none ofyour ID's are already over 9000

Manipulating the primary keys of a table is not really good form.

If you are using the SQL monitor in Links, you might be hitting a foreign key problem, try doing it in MySQLMan instead.

I actually thought the dmoz import system appended new links, and decided if a link was in the database by url, not ID.....

PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Combining DMOZ and existing data... In reply to
Hi,

Thanks for the reply...

What I am trying to do is add DMOZ data to my Links SQL database that already has a few thousand links in it. But it seems that the ID's for the dmoz data clash with the ID's of the existing data. For example...the first link I added to my database has ID 1, but the first link in the dmoz data I want to import has ID 1 also. I am not importing using nph-import.cgi - it is being imported from a dump. Do you think if I import the dump it will overwrite the existing data with the same ID?

Joke
$_ = 'uyodrasdskucs'; $i = 0; while ($i++ < 11) { s/(.{2})(.)/$2$1/g; } print $_;

Quote Reply
Re: Combining DMOZ and existing data... In reply to
If you have a dump, to import, the easiest thing to do is not import the ID number, and let Links assign a new one.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Combining DMOZ and existing data... In reply to
How would I go about doing that? Without the ID I mean?

I didn't realise that Links would assign a new one - how does it do that, when repairing tables?

Thanks again...

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/

Quote Reply
Re: Combining DMOZ and existing data... In reply to
If a field is "autoincrement" you can leave it blank, and links will assign the next available ID to it.

I imported a fairly large dump, and rather than writing a program, I just put the dump into a text editor, made a macro, and got rid of the first field's value.

If each field is _NAMED_ on import, just remove any reference to the "ID" field, and links will fill it in.

If the fields are imported positionally, you can use a null value, (or even 0, I believe) to generate the next value.

If you are doing this via a query, you use an * which is why you'll see that scattered around links. That is a place-holder value that uses the "default" for that field, but keeps the other fields in order on an un-named insert.

PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Combining DMOZ and existing data... In reply to
So if I put the data back into a temporary databse and then did:

UPDATE Links SET ID=null;

..to make all ID's 0 and then re-dump the data to a file and then re-import it into the correct database? In theory should that then allow Links to add the necessary ID's?

Thanks again for your help. I'm not so good with mysql.

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/

Quote Reply
Re: Combining DMOZ and existing data... In reply to
Just curious to know if this actually worked, I will be doing a similar update soon... except, I will be adding data from a 1.13 LinkSQL into a LinkSQL 2.04 version... I assume the tables are set up the same???

Quote Reply
Re: Combining DMOZ and existing data... In reply to
Hi, you can import data from Links SQL 1.13 to Links SQL 2 straight from the admin panel - it is all automatic.

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/

Quote Reply
Re: Combining DMOZ and existing data... In reply to
The question is, I have to dump my old data, and re-import it into the Links2.04 before deleting the old database/files. Will 2.04 assign pick up where it left off or will I have double keys from both 2.04 and 1.13???