Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor Adapter Requests
Message
De
08/08/2004 05:02:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00931561
Message ID:
00931607
Vues:
17
>The cursoradapter class could be more useful if it allowed the programmer to override the Insert, Delete and Update methods. I assume they are not present because the purpose of the class is to simplify the use of ODBC, ADO and XML. However, the cursoradapter class could also be used for other types of access to database servers. If the programmer had access to the Insert, Delete and Update methods they could write there own methods to access the native API of other database servers thus making the cursoradapter class useful for a broad range of backends. You could avoid the problem of slow or buggy ODBC drivers by talking directly to the database API. You could also use this method to update data on web server running Web-Connect because you could use the Insert/Delete/Update methods to send the request to the web-server.
>

Hi Simon,

CursorAdapter was designed with these scenarios in mind, this is what InsertCmd, UpdateCmd and DeleteCmd properties are for:
CLEAR
CLOSE DATABASES all
SET MULTILOCKS ON

CREATE CURSOR foo (f1 I, f2 c(10))

INSERT INTO foo VALUES (1,"1")
INSERT INTO foo VALUES (2,"2")

CURSORSETPROP("Buffering",5)

GO 1
replace f2 WITH "New_1"

GO 2
DELETE 

INSERT INTO foo VALUES (3,"3")

LOCAL oCA as CursorAdapter

oCA=CREATEOBJECT("CustomUpdateCA")
oCA.CursorAttach("foo")

oCA.UpdatableFieldList="f1,f2"

TABLEUPDATE(.T.)

DEFINE CLASS CustomUpdateCA AS CursorAdapter
		
	InsertCmdDataSourceType="Native"
	UpdateCmdDataSourceType="Native"
	DeleteCmdDataSourceType="Native"

	InsertCmd="this.CustomInsert()"
	UpdateCmd="this.CustomUpdate()"
	DeleteCmd="this.CustomDelete()"
	
	FUNCTION CustomInsert()
		?PROGRAM()
	ENDFUNC 

	FUNCTION CustomUpdate()
		?PROGRAM()
	ENDFUNC 

	FUNCTION CustomDelete()
		?PROGRAM()
	ENDFUNC 
ENDDEFINE
Thanks,
Aleksey.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform