0: compatibility with latest RO/DA

This commit is contained in:
evgeny-k 2017-11-13 12:00:54 +03:00
parent 90ed5ee62a
commit 415353d8db
2 changed files with 35 additions and 12 deletions

View File

@ -118,7 +118,7 @@ var
begin
if Assigned(fDataTable) then begin
for i := 0 to fDataTable.Fields.Count-1 do begin
fScript.AddRegisteredVariable({$IFDEF UNICODE}WideStringToAnsiString{$ENDIF}(fDataTable.Fields[i].Name), '!NOTIFICATIONVARIANT');
fScript.AddRegisteredVariable(fDataTable.Fields[i].Name, '!NOTIFICATIONVARIANT');
end; { for }
end;
@ -135,12 +135,12 @@ end;}
function TDAPSScriptingProvider.OnGetNotificationVariant(Sender: TPSScript; const Name: tbtstring): Variant;
begin
result := fDataTable.Fields.FieldByName({$IFDEF UNICODE}AnsiStringToWideString{$ENDIF}(Name)).Value;
result := fDataTable.Fields.FieldByName(Name).Value;
end;
procedure TDAPSScriptingProvider.OnSetNotificationVariant(Sender: TPSScript; const Name: tbtstring; V: Variant);
begin
fDataTable.Fields.FieldByName({$IFDEF UNICODE}AnsiStringToWideString{$ENDIF}(Name)).Value := V;
fDataTable.Fields.FieldByName(Name).Value := V;
end;
procedure TDAPSScriptingProvider.PrepareForBusinessProcessor(aBusinessProcessor: TDABusinessProcessor);
@ -202,7 +202,7 @@ begin
end;
fDataTablePlugin.DataTable := aDataTable;
lMethod := TScriptMethod(fScript.GetProcMethod({$IFDEF UNICODE}WideStringToAnsiString{$ENDIF}(aMethod)));
lMethod := TScriptMethod(fScript.GetProcMethod(aMethod));
if assigned(@lMethod) then
lMethod();
end;

View File

@ -275,24 +275,29 @@ type
private
FVar: TPSVariantIFC;
FExec: TPSExec;
fAttr: TStringList;
protected
function GetTypeName: string;
procedure SetTypeName(const s: string);
procedure Write(Serializer: TROSerializer; const Name: string);
procedure Read(Serializer: TROSerializer; const Name: string);
procedure Write(Serializer: TROSerializer; const Name: string; ArrayElementId : integer = -1);
procedure Read(Serializer: TROSerializer; const Name: string; ArrayElementId : integer = -1);
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function CanImplementType(const aName: string):boolean;
procedure SetNull(b: Boolean);
function IsNull: Boolean;
function GetAttributes: TStrings;
public
constructor Create(aVar: TPSVariantIfc; Exec: TPSExec);
destructor Destroy; override;
end;
TROArray = class(TROStructure, IROCustomStreamableType, IROCustomStreamableStruct, IROCustomStreamableArray)
protected
function GetCount: Longint;
procedure SetCount(l: Longint);
procedure SetCount(l: Longint);
function GetElementType: string;
end;
procedure WriteUserDefined(Exec: TPSExec; const Msg: IROMessage; const Name: string; const n: TPSVariantIfc);
@ -1142,10 +1147,19 @@ end;
{ TROStructure }
constructor TROStructure.Create(aVar: TPSVariantIfc; Exec: TPSExec);
var
i: integer;
begin
inherited Create;
FVar := aVar;
FExec := Exec;
fAttr := TStringList.Create;
end;
destructor TROStructure.Destroy;
begin
fAttr.Free;
inherited;
end;
function TROStructure.IsNull: Boolean;
@ -1162,10 +1176,9 @@ begin
Result := E_NOINTERFACE;
end;
procedure TROStructure.Read(Serializer: TROSerializer;
const Name: string);
procedure TROStructure.Read(Serializer: TROSerializer; const Name: string; ArrayElementId : integer = -1);
begin
IntRead(FExec, Serializer, Name, FVar, -1);
IntRead(FExec, Serializer, Name, FVar, ArrayElementId);
end;
procedure TROStructure.SetNull(b: Boolean);
@ -1173,6 +1186,11 @@ begin
// null not supported
end;
function TROStructure.GetAttributes: TStrings;
begin
Result:= fAttr;
end;
function TROStructure.GetTypeName: string;
var
s: string;
@ -1184,9 +1202,9 @@ begin
end;
procedure TROStructure.Write(Serializer: TROSerializer;
const Name: string);
const Name: string; ArrayElementId : integer = -1);
begin
IntWrite(FExec, Serializer, Name, FVar, -1);
IntWrite(FExec, Serializer, Name, FVar, ArrayElementId);
end;
@ -1224,6 +1242,11 @@ begin
Result := PSDynArrayGetLength(Pointer(fVar.Dta^), fvar.aType);
end;
function TROArray.GetElementType: string;
begin
Result := '';
end;
procedure TROArray.SetCount(l: Integer);
begin
PSDynArraySetLength(Pointer(fVAr.Dta^), fVar.aType, l);