Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recylcling deleted records in CursorAdapter
Message
De
16/03/2003 05:33:40
 
 
À
15/03/2003 01:50:07
Km Kwun
Eastop Consultants Limited
Nt, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00766142
Message ID:
00766287
Vues:
21
This message has been marked as the solution to the initial question of the thread.
>When using CursorAdapter with local VFP data, can I recycle deleted records in an update action?
>

Yes, you can.
CLOSE DATABASES all
CLEAR
SET MULTILOCKS ON 

CREATE CURSOR foo (f1 I)
INDEX ON DELETED() TAG deleted
SET ORDER TO 0

INSERT INTO foo values(1)
INSERT INTO foo values(2)
INSERT INTO foo values(3)

GO top
DELETE
GO BOTTOM
delete

?ALIAS()
LIST

LOCAL oCA as CursorAdapter
oCA=CREATEOBJECT("CursorAdapter")
oCA.Alias="test"
oCA.DataSourceType="NATIVE"
oCA.SelectCmd="select * from foo where !DELETED()"
oCA.InsertCmd="MyInsert(this)"
*oCA.BufferModeOverride= 5


oCA.CursorFill()

SELECT (oCA.Alias)
?ALIAS()
LIST
INSERT INTO (oCA.Alias) values(4)
TABLEUPDATE(.F.)
INSERT INTO (oCA.Alias) values(5)
TABLEUPDATE(.F.)
INSERT INTO (oCA.Alias) values(6)
TABLEUPDATE(.F.)

SELECT foo
?ALIAS()
list

FUNCTION MyInsert(oCA as CursorAdapter)
	SET ORDER TO deleted IN foo
	GO BOTTOM IN foo

	IF !EOF("foo") AND DELETED("foo")
		REPLACE f1 WITH EVALUATE(oCA.Alias+".f1") IN foo
		RECALL IN foo
	ELSE
		INSERT INTO foo VALUES(EVALUATE(oCA.Alias+".f1"))
	ENDIF
ENDFUNC	
return
Thanks,
Aleksey Tsingauz.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform