General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Hi all,
In several applications wich are made based on same framework (clases build by myself) things are go wrong with indexes in saved records to tables one-to-many forms. If in application work one user everything is ok, but when working more users it's happening to save bad entryes in indexes (primary or candidate).
When this happens there are NO crushes, power failures, net failures or other things.
Supose we have 2 tables T1MASTER and T2CHILD with IDT as primary and link field and in T1MASTER candidate field NRDOC; when saving a new record there are possibilities to get T2CHILD recs saved, in T1MASTER get error NRDOC index violated; when open T1MASTER and activate index NRDOC and search for record just entered the pointer take me to a record with other NRDOC
The save procedure in clases are like this:
local ldatamaster,ldataslave,llink,lmasterlink,lerror
ldatamaster=thisform.datamaster
ldataslave=thisform.dataslave
llink=thisform.datalink
lmasterlink=thisform.datamaster+'.'+thisform.datalink
thisform.activarecimp
sele (ldatamaster)
if thisform.writebuffer()
begin transaction
lerror=(txnlevel()=0)
if !lerror
if getfldstate(-1)=replicate("1",fcount()+1)
=setfldstate(2,2)
endif
lerror=!tableupdate()
if !lerror
select (ldataslave)
lerror=!tableupdate(.t.)
endif
if !lerror
end transaction
else
thisform.lockscreen=.t.
rollback
thisform.refreshform()
thisform.lockscreen=.f.
=aerror(laerror)
thisform.error(laerror[1],laerror[2],0)
endif
endif
endif
sele (ldatamaster)
thisform.refreshform()
return !lerror
Thanks in advance
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