Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

$db_track in .defs

Quote Reply
$db_track in .defs
Has someone a clue what

$db_track = '0';

and

$db_track = '1';

stands for?

While trying to do 2 new tables one for main-data and one for alternative data i must create two .defs for my tables, now i dont know if i should 0 or 1 ???

Robert

Seems the "$db_track" isnīt used in any file?! Cant believe this...
Quote Reply
Re: $db_track in .defs In reply to
Still dont know what this is for.
But - Alex - i cant believe how easy it is to add a new table, a new def and some links for view,add,mod and delete in the admin. I really love it (for this minute :-)

Still go on ... seems one more night without sleeping :-(

Robert

Quote Reply
Index weight in .defs In reply to
Hmm, seems links and category has an index-weight, users not.

Whatīs the difference between them and where is the trigger to get the index-weight?
I dont need it for my new tables, but i must know it :-)

Robert

Ok, found it in editor.cgi - so i need to fix it there ...
Quote Reply
Re: $db_track in .defs In reply to
These are same as Links 2.0...They determine whether you assign new IDs to new records added in the tables. 0 stands for off or no tracking and 1 stands for on or track the ID numbers.

The variable has nothing to do with weighting fields.

Regards,

Eliot

Quote Reply
Re: $db_track in .defs In reply to
I dont understand this; a new ID is given when you have a field with auto_increment, its a mysql-thing, not a links think ...

Robert

Quote Reply
Re: $db_track in .defs In reply to
Doing a little back-tracking in the module files, I found this in the DBSQL.pm file (the only file that seems to use "db_track" at all.

Code:
sub _pre_get_id {
# ---------------------------------------------------------------
# Get's the next id number to use before a query is run. mSQL uses
# sequences to get the next number, mysql will take care of it auto-
# matically with a AUTO_INCREMENT field.
.

Looks like at one time he was trying to support mSQL as well, but gave it
up, but never removed all the functions.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: $db_track in .defs In reply to
Uh...actually it is a Perl thing...if you notice in Links 2.0, the ID is also "auto-incremented" based on the number in the linksid.txt. In terms of the SQL version, it will auto-increment the ID based on the last ID assigned in the Links table.

Regards,

Eliot Lee

Quote Reply
Re: $db_track in .defs In reply to
You both are saying the same thing ... Robert is looking at from the MySQL end, and Elliot is looking at it from the PERL end, but you are both seeing the same thing.

MySQL automatically assigns ID's if you have an "AUTO_INCREMENT" field set. mSQL didn't, and Links 2.0 didn't, so there is/was a mechanism to assign an ID if the database is not set to generate one automatically.

Just skimming the logic, the $db_track variable is set to '1' when the database has a need for an "AUTO_INCREMENT" field, and to '0' when it doesn't. Just like the .def files, this 'flag' is not strictly necessary [with MySQL], but it makes doing some things much easier and faster if it's used.

This might be one thing that is expanded (or dropped) in the next release, with the support of Oracle and M$7.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: $db_track in .defs In reply to
If i remember right, there are a lot of tables without an auto_increment but with track=1
???

Robert

Quote Reply
Re: $db_track in .defs In reply to
The need for an AUTO_INCREMENT field may only be theoretical, and no longer implemented. Alex did make some changes to make the database routines more universal and not need an AUTO_INCREMENT field.

But, looking at the code comments, that is what the field seems to do. What it really does may be another story. Follow the bugger in the code. I've created dozens of tables, and never hit a problem with that.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: $db_track in .defs In reply to
So you let it always to 1 or 0?
Or isnīt there any stuff doing something with this value?

Robert