General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Avoiding duplicate records, continuation
I gave up using auto increment integer fiels for a while
I continue my war also giving up using a second table to keep
records
I user a timer that executing 2 forms at the same time,
adding data to a table (very quickly, as test)
At the end of the tests I have 2000 records, with no duplications
Seems perfect...
However if I use 3 forms, duplicate numbers accour in some records
I wonder if 2 forms tests are enough or is there anything I could change
below to improve the code
Moises
********** form 1 ***********
SELECT ped
DO WHILE !FLOCK()
ENDDO
dimension lctemp[1]
select max(n) from ped ;
into array lctemp
lcTemp[1] = nvl(lcTemp[1],0)+1
replace ped.n WITH lcTemp
replace ped.n_id WITH "USER 1"
FLUSH
UNLOCK
********** form 2 ***********
SELECT ped
DO WHILE !FLOCK()
ENDDO
dimension lctemp[1]
select max(n) from ped ;
into array lctemp
lcTemp[1] = nvl(lcTemp[1],0)+1
replace ped.n WITH lcTemp
replace ped.n_id WITH "USER 2"
FLUSH
UNLOCK
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only