Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to import old Links2.0 ID in Links SQL

Quote Reply
How to import old Links2.0 ID in Links SQL
Hi, I have some questinons about the import (L2S2.pm)

I want to import my Links 2.0 Database (links.db) to LinksSQl 2.1.1 - that works fine

1. I want to keep my old ID as ID or as a seperate non_standard field - how can I change L2S2.pm

2. I want to import some non_standard fields from links.db to user-table not links-table (Adress, password, phoneno.) - how is this possible?

Thanks for any hint!

Chris
Quote Reply
Re: [cwschroeder] How to import old Links2.0 ID in Links SQL In reply to
Hi Chris,

As far as I can remember, if you select 'straight import' on the import form it will import the links with your original ids.

I think you will need to add the columns to the user table yourself and then populate them with an UPDATE from the SQL monitor. I'm not quite certain about the command but I'm sure someone else could help out.

Laura.
The UK High Street
Quote Reply
Re: [afinlr] How to import old Links2.0 ID in Links SQL In reply to
What about:

UPDATE Users,Links SET Users.Address = Links.Address WHERE Users.Username = Links.Linkowner

Not confident this is right but it must be something like this.
The UK High Street
Quote Reply
Re: [cwschroeder] How to import old Links2.0 ID in Links SQL In reply to
Hello!



Look in the module and find out where is the execution and the insert. Out there you need to replace

..........execute($old_id) instead of execute($new_id)

and it should work.



Also remove auto_increment from respective the field property.
Quote Reply
Re: [cwschroeder] How to import old Links2.0 ID in Links SQL In reply to
No need to mess around with the code!

1) as Laura said, select "straight import"
2) select "Recreate Non-standard Columns"

It's as easy as that!!

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] How to import old Links2.0 ID in Links SQL In reply to
If I use "straight import", the routine stops without an error message after importing the users.

It only displays:Importing Subscribe users (newsletter receivers) ...5001000150020002500300035003561 Subscribed users imported.Importing Categories ...

Whats wrong?
Quote Reply
Re: [cwschroeder] How to import old Links2.0 ID in Links SQL In reply to
Hello!

As suggested earlier by other users, it would be better not to mess with the code.

However, if you still want to give it a try to see it there is a change of error, in your case, then you could try to change it by editing in your L2S2.pm as follows:

Line 276 is

my $new_id = $$opt{straight_import} ? $old_id : ++$Category_counter;

Which means Old Ids shall be used ONLY_IN_CASE of straight import, as suggested by other users. To de-activate this and use the OLD IDs in all cases you need to

Change it to

my $new_id = $old_id;

and it will use the old Ids for all functions Redardless of straight import or data integrity, etc.

Last edited by:

rajani: Jul 29, 2002, 1:50 AM
Quote Reply
Re: [rajani] How to import old Links2.0 ID in Links SQL In reply to
It doesnt work with the category import, which (I guess) uses the same function?

Is that possible?

Thanks, Chris
Quote Reply
Re: [cwschroeder] How to import old Links2.0 ID in Links SQL In reply to
If you use an error file, what does it say in there?

Select also "show mild warnings", "critical warnings".

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [cwschroeder] How to import old Links2.0 ID in Links SQL In reply to
Hello!

Does'nt than seem to be a problem with the script, I smell it. It could be a physical resource problem or the scripts are getting killed. So just trying to help you in identifying where "could be" the problem area, you can do the following, unless GT helps you or someone else:

1- Use "Top" command after you login via SSH or telnet (You need to have your own rights for that). Then press M for the listing with memory. Change the refresh to everyone sec by pressing s and then 1. See if the RAM and MEM is OK or free enough.

Here what happens is that the entire table is loadad into the memory, first in the RAM. Thereafter it is loadad into the SWAP partition, assuming that you use UNIX, I explain this. So keep an eye on the Swap, if there is a bottleneck developed.

2- Try to find out where exactly the scripts stops and figure out its behaviour by printing the lines as displays, like the following:

Exactly after the code in the line I have described above, exactly as below,

#############################
import_print "\n--------------------------------------\n";
import_print "\n Line 277 $Links_counter = Links_counter\n";
import_print "\n Line 278 $Category_counter = Category_counter\n";
import_print "\n Line 279 $new_id = new_id \n";
import_print "\n Line 280 $old_id = old_id\n";
##################################

3 - You will see that the script will start displaying all the inserts on the monitor.

4- You can chose the data-intigrity option as this will not duplicate the data.


Also you need to keep mild warnings and errors turned on.
Assuming that your NEW database is "EMPTY", which is the fundamental presumtion of the designer. Mind you, if you have the categories ALREADY inside the new database, things will work different and you need to tell us here, before you begin.


Editing this note, I saw what paul writes. Yes, it could be also true. It may just be importing and importing. This you can also view from the top command. You can also use Explorer 6.x and it will not get over until the cgi is working, which is a sign that it is still working.

Last edited by:

rajani: Jul 29, 2002, 10:48 AM
Quote Reply
Re: [cwschroeder] How to import old Links2.0 ID in Links SQL In reply to
>>
Whats wrong?
<<

How long did you wait?....it may not actually have stopped. The best thing is to open up mysqlman and refresh the table list to see if the number of rows is changing.