_DBReplace( ), API-Bibliotheksroutine
_DBReplace( ) setzt einen neuen Wert in ein Feld.
int _DBReplace(Locator FAR *fld, Value FAR *val)
Locator FAR *fld; /* Field to be replaced. */
Value FAR *val; /* Value to be placed in field. */
Hinweise
_DBReplace( ) gibt 0 zurück, wenn die Ersetzung ausgeführt wurde. Konnte die Ersetzung nicht ausgeführt werden, gibt **_DBReplace( **) eine negative ganze Zahl zurück, deren absoluter Wert eine Visual FoxPro-Fehlernummer darstellt. _DBReplace( ) kann verwendet werden, um den Wert eines Memofeldes durch einen neuen Wert zu ersetzen, der kürzer als 65.000 Bytes ist. Zum Bearbeiten von Memofeldern mit mehr als 65.000 Bytes müssen Sie direkte Memofeldroutinen und Routinen für gepufferte Dateieingaben und Dateiausgaben verwenden.
Weitere Informationen zum Erstellen einer API-Bibliothek und ihrer Integration in Visual FoxPro finden Sie unter Zugreifen auf die Visual FoxPro-API.
Beispiel
Im folgenden Beispiel wird eine Funktionalität unterstützt, die der des Visual FoxPro-Befehls REPLACE ähnlich ist, aber es wird jeweils nur der Wert eines Datensatzes ersetzt.
Visual FoxPro-Code
SET LIBRARY TO DBREPLAC
DO CreateTest
? DBREPLACE(@ABC, "Replacement record 1")
? DBREPLACE(@ABC, 2) && returns -302 - field ABC is character field
PROCEDURE CreateTest
CREATE TABLE test (ABC C(20))
APPEND BLANK
REPLACE ABC WITH "This is record 1"
APPEND BLANK
REPLACE ABC WITH "This is record 2"
APPEND BLANK
REPLACE ABC WITH "This is record 3"
APPEND BLANK
REPLACE ABC WITH "This is record 4"
GO TOP
RETURN
C-Code
#include <pro_ext.h>
FAR Example(ParamBlk FAR *parm)
{
_RetInt(_DBReplace(&parm->p[0].loc, &parm->p[1].val), 10);
}
FoxInfo myFoxInfo[] = {
{"DBREPLACE", (FPFI) Example, 2, "R,?"},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};
Siehe auch
_DBLock( ), API-Bibliotheksroutine | _DBUnlock( ), API-Bibliotheksroutine | REPLACE-Befehl | Zugreifen auf die Visual FoxPro-API