Add this code to your Import.pl file to automatically import the Alternate Categories data into Links SQL when importing your Links 2.0 database:
In the section:
# INSERT Links.
starting at approximately line 96 you'll see:
$@ and print "Fatal: $@\n$.: @values\n" and next;
$res or print "Error: $Links: BSQL::error\n$.: @values\n" and next;
Right after the code above on about line 99 replace this:
}
close DB;
with this:
}
close DB;
# INSERT Alternate Categories.
foreach $link_id (keys %ALT_CAT) {
@altcategories = split /\|/, $ALT_CAT{$link_id};
foreach $altcat (@altcategories) {
$altcat =~ tr/_/ /;
$altcat_id = $CAT_IDS{$altcat};
$altcat_id or print "Error: can't find category id for '$altcat'\n" and next;
$res = $db->do ("INSERT INTO CategoryAlternates VALUES ($altcat_id, $link_id)");
$res or print "Error inserting Alternate Category ($link_id) => $altcat\n";
}
}
All of your AltCategories from Links 2.0 will be imported into the CategoryAlternates table. The only problem you could have would be if your Alternate Categories field in Links 2.0 was called something other than 'AltCategories'. If that's the case just change 'AltCategories' in the first line of the replacement code to:
'thenameofthealternatecategoriesfieldinyourdatabase'
Brent
In the section:
# INSERT Links.
starting at approximately line 96 you'll see:
Code:
eval { $res = $db->add_record (\%values); }; $@ and print "Fatal: $@\n$.: @values\n" and next;
$res or print "Error: $Links: BSQL::error\n$.: @values\n" and next;
Right after the code above on about line 99 replace this:
}
close DB;
with this:
Code:
$ALT_CAT{$res} = $values{'AltCategories'}; }
close DB;
# INSERT Alternate Categories.
foreach $link_id (keys %ALT_CAT) {
@altcategories = split /\|/, $ALT_CAT{$link_id};
foreach $altcat (@altcategories) {
$altcat =~ tr/_/ /;
$altcat_id = $CAT_IDS{$altcat};
$altcat_id or print "Error: can't find category id for '$altcat'\n" and next;
$res = $db->do ("INSERT INTO CategoryAlternates VALUES ($altcat_id, $link_id)");
$res or print "Error inserting Alternate Category ($link_id) => $altcat\n";
}
}
All of your AltCategories from Links 2.0 will be imported into the CategoryAlternates table. The only problem you could have would be if your Alternate Categories field in Links 2.0 was called something other than 'AltCategories'. If that's the case just change 'AltCategories' in the first line of the replacement code to:
'thenameofthealternatecategoriesfieldinyourdatabase'
Brent