Gossamer Forum
Home : Products : DBMan : Customization :

add record question

Quote Reply
add record question
 
hi everyone!

suppose i have 2 users and they would add records at exactly the same time, how would dbman address that? i am using the database key as the value for my doc# and how can dbman allocate different values to these 2 people who have logged in at the same time?

please enlighten me.....
Quote Reply
Re: add record question In reply to
It is my understanding that flocking enables people to access the database and add records , modify records, and delete records simultaneously.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: add record question In reply to
If two persons 'add' to the database simultaneously from different browsers, it appears that they are both given the same 'key', I have this in my .cfg

$db_key_track = 1;

Which means that two records are then added to the database with the same key?
Or have I missed something here?
Quote Reply
Re: add record question In reply to
No...You are not correct. When two people are adding records at the same time...thay are given different "keys" based on the db_key variable. If the db_key is set to the ID, then the record number (ID) would increment to the next number for the users while adding at the same time.

Hope this helps.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: add record question In reply to
Eliot, I'm not entirely with you on this one.

I went to the demo
http://www.gossamer-threads.com/scripts/dbman/db.cgi

opened two browser windows, logged in as admin on both and added a new record. (The same ID number was showing in both). The first was fine, but the second appeared to corrupt the ID which was left at 3e+249
(who should I tell about this!)

My idea of a unique key would be to open the counter file, exclusive lock, grab the number and update it by one, unlock it and then add the record to the database. OK, there may be instances where the number does not get used for some reason, leaving 'gaps' in the ID's, but at least each record has its own number.

Hope you can help, many thanks.
Quote Reply
Re: add record question In reply to
 
Quote:
logged in as admin on both

If you log in as the same user on multiple workstations and add at the same time, then yes, you will have problems.

BUT, what I was talking about was two different users adding records at the same time, which would not cause this "corruption".

What you could to do is use an IP routine that only allows one IP address per user to be logged on at the same time or restrict the authorization permissions to have people only add one record.

Hope this helps.

Good luck!

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------