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

Can I import 2.0 database into SQL subcategory?

Quote Reply
Can I import 2.0 database into SQL subcategory?
Can I import my links 2.0 database into a created subcategory in Links SQL using the Import.pl file. If so could someone please help me do this?

Thank You Very Much,

Mark Foster
Quote Reply
Re: Can I import 2.0 database into SQL subcategory? In reply to
Do you know perl?

You might have to try this a few times, to make it work, and I'm not going to attempt to preserve category relations.

In the first group of code where it says:

Code:
$values{'Name'} =~ tr/_/ /;

You want to add after that:
Code:
$values{'Name'} = "SubcategoryName/".$values{'Name'}

This will pre-pend the subcategory name to each of the various categories.

Then, you will lose the alt relations, and in the third group of code:

Code:
$values{'Category'} =~ tr/_/ /;
$values{'CategoryID'} = $CAT_IDS{$values{'Category'}};

You essentially want to do the same thing, which is pre-pend the subcategory to the category that was stored in the links.db record, then look up it's ID, since links SQL stores the category ID, not the name, in the record. (Look ups are much faster in SQL than with flat files).


Code:
$values{'Category'} =~ tr/_/ /;
$values{'Category'} = "SubcategoryName/". $values{'Category'} ;
$values{'CategoryID'} = $CAT_IDS{$values{'Category'}};

This is the idea, it might not work, and to prevent errors, you might want to define the subcategory at the top of the program, and use the variable instead of "SubcategoryName/" ... don't forget the "/' somewhere in the string.

This is not guaranteed to work ... Alex had at one point said something about assigning to arrays, but since it looks like all these arrays and hashes have been assigned to before, we can use them.

Let us know if it works, and what you did to make it work.




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