General information
Category:
Coding, syntax & commands
Hi Nancy!
I nevertheless shall try to convince you. I bring a piece of the program (to answer all your questions), which spoils an index. I hope it will convince you, that the index can be broken in the program.
I apologize for the long text of an example.
CLOSE database
SET safe off
CREA database d
CREATE table a (key c(3) primary key) && To create the table with an index
FOR i=300 to 310
INSERT into a (key) values (str(i,3)) && To fill in the table
ENDFOR
nn=recc() && remember amount of records
USE
new_rec='999'
form1=createobject('form1') && SHOULD BE 1. with a flag readonly
form2=createobject('form2') && add new record
Release form1,form2 && the forms can be closed
**********************CHECK of RECORD**********************************
USE a excl &&
if recc()>nn && There is a new record
go bott
wait wind 'The new record is found | '+key nowait
SET order to key && Search on an index
IF !seek(new_rec)
&& By the way, the record is not visible and by search LOCATE
=messagebox('The index has failed')
set order to
brow nowait
if messagebox('REINDEX ?',4)=6
&& It does not change index expression, the filter and does not add record
reindex && To restore an index.
set order to key
IF !seek(new_rec)
=messagebox('The record is not found')
else
=messagebox('Now record is found!!!!!!!!') && However, the record occurs
endif
endif
ENDIF
endif
RETURN
************************NECESSARY CONDITIONS*****************************
DEFINE class form1 as form && FORM 1
DataSession=2 && PRIVATE
Name='READONLY'
PROCEDURE init
USE a noupdate && READONLY!!!
ENDPROC
ENDDEFINE && These definitions in the form 1 - SUFFICES!
DEFINE class form2 as form
DataSession=2
Name='WRITE'
PROCEDURE init
USE a
SET multi on
CursorSetProp('buffering',5,'a')
INSERT into a (key) values (new_rec) && new record
BEGIN transaction
ff=tableupdate(.T.,.T.,'a')&& update
IF ff && ready ?
END transaction
WAIT wind 'Normal end of a Transaction'
ELSE
ROLLBACK
=messagebox('ERROR')
ENDIF
ENDPROC
ENDDEFINE
Well here and whole example.
Previous
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