📄 uadatapacket.pas
字号:
{******************************************************************************************}
{ }
{ Universal Agent on demond SDK }
{ }
{ }
{ COPYRIGHT }
{ ========= }
{ The UA SDK (software) is Copyright (C) 2001-2003, by vinson zeng(曾胡龙). }
{ All rights reserved. }
{ The authors - vinson zeng (曾胡龙), }
{ exclusively own all copyrights to the Advanced Application }
{ Controls (AppControls) and all other products distributed by Utilmind Solutions(R). }
{ }
{ LIABILITY DISCLAIMER }
{ ==================== }
{ THIS SOFTWARE IS DISTRIBUTED "AS IS" AND WITHOUT WARRANTIES AS TO PERFORMANCE }
{ OF MERCHANTABILITY OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. }
{ YOU USE IT AT YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, }
{ DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.}
{ }
{ RESTRICTIONS }
{ ============ }
{ You may not attempt to reverse compile, modify, }
{ translate or disassemble the software in whole or in part. }
{ You may not remove or modify any copyright notice or the method by which }
{ it may be invoked. }
{******************************************************************************************}
unit UADataPacket;
interface
uses
Windows, Variants, ActiveX, Classes, SysUtils,UAUnits,
Contnrs,DB;
type
//-----------------------------------------------------------------
TUAParam = class(TPersistent)
private
FMachineID:string;
FIP:string;
FTag:LongWord;
FVersion:string;
FSessionID:string;
protected
function GetUaData: OleVariant;virtual;
procedure SetUaData(const Value: OleVariant);virtual;
public
constructor Create; virtual;
destructor Destroy; override;
property UAData:OleVariant read GetUaData write SetUaData;
end;
TClassUAParam = class of TUAParam;
TUAParams = class(TObjectList)
protected
function GetUaData: OleVariant;virtual;
procedure SetUaData(const Value: OleVariant);virtual;
public
property UAData:OleVariant read GetUaData write SetUaData;
end;
TUAParamsList = class(TObjectList)
protected
function GetUaData: OleVariant;virtual;
procedure SetUaData(const Value: OleVariant);virtual;
public
destructor Destroy; override;
function AddItem( index: integer; AObject: TObject ):Integer; virtual; function GetItem( index, itemid: integer ): TObject;virtual; function CountParamsItem(const Index :Integer = -1 ):Integer;virtual; property UAData:OleVariant read GetUaData write SetUaData;
end;
//--------------%% end of %%------------------------------------------------
TMasterLinkParam = class(TUAParam) // support multi primary key and forei key relationship or asso
private
FMasterAliasTableName:string;
FMasterField:string;
FDataType:TFieldType;
FMasterFieldValue:Variant;
procedure SetDataType(const Value: TFieldType);
procedure SetMasterAliasTableName(const Value: string);
procedure SetMasterField(const Value: string);
procedure SetMasterFieldValue(const Value: Variant);
function BuildMasterSqlScript: string;
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create; override;
destructor Destroy; override;
property UAData:OleVariant read GetUaData write SetUaData;
property MasterAliasTableName:string read FMasterAliasTableName write SetMasterAliasTableName;
property MasterField:string read FMasterField write SetMasterField;
property DataType:TFieldType read FDataType write SetDataType default ftString;
property MasterFieldValue:Variant read FMasterFieldValue write SetMasterFieldValue;
property MasterSqlScript:string read BuildMasterSqlScript;
end;
TDataRequestParam = class(TUAParam)
private
FAliasTableName:string;
FKeyFields: string;
FAllRecCount:integer;
FCurrRecCount:integer;
FRequestRecCount:integer;
FSqlParams:string;
function GetAliasTableName: string;
function GetAllRecCount: integer;
function GetCurrRecCount: integer;
procedure SetAliasTableName(const Value: string);
procedure SetAllRecCount(const Value: integer);
procedure SetCurrRecCount(const Value: integer);
function GetKeyFields: string;
procedure SetKeyFields(const Value: string);
function GetRequestRecCount: integer;
procedure SetRequestRecCount(const Value: integer);
function GetSqlParams: string;
procedure SetSqlParams(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create; override;
destructor Destroy; override;
property AliasTableName:string read GetAliasTableName write SetAliasTableName;
property KeyFields:string read GetKeyFields write SetKeyFields ;
property AllRecCount:integer read GetAllRecCount write SetAllRecCount;
property CurrRecCount:integer read GetCurrRecCount write SetCurrRecCount;
property RequestRecCount:integer read GetRequestRecCount write SetRequestRecCount;
property SqlParams:string read GetSqlParams write SetSqlParams;
property UAData:OleVariant read GetUaData write SetUaData;
end;
TDataReturnParam = class(TUAParam)
private
FAliasTableName:string;
FData:OleVariant; //in equal null ;out equal array of variant
FAllRecCount:integer;
FCurrRecCount:integer;
FDataSheetValue:OleVariant;
FRowSheetValue:OleVariant;
function GetAliasTableName: string;
function GetAllRecCount: integer;
function GetCurrRecCount: integer;
function GetData: OleVariant;
procedure SetAliasTableName(const Value: string);
procedure SetAllRecCount(const Value: integer);
procedure SetCurrRecCount(const Value: integer);
procedure SetData(const Value: OleVariant);
function GetDataSheetValue: OleVariant;
function GetRowSheetValue: OleVariant;
procedure SetDataSheetValue(const Value: OleVariant);
procedure SetRowSheetValue(const Value: OleVariant);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create; override;
destructor Destroy; override;
property AliasTableName:string read GetAliasTableName write SetAliasTableName;
property Data:OleVariant read GetData write SetData;
property AllRecCount:integer read GetAllRecCount write SetAllRecCount;
property CurrRecCount:integer read GetCurrRecCount write SetCurrRecCount;
property DataSheetValue:OleVariant read GetDataSheetValue write SetDataSheetValue;
property RowSheetValue:OleVariant read GetRowSheetValue write SetRowSheetValue;
property UAData:OleVariant read GetUaData write SetUaData;
end;
TDeltaParam = class(TUAParam)
private
FAliasTableName:string;
FKeyFields:string;
FDelta:OleVariant;
procedure SetAliasTableName(const Value: string);
procedure SetDelta(const Value: OleVariant);
procedure SetKeyFields(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create; override;
destructor Destroy; override;
property AliasTableName:string read FAliasTableName write SetAliasTableName;
property KeyFields:string read FKeyFields write SetKeyFields;
property Delta:OleVariant read FDelta write SetDelta;
property UAData:OleVariant read GetUaData write SetUaData;
end;
TDataSheetParam = class(TUAParam)
private
FAliasTableName:string;
FFieldName: string;
FRelSymbol: string; FFieldType: TFieldType; FLastValue: Variant; procedure SetAliasTableName(const Value: string); procedure SetFieldName(const Value: string); procedure SetFieldType(const Value: TFieldType); procedure SetLastValue(const Value: Variant); procedure SetRelSymbol(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property AliasTableName:string read FAliasTableName write SetAliasTableName ;
property FieldName:string read FFieldName write SetFieldName;
property RelSymbol:string read FRelSymbol write SetRelSymbol;
property FieldType:TFieldType read FFieldType write SetFieldType;
property LastValue:Variant read FLastValue write SetLastValue;
property UAData:OleVariant read GetUaData write SetUaData;
end;
TRowSheetParam = class(TUAParam)
private
FAliasTableName:string;
FFieldName: string;
FFieldType: TFieldType; FCurrValue: OleVariant; procedure SetAliasTableName(const Value: string); procedure SetCurrValue(const Value: OleVariant); procedure SetFieldName(const Value: string); procedure SetFieldType(const Value: TFieldType);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property AliasTableName:string read FAliasTableName write SetAliasTableName ;
property FieldName:string read FFieldName write SetFieldName;
property FieldType:TFieldType read FFieldType write SetFieldType;
property CurrValue:OleVariant read FCurrValue write SetCurrValue;
property UAData:OleVariant read GetUaData write SetUaData;
end;
TAnyParam = class(TUAParam)
private
FAnyValue:Variant;
function GetAnyValue: Variant;
procedure SetAnyValue(const Value: Variant);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property UAData:OleVariant read GetUaData write SetUaData;
property AnyValue:Variant read GetAnyValue write SetAnyValue;
end;
TErrorParam = class(TUAParam)
private
FErrorCode:integer;
FErrorMask:integer;
FErrorMsg:string;
FErrorContext:string;
procedure SetErrorCode(const Value: integer);
procedure SetErrorContext(const Value: string);
procedure SetErrorMsg(const Value: string);
procedure SetErrorMask(const Value: integer);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property UAData:OleVariant read GetUaData write SetUaData;
property ErrorCode:integer read FErrorCode write SetErrorCode;
property ErrorContext:string read FErrorContext write SetErrorContext;
property ErrorMsg:string read FErrorMsg write SetErrorMsg;
property ErrorMask:integer read FErrorMask write SetErrorMask;
end;
//2004-4-9 add by vinson zeng
{ TAppSystemParam = class(TUAParam)
private
FIp:string;
FProxyIp:string;
FAppAccount:string;
FUserId:string;
FUserName:string;
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property UAData:OleVariant read GetUaData write SetUaData;
property Ip:string read FIp write SetIp;
property ProxyIp:string read FProxyIp write SetProxyIp;
property UserId :string read FUserId write SetUserId;
property UserName:string read FUserName write SetUserName;
end;
//---------------%% end of %% -----------------------------
}
//-----------------------------------------------------------------------
TUARequestDataInPacket = class(TUAParam)
private
FRequestType:Integer;
FRowSheetList,FDataSheetList,
FMasterLinkList,FRequestDataList:TUAParams;
FAnyParam:TUAParamsList;
FDBConnTag:string;
FMustGetRecCount:integer;
procedure SetRequestType(const Value: Integer);
procedure SetDBConnTag(const Value: string);
procedure SetMustGetRecCount(const Value: integer);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create; override;
destructor Destroy; override;
procedure AddItemRowSheet(aRowSheetParam:TRowSheetParam);
function GetItemRowSheet(index:Integer):TRowSheetParam;
function CountRowSheet(index: integer = -1):integer;
procedure AddItemDataSheet(aDataSheetParam:TDataSheetParam);
function GetItemDataSheet(index:Integer):TDataSheetParam;
function CountDataSheet(index: integer = -1):integer;
procedure AddItemMasterLink(aMasterLink:TMasterLinkParam);
function GetItemMasterLink(index:Integer):TMasterLinkParam;
function CountMasterLink(index: integer = -1):integer;
procedure AddItemRequestData(aRequestData:TDataRequestParam);
function GetItemRequestData(index:Integer):TDataRequestParam;
function CountRequestData(index: integer = -1):integer;
procedure AddItemAnyParam( index: integer; aAnyParam: TAnyParam );
function GetItemAnyParam( index, itemid: integer ): TAnyParam; function CountAnyParam( index: integer = -1 ): integer;
procedure ClearAllUaData;
property UAData:OleVariant read GetUaData write SetUaData;
property RequestType:Integer read FRequestType write SetRequestType;
property DBConnTag:string read FDBConnTag write SetDBConnTag;
property MustGetRecCount:integer read FMustGetRecCount write SetMustGetRecCount;
end;
TUARequestDataOutPacket = class(TUAParam)
private
FRowSheetList,FDataSheetList,
FReturnDataList,FErrorList:TUAParams;
FResultCode:integer;
FAnyValue:TUAParamsList;
function GetResultCode: integer;
procedure SetResultCode(const Value: integer);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create; override;
destructor Destroy; override;
procedure AddItemRowSheet(aRowSheetParam:TRowSheetParam);
function GetItemRowSheet(index:Integer):TRowSheetParam;
function CountRowSheet(index: integer = -1):integer;
procedure AddItemDataSheet(aDataSheetParam:TDataSheetParam);
function GetItemDataSheet(index:Integer):TDataSheetParam;
function CountDataSheet(index: integer = -1):integer;
procedure AddItemReturnData(aReturnData:TDataReturnParam);
function GetItemReturnData(index:Integer):TDataReturnParam;
function CountReturnData(index: integer = -1):integer;
procedure AddItemErrorParam(aErrorParam:TErrorParam);
function GetItemErrorParam(index:Integer):TErrorParam;
function CountErrorParam(index: integer = -1):integer;
procedure AddItemAnyValue( index: integer; aAnyValue: TAnyParam );
function GetItemAnyValue( index, itemid: integer ): TAnyParam; function CountAnyValue( index: integer = -1 ): integer;
procedure ClearAllUaData;
property UAData:OleVariant read GetUaData write SetUaData;
property ResultCode:integer read GetResultCode write SetResultCode;
end;
TUAUpdateDataInPacket = class(TUAParam)
private
FUpdateIndex:Integer;
FDeltaList:TUAParams;
FAnyParam:TUAParamsList;
FDBConnTag:string;
procedure SetUpdateIndex(const Value: Integer);
procedure SetDBConnTag(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create; override;
destructor Destroy; override;
procedure AddItemDelta(aDelta:TDeltaParam);
function GetItemDelta(index:Integer):TDeltaParam;
function CountItemDelta(index: integer = -1):integer;
procedure AddItemAnyParam( index: integer; aAnyParam: TAnyParam );
function GetItemAnyParam( index, itemid: integer ): TAnyParam; function CountAnyParam( index: integer = -1 ): integer;
procedure ClearAllUaData;
property UAData:OleVariant read GetUaData write SetUaData;
property UpdateIndex:Integer read FUpdateIndex write SetUpdateIndex;
property DBConnTag:string read FDBConnTag write SetDBConnTag;
end;
TUAUpdateDataOutPacket = class(TUAParam)
private
FResultCode:Integer;
FErrorList:TUAParams;
FAnyValue:TUAParamsList;
function GetResultCode: Integer;
procedure SetResultCode(const Value: Integer);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create; override;
destructor Destroy; override;
procedure ClearAllUaData;
procedure AddItemErrorParam(aErrorParam:TErrorParam);
function GetItemErrorParam(index:Integer):TErrorParam;
function CountErrorParam(index: integer = -1):integer;
procedure AddItemAnyValue( index: integer; aAnyValue: TAnyParam );
function GetItemAnyValue( index, itemid: integer ): TAnyParam; function CountAnyValue( index: integer = -1 ): integer;
property UAData:OleVariant read GetUaData write SetUaData;
property ResultCode:Integer read GetResultCode write SetResultCode;
end;
//=======================================================================
TUAExecuteDataInPacket = class(TUAParam)
private
FAnyParam:TUAParamsList;
FDBConnTag:string;
procedure SetDBConnTag(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create; override;
destructor Destroy; override;
procedure AddItemAnyParam( index: integer; aAnyParam: TAnyParam );
function GetItemAnyParam( index, itemid: integer ): TAnyParam; function CountAnyParam( index: integer = -1 ): integer;
procedure ClearAllUaData;
property UAData:OleVariant read GetUaData write SetUaData;
property DBConnTag:string read FDBConnTag write SetDBConnTag;
end;
TUAExecuteDataOutPacket = class(TUAParam)
private
FResultCode:Integer;
FErrorList:TUAParams;
FAnyValue:TUAParamsList;
function GetResultCode: Integer;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -