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

Import.pl compresses unused ID#'s

Quote Reply
Import.pl compresses unused ID#'s
When you run Import.pl to import a Links 2 database into Links SQL, it automatically removes the unused ID numbers and effectively renumbers the database. At first I thought this was nice; compress unneeded "space." Then it occured to me that I'll have a bit of a problem with that...

I have a list of around 200 hard coded links using the jump.cgi?id=x method. The reason why I have that isn't too important, but I figured it would be much more likely for their URL's to change than it would be their Links ID #'s... Oops. Frown

So, is there any way to tell Import.pl not to remove the blanks? I only have ~150 unused ID #'s scattered throughout my database (haven't been able to run more than about 10% of a verify to look for dead links Wink ), so compression isn't currently of much need to me.

Oh yeah, for those of you that are more of a newbie to Links SQL than I, as Alex pointed out to me in an email, the instructions for Import.pl are inside the script. I went ahead and ran it throught telnet without knowing to direct output to an error file, although I did log the process...

Thanks,
Dan

p.s. pugdog, I'll get a new sig set up per your request. For now, my Links SQL temp setup is at http://run-down.com/links/ and my Links 2 (which will become the location for the SQL when it's ready) is at http://run-down.com/ .
Quote Reply
Re: Import.pl compresses unused ID#'s In reply to
Hi,

Check the FAQ awhile back -- mid Jan I think, on using the "load" and "insert" commands. Directly import your links.db.

It has problems, though, I think, on organization -- ie: category, but there might have been a solution posted for doing it.

I can think of a few ways to change the Import.pl -- such as add a database field to the Links table called "Old_ID" and in the Import.pl file, assign the ID field to that field, before passing it to DBSQL.pm to insert. DBSQL.pm will assign a new ID, but you'll have stored the old one in the Old_ID field.

Once you do that, you could run an UPDATE/SET on the database to assign the Old_ID to the ID field. You'd need to do that in reverse order, or update the ID beyond the old high value -- such that if your old highest link was 5000, add 5000 to the ID of every new link, then run the UPDATE/SET to fill in the lower values.


Does this make sense?? I'm beat, so if it doesn't, I'll try to clarify or come up with the insert code for Import.pl tomorrow.



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








Quote Reply
Re: Import.pl compresses unused ID#'s In reply to
I believe this is the thread you're talking about:
http://www.gossamer-threads.com/...um9/HTML/000551.html
I must say, I feel a bit silly now. That was one of the first FAQ links I checked out before trying to import, but it didn't appear to answer what I was looking for so I didn't read it in much detail or commit it to the ol' memory banks.

I understand what you're talking about in this thread and the other, but I'll have to read through them a few more times before feeling comfortable enough to proceed.

If nothing else, importing and exporting would probably be good practice while the database is not in use. Smile

Thanks,
Dan
Quote Reply
Re: Import.pl compresses unused ID#'s In reply to
Set up a dummy table, and use that -- or if you have full access to your MySQL server, set up a completely new database --

The easiest way is to go to your /mysql/data directory as root, and just

cp /mysql/data/Links /mysql/data/Links_test

When you query mysql again, you will see the new Links_test database, and it will be identical to the Links. You can then delete all the existing lilnks, and play with it.

_really_ if you have access to PHP, setting up myPHPAdmin makes life easy. It's the "secret" to a lot of the stuff you can do with the database -- what it does, is put a web-based interface on all the mysql commands, and even makes a few of them _MUCH_ easier. But, without it, you can use the SQL Monitor in Links Admin, but you don't get the point/click and easy display features of the PHPAdmin program. You can find links to it from mysql.org and the php.org sites.



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








Quote Reply
Re: Import.pl compresses unused ID#'s In reply to
Thanks, I'll give that a try.

I had seen you mention in several places how nice the PHPadmin is, and I wondered where one could find it... I don't believe its location is listed in the FAQ.

Following along from MySQL.org, here is the site with the latest download:

http://www.htmlwizard.net/phpMyAdmin/

I assume myPHPAdmin and phpMyAdmin are the same thing?

Thanks,
Dan
Quote Reply
Re: Import.pl compresses unused ID#'s In reply to
Hello!

Check this out!

http://www.phpwizard.net/phpMyAdmin/

Hope this helps.
Quote Reply
Re: Import.pl compresses unused ID#'s In reply to
Is there an echo in here? Wink Same site.

Dan
Quote Reply
Re: Import.pl compresses unused ID#'s In reply to
 
Quote:
I had seen you mention in several places how nice the PHPadmin is, and I wondered where one could find it... I don't believe its location is listed in the FAQ.

It is now!

(Small oversight... didn't think to include the external resources, but they'll be added in the next go around... I've been up past my eyeballs in work, and just have not had the time to do much... 2 weeks of being "down" with the bug set me way behind...)



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








Quote Reply
Re: Import.pl compresses unused ID#'s In reply to
Don't worry, I fully appreciate your efforts to keep the FAQ up-to-date. Keeping yourself healthy is the best way to avoid falling behind ever further, so don't make yourself ill trying to stay on top of the FAQ on my behalf. Smile

Cheers,
Dan