Types added to Tuples
This commit is contained in:
+28
-11
@@ -591,11 +591,11 @@ type
|
||||
class function Text: TDataType.TText; static; inline;
|
||||
class function Timestamp: TDataType.TTimestamp; static; inline;
|
||||
class function DecimalOf(const AScale: Integer): TDataType.TDecimal; static;
|
||||
class function Tuple: TDataType.TTuple; static; inline;
|
||||
class function TupleOf(const AItemTypes: array of IDataType): TDataType.TTuple; overload; static;
|
||||
class function TupleOf(const AItemValues: array of IDataValue): TDataType.TTuple.TValue; overload; static;
|
||||
class function MethodOf(const AArgType, AResultType: IDataType): TDataType.TMethod; static;
|
||||
class function ArrayOf(const AElementType: IDataType): TDataType.TArray; static;
|
||||
class function VectorOf(const AElementType: IDataType; const AElementCount: Integer): TDataType.TVector; static;
|
||||
class function RecordOf(const Fields: TArray<TDataRecordField>): TDataType.TRecord; overload; static;
|
||||
class function RecordOf(const Fields: array of TDataRecordField): TDataType.TRecord; overload; static;
|
||||
class function RecordOf<T>: TDataType.TRecord; overload; static;
|
||||
class function EnumOf(const AName: string; const AIdentifiers: array of string): TDataType.TEnum; static;
|
||||
@@ -669,7 +669,7 @@ var
|
||||
scaleValue: Integer;
|
||||
begin
|
||||
scaleValue := GetDataType.Scale;
|
||||
if scaleValue > 0 then
|
||||
if (scaleValue > 0) then
|
||||
Result := FDecimalValue.Value / Power(10, scaleValue)
|
||||
else
|
||||
Result := FDecimalValue.Value;
|
||||
@@ -1031,7 +1031,7 @@ var
|
||||
idx: Integer;
|
||||
begin
|
||||
idx := IndexOf(AIdentifier);
|
||||
if idx < 0 then
|
||||
if (idx < 0) then
|
||||
raise EArgumentException.CreateFmt('Unknown identifier: %s', [AIdentifier]);
|
||||
Result := CreateValue(idx);
|
||||
end;
|
||||
@@ -1454,11 +1454,6 @@ begin
|
||||
Result.Create(TImplDataOrdinalType.Singleton);
|
||||
end;
|
||||
|
||||
class function TDataType.RecordOf(const Fields: TArray<TDataRecordField>): TDataType.TRecord;
|
||||
begin
|
||||
Result.Create(TImplDataRecordType.GetInstance(Fields));
|
||||
end;
|
||||
|
||||
class function TDataType.RecordOf(const Fields: array of TDataRecordField): TDataType.TRecord;
|
||||
begin
|
||||
Result.Create(TImplDataRecordType.GetInstance(Fields));
|
||||
@@ -1479,9 +1474,31 @@ begin
|
||||
Result.Create(TImplDataTimestampType.Singleton);
|
||||
end;
|
||||
|
||||
class function TDataType.Tuple: TDataType.TTuple;
|
||||
class function TDataType.TupleOf(const AItemTypes: array of IDataType): TDataType.TTuple;
|
||||
var
|
||||
tItems: TArray<IDataType>;
|
||||
i: Integer;
|
||||
begin
|
||||
Result.Create(TImplDataTupleType.Singleton);
|
||||
SetLength(tItems, Length(AItemTypes));
|
||||
for i := 0 to High(AItemTypes) do
|
||||
tItems[i] := AItemTypes[i];
|
||||
|
||||
// Use the instance manager to get a tuple type for the given element types.
|
||||
Result.Create(TImplDataTupleType.GetInstance(tItems));
|
||||
end;
|
||||
|
||||
class function TDataType.TupleOf(const AItemValues: array of IDataValue): TDataType.TTuple.TValue;
|
||||
var
|
||||
tItems: TArray<IDataType>;
|
||||
i: Integer;
|
||||
begin
|
||||
SetLength(tItems, Length(AItemValues));
|
||||
for i := 0 to High(AItemValues) do
|
||||
tItems[i] := AItemValues[i].DataType;
|
||||
|
||||
var tTuple := TImplDataTupleType.GetInstance(tItems);
|
||||
|
||||
Result := tTuple.CreateValue(AItemValues);
|
||||
end;
|
||||
|
||||
class function TDataType.VectorOf(const AElementType: IDataType; const AElementCount: Integer): TDataType.TVector;
|
||||
|
||||
Reference in New Issue
Block a user