123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891 |
- { TParams }
- Function TParams.GetItem(Index: Integer): TParam;
- begin
- Result:=(Inherited GetItem(Index)) as TParam;
- end;
- Function TParams.GetParamValue(const ParamName: string): Variant;
- begin
- Result:=ParamByName(ParamName).Value;
- end;
- Procedure TParams.SetItem(Index: Integer; Value: TParam);
- begin
- Inherited SetItem(Index,Value);
- end;
- Procedure TParams.SetParamValue(const ParamName: string; const Value: Variant);
- begin
- ParamByName(ParamName).Value:=Value;
- end;
- Procedure TParams.AssignTo(Dest: TPersistent);
- begin
- if (Dest is TParams) then
- TParams(Dest).Assign(Self)
- else
- inherited AssignTo(Dest);
- end;
- Function TParams.GetDataSet: TDataSet;
- begin
- If (FOwner is TDataset) Then
- Result:=TDataset(FOwner)
- else
- Result:=Nil;
- end;
- Function TParams.GetOwner: TPersistent;
- begin
- Result:=FOwner;
- end;
- constructor TParams.Create(AOwner: TPersistent);
- begin
- Inherited Create(TParam);
- Fowner:=AOwner;
- end;
- constructor TParams.Create;
- begin
- Create(TPersistent(Nil));
- end;
- Procedure TParams.AddParam(Value: TParam);
- begin
- Value.Collection:=Self;
- end;
- Procedure TParams.AssignValues(Value: TParams);
- Var
- I : Integer;
- P,PS : TParam;
- begin
- For I:=0 to Value.Count-1 do
- begin
- PS:=Value[i];
- P:=FindParam(PS.Name);
- If Assigned(P) then
- P.Assign(PS);
- end;
- end;
- Function TParams.CreateParam(FldType: TFieldType; const ParamName: string;
- ParamType: TParamType): TParam;
- begin
- Result:=Add as TParam;
- With Result do
- begin
- Name:=ParamName;
- DataType:=FldType;
- ParamType:=ParamType;
- end;
- end;
- Function TParams.FindParam(const Value: string): TParam;
- Var
- I : Integer;
- begin
- Result:=Nil;
- I:=Count-1;
- While (Result=Nil) and (I>=0) do
- If (CompareText(Value,Items[i].Name)=0) then
- Result:=Items[i]
- else
- Dec(i);
- end;
- Procedure TParams.GetParamList(List: TList; const ParamNames: string);
- Function NextName(Var S : String) : String;
- Var
- P : Integer;
- begin
- P:=Pos(';',S);
- If (P=0) then
- P:=Length(S)+1;
- Result:=Copy(S,1,P-1);
- system.Delete(S,1,P);
- end;
- Var
- L,N : String;
- begin
- L:=ParamNames;
- While (Length(L)>0) do
- begin
- N:=NextName(L);
- List.Add(ParamByName(N));
- end;
- end;
- Function TParams.IsEqual(Value: TParams): Boolean;
- Var
- I : Integer;
- begin
- Result:=(Value.Count=Count);
- I:=Count-1;
- While Result and (I>=0) do
- begin
- Result:=Items[I].IsEqual(Value[i]);
- Dec(I);
- end;
- end;
- Function TParams.ParamByName(const Value: string): TParam;
- begin
- Result:=FindParam(Value);
- If (Result=Nil) then
- DatabaseErrorFmt(SParameterNotFound,[Value],Dataset);
- end;
- Function TParams.ParseSQL(SQL: String; DoCreate: Boolean): String;
- var pb : TParamBinding;
- begin
- Result := ParseSQL(SQL,DoCreate,psInterbase, pb);
- end;
- Function TParams.ParseSQL(SQL: String; DoCreate: Boolean; ParameterStyle : TParamStyle): String;
- var pb : TParamBinding;
- begin
- Result := ParseSQL(SQL,DoCreate,ParameterStyle,pb);
- end;
- Function TParams.ParseSQL(SQL: String; DoCreate: Boolean; ParameterStyle : TParamStyle; var ParamBinding: TParambinding): String;
- type
- // used for ParamPart
- TStringPart = record
- Start,Stop:integer;
- end;
- const
- ParamAllocStepSize = 8;
- var
- p,ParamNameStart,BufStart:PChar;
- ParamName:string;
- QuestionMarkParamCount,ParameterIndex,NewLength:integer;
- ParamCount:integer; // actual number of parameters encountered so far;
- // always <= Length(ParamPart) = Length(Parambinding)
- // Parambinding will have length ParamCount in the end
- ParamPart:array of TStringPart; // describe which parts of buf are parameters
- NewQueryLength:integer;
- NewQuery:string;
- NewQueryIndex,BufIndex,CopyLen,i:integer; // Parambinding will have length ParamCount in the end
- begin
- if DoCreate then Clear;
- // Parse the SQL and build ParamBinding
- ParamCount:=0;
- NewQueryLength:=Length(SQL);
- SetLength(ParamPart,ParamAllocStepSize);
- SetLength(Parambinding,ParamAllocStepSize);
- QuestionMarkParamCount:=0; // number of ? params found in query so far
- p:=PChar(SQL);
- BufStart:=p; // used to calculate ParamPart.Start values
- repeat
- case p^ of
- '''': // single quote delimited string
- begin
- Inc(p);
- while not (p^ in [#0, '''']) do
- begin
- if p^='\' then Inc(p,2) // make sure we handle \' and \\ correct
- else Inc(p);
- end;
- if p^='''' then Inc(p); // skip final '
- end;
- '"': // double quote delimited string
- begin
- Inc(p);
- while not (p^ in [#0, '"']) do
- begin
- if p^='\' then Inc(p,2) // make sure we handle \" and \\ correct
- else Inc(p);
- end;
- if p^='"' then Inc(p); // skip final "
- end;
- '-': // possible start of -- comment
- begin
- Inc(p);
- if p='-' then // -- comment
- begin
- repeat // skip until at end of line
- Inc(p);
- until p^ in [#10, #0];
- end
- end;
- '/': // possible start of /* */ comment
- begin
- Inc(p);
- if p^='*' then // /* */ comment
- begin
- repeat
- Inc(p);
- if p^='*' then // possible end of comment
- begin
- Inc(p);
- if p^='/' then Break; // end of comment
- end;
- until p^=#0;
- if p^='/' then Inc(p); // skip final /
- end;
- end;
- ':','?': // parameter
- begin
- Inc(ParamCount);
- if ParamCount>Length(ParamPart) then
- begin
- NewLength:=Length(ParamPart)+ParamAllocStepSize;
- SetLength(ParamPart,NewLength);
- SetLength(ParamBinding,NewLength);
- end;
- if p^=':' then
- begin // find parameter name
- Inc(p);
- ParamNameStart:=p;
- while not (p^ in (SQLDelimiterCharacters+[#0])) do
- Inc(p);
- ParamName:=Copy(ParamNameStart,1,p-ParamNameStart);
- end
- else
- begin
- Inc(p);
- ParamNameStart:=p;
- ParamName:='';
- end;
- // create Parameter and assign ParameterIndex
- if DoCreate then
- ParameterIndex := CreateParam(ftUnknown, ParamName, ptInput).Index
- // else find ParameterIndex
- else
- begin
- if ParamName<>'' then
- ParameterIndex:=ParamByName(ParamName).Index
- else
- begin
- ParameterIndex:=QuestionMarkParamCount;
- Inc(QuestionMarkParamCount);
- end;
- end;
- // store ParameterIndex in FParamIndex, ParamPart data
- ParamBinding[ParamCount-1]:=ParameterIndex;
- ParamPart[ParamCount-1].Start:=ParamNameStart-BufStart;
- ParamPart[ParamCount-1].Stop:=p-BufStart+1;
- // update NewQueryLength
- Dec(NewQueryLength,p-ParamNameStart);
- end;
- #0:Break;
- else
- Inc(p);
- end;
- until false;
- SetLength(ParamPart,ParamCount);
- SetLength(ParamBinding,ParamCount);
- if ParamCount>0 then
- begin
- // replace :ParamName by ? (using ParamPart array and NewQueryLength)
- if ParameterStyle = psPostgreSQL then
- if paramcount < 10 then
- inc(NewQueryLength,paramcount)
- else
- inc(NewQueryLength,(paramcount-9)*2+9);
- SetLength(NewQuery,NewQueryLength);
- NewQueryIndex:=1;
- BufIndex:=1;
- for i:=0 to High(ParamPart) do
- begin
- CopyLen:=ParamPart[i].Start-BufIndex;
- Move(SQL[BufIndex],NewQuery[NewQueryIndex],CopyLen);
- Inc(NewQueryIndex,CopyLen);
- case ParameterStyle of
- psInterbase : NewQuery[NewQueryIndex]:='?';
- psPostgreSQL: begin
- ParamName := IntToStr(i+1);
- NewQuery[NewQueryIndex]:='$';
- Inc(NewQueryIndex);
- NewQuery[NewQueryIndex]:= paramname[1];
- if i>10 then
- begin
- Inc(NewQueryIndex);
- NewQuery[NewQueryIndex]:= paramname[2]
- end;
- end;
- end;
- Inc(NewQueryIndex);
- BufIndex:=ParamPart[i].Stop;
- end;
- CopyLen:=Length(SQL)+1-BufIndex;
- Move(SQL[BufIndex],NewQuery[NewQueryIndex],CopyLen);
- end
- else
- NewQuery:=SQL;
- Result := NewQuery;
- end;
- Procedure TParams.RemoveParam(Value: TParam);
- begin
- Value.Collection:=Nil;
- end;
- { TParam }
- Function TParam.GetDataSet: TDataSet;
- begin
- If Assigned(Collection) and (Collection is TParams) then
- Result:=TParams(Collection).GetDataset
- else
- Result:=Nil;
- end;
- Function TParam.IsParamStored: Boolean;
- begin
- Result:=Bound;
- end;
- Procedure TParam.AssignParam(Param: TParam);
- begin
- if Not Assigned(Param) then
- begin
- Clear;
- FDataType:=ftunknown;
- FParamType:=ptUnknown;
- Name:='';
- Size:=0;
- Precision:=0;
- NumericScale:=0;
- end
- else
- begin
- FDataType:=Param.DataType;
- if Param.IsNull then
- Clear
- else
- FValue:=Param.FValue;
- FBound:=Param.Bound;
- Name:=Param.Name;
- if (ParamType=ptUnknown) then
- ParamType:=Param.ParamType;
- Size:=Param.Size;
- Precision:=Param.Precision;
- NumericScale:=Param.NumericScale;
- end;
- end;
- Procedure TParam.AssignTo(Dest: TPersistent);
- begin
- if (Dest is TField) then
- AssignToField(TField(Dest))
- else
- inherited AssignTo(Dest);
- end;
- Function TParam.GetAsBoolean: Boolean;
- begin
- If IsNull then
- Result:=False
- else
- Result:=FValue;
- end;
- Function TParam.GetAsCurrency: Currency;
- begin
- If IsNull then
- Result:=0.0
- else
- Result:=FValue;
- end;
- Function TParam.GetAsDateTime: TDateTime;
- begin
- If IsNull then
- Result:=0.0
- else
- Result:=FValue;
- end;
- Function TParam.GetAsFloat: Double;
- begin
- If IsNull then
- Result:=0.0
- else
- Result:=FValue;
- end;
- Function TParam.GetAsInteger: Longint;
- begin
- If IsNull then
- Result:=0
- else
- Result:=FValue;
- end;
- Function TParam.GetAsMemo: string;
- begin
- If IsNull then
- Result:=''
- else
- Result:=FValue;
- end;
- Function TParam.GetAsString: string;
- begin
- If IsNull then
- Result:=''
- else
- Result:=FValue;
- end;
- Function TParam.GetAsVariant: Variant;
- begin
- if IsNull then
- Result:=Null
- else
- Result:=FValue;
- end;
- Function TParam.GetDisplayName: string;
- begin
- if (FName<>'') then
- Result:=FName
- else
- Result:=inherited GetDisplayName
- end;
- Function TParam.GetIsNull: Boolean;
- begin
- Result:= VarIsNull(FValue) or VarIsClear(FValue);
- end;
- Function TParam.IsEqual(AValue: TParam): Boolean;
- begin
- Result:=(Name=AValue.Name)
- and (IsNull=AValue.IsNull)
- and (Bound=AValue.Bound)
- and (DataType=AValue.DataType)
- and (ParamType=AValue.ParamType)
- and (VarType(FValue)=VarType(AValue.FValue))
- and (FValue=AValue.FValue);
- end;
- Procedure TParam.SetAsBlob(const AValue: TBlobData);
- begin
- FValue:=AValue;
- FDataType:=ftBlob;
- end;
- Procedure TParam.SetAsBoolean(AValue: Boolean);
- begin
- FValue:=AValue;
- FDataType:=ftBoolean;
- end;
- Procedure TParam.SetAsCurrency(const AValue: Currency);
- begin
- FValue:=Avalue;
- FDataType:=ftCurrency;
- end;
- Procedure TParam.SetAsDate(const AValue: TDateTime);
- begin
- FValue:=Avalue;
- FDataType:=ftDate;
- end;
- Procedure TParam.SetAsDateTime(const AValue: TDateTime);
- begin
- FValue:=AValue;
- FDataType:=ftDateTime;
- end;
- Procedure TParam.SetAsFloat(const AValue: Double);
- begin
- FValue:=AValue;
- FDataType:=ftFloat;
- end;
- Procedure TParam.SetAsInteger(AValue: Longint);
- begin
- FValue:=AValue;
- FDataType:=ftInteger;
- end;
- Procedure TParam.SetAsMemo(const AValue: string);
- begin
- FValue:=AValue;
- FDataType:=ftMemo;
- end;
- Procedure TParam.SetAsSmallInt(AValue: LongInt);
- begin
- FValue:=AValue;
- FDataType:=ftSmallInt;
- end;
- Procedure TParam.SetAsString(const AValue: string);
- begin
- FValue:=AValue;
- FDataType:=ftString;
- end;
- Procedure TParam.SetAsTime(const AValue: TDateTime);
- begin
- FValue:=AValue;
- FDataType:=ftTime;
- end;
- Procedure TParam.SetAsVariant(const AValue: Variant);
- begin
- FValue:=AValue;
- FBound:=not VarIsClear(Value);
- if FDataType = ftUnknown then
- case VarType(Value) of
- varBoolean : FDataType:=ftBoolean;
- varSmallint,
- varShortInt,
- varByte : FDataType:=ftSmallInt;
- varWord,
- varInteger : FDataType:=ftInteger;
- varCurrency : FDataType:=ftCurrency;
- varLongWord,
- varSingle,
- varDouble : FDataType:=ftFloat;
- varDate : FDataType:=ftDateTime;
- varString,
- varOleStr : if (FDataType<>ftFixedChar) then
- FDataType:=ftString;
- varInt64 : FDataType:=ftLargeInt;
- else
- FDataType:=ftUnknown;
- end;
- end;
- Procedure TParam.SetAsWord(AValue: LongInt);
- begin
- FValue:=AValue;
- FDataType:=ftWord;
- end;
- Procedure TParam.SetDataType(AValue: TFieldType);
- Var
- VT : Integer;
- begin
- FDataType:=AValue;
- VT:=FieldTypetoVariantMap[AValue];
- If (VT=varError) then
- clear
- else
- Try
- FValue:=VarAsType(AValue,VT)
- except
- Clear;
- end;
- end;
- Procedure TParam.SetText(const AValue: string);
- begin
- Value:=AValue;
- end;
- constructor TParam.Create(ACollection: TCollection);
- begin
- inherited Create(ACollection);
- ParamType:=ptUnknown;
- DataType:=ftUnknown;
- FValue:=Unassigned;
- end;
- constructor TParam.Create(AParams: TParams; AParamType: TParamType);
- begin
- Create(AParams);
- ParamType:=AParamType;
- end;
- Procedure TParam.Assign(Source: TPersistent);
- begin
- if (Source is TParam) then
- AssignParam(TParam(Source))
- else if (Source is TField) then
- AssignField(TField(Source))
- else if (source is TStrings) then
- AsMemo:=TStrings(Source).Text
- else
- inherited Assign(Source);
- end;
- Procedure TParam.AssignField(Field: TField);
- begin
- if Assigned(Field) then
- begin
- // Need TField.Value
- // AssignFieldValue(Field,Field.Value);
- Name:=Field.FieldName;
- end
- else
- begin
- Clear;
- Name:='';
- end
- end;
- procedure TParam.AssignToField(Field : TField);
- begin
- if Assigned(Field) then
- case FDataType of
- ftUnknown : DatabaseErrorFmt(SUnknownParamFieldType,[Name],DataSet);
- // Need TField.AsSmallInt
- ftSmallint : Field.AsInteger:=AsSmallInt;
- // Need TField.AsWord
- ftWord : Field.AsInteger:=AsWord;
- ftInteger,
- ftAutoInc : Field.AsInteger:=AsInteger;
- // Need TField.AsCurrency
- ftCurrency : Field.asFloat:=AsCurrency;
- ftFloat : Field.asFloat:=AsFloat;
- ftBoolean : Field.AsBoolean:=AsBoolean;
- ftBlob,
- ftGraphic..ftTypedBinary,
- ftOraBlob,
- ftOraClob,
- ftString,
- ftMemo,
- ftAdt,
- ftFixedChar: Field.AsString:=AsString;
- ftTime,
- ftDate,
- ftDateTime : Field.AsDateTime:=AsDateTime;
- ftBytes,
- ftVarBytes : ; // Todo.
- else
- If not (DataType in [ftCursor, ftArray, ftDataset,ftReference]) then
- DatabaseErrorFmt(SBadParamFieldType, [Name], DataSet);
- end;
- end;
- Procedure TParam.AssignFieldValue(Field: TField; const AValue: Variant);
- begin
- If Assigned(Field) then
- begin
- // Need TField.FixedChar property.
- if (Field.DataType = ftString) {and TStringField(Field).FixedChar} then
- DataType:=ftFixedChar
- else if (Field.DataType = ftMemo) and (Field.Size > 255) then
- DataType:=ftString
- else
- DataType:=Field.DataType;
- if VarIsNull(AValue) then
- Clear
- else
- Value:=AValue;
- Size:=Field.DataSize;
- FBound:=True;
- end;
- end;
- Procedure TParam.Clear;
- begin
- FValue:=UnAssigned;
- end;
- Procedure TParam.GetData(Buffer: Pointer);
- Var
- P : Pointer;
- S : String;
- begin
- case FDataType of
- ftUnknown : DatabaseErrorFmt(SUnknownParamFieldType,[Name],DataSet);
- ftSmallint : PSmallint(Buffer)^:=AsSmallInt;
- ftWord : PWord(Buffer)^:=AsWord;
- ftInteger,
- ftAutoInc : PInteger(Buffer)^:=AsInteger;
- ftCurrency : PDouble(Buffer)^:=AsCurrency;
- ftFloat : PDouble(Buffer)^:=AsFloat;
- ftBoolean : PWordBool(Buffer)^:=AsBoolean;
- ftString,
- ftMemo,
- ftAdt,
- ftFixedChar:
- begin
- S:=AsString;
- StrMove(PChar(Buffer),Pchar(S),Length(S)+1);
- end;
- ftTime : PInteger(Buffer)^:=DateTimeToTimeStamp(AsTime).Time;
- ftDate : PInteger(Buffer)^:=DateTimeToTimeStamp(AsTime).Date;
- ftDateTime : PDouble(Buffer)^:=TimeStampToMSecs(DateTimeToTimeStamp(AsDateTime));
- ftBlob,
- ftGraphic..ftTypedBinary,
- ftOraBlob,
- ftOraClob :
- begin
- S:=GetAsString;
- Move(PChar(S)^, Buffer^, Length(S));
- end;
- ftBytes, ftVarBytes:
- begin
- if VarIsArray(FValue) then
- begin
- P:=VarArrayLock(FValue);
- try
- Move(P^, Buffer^, VarArrayHighBound(FValue, 1) + 1);
- finally
- VarArrayUnlock(FValue);
- end;
- end;
- end;
- else
- If not (DataType in [ftCursor, ftArray, ftDataset,ftReference]) then
- DatabaseErrorFmt(SBadParamFieldType, [Name], DataSet);
- end;
- end;
- Function TParam.GetDataSize: Integer;
- begin
- Result:=0;
- case DataType of
- ftUnknown : DatabaseErrorFmt(SUnknownParamFieldType,[Name],DataSet);
- ftBoolean : Result:=SizeOf(WordBool);
- ftInteger,
- ftAutoInc : Result:=SizeOf(Integer);
- ftSmallint : Result:=SizeOf(SmallInt);
- ftWord : Result:=SizeOf(Word);
- ftTime,
- ftDate : Result:=SizeOf(Integer);
- ftDateTime,
- ftCurrency,
- ftFloat : Result:=SizeOf(Double);
- ftString,
- ftFixedChar,
- ftMemo,
- ftADT : Result:=Length(AsString)+1;
- ftBytes,
- ftVarBytes : if VarIsArray(FValue) then
- Result:=VarArrayHighBound(FValue,1)+1
- else
- Result:=0;
- ftBlob,
- ftGraphic..ftTypedBinary,
- ftOraClob,
- ftOraBlob : Result:=Length(AsString);
- ftArray,
- ftDataSet,
- ftReference,
- ftCursor : Result:=0;
- else
- DatabaseErrorFmt(SBadParamFieldType,[Name],DataSet);
- end;
- end;
- Procedure TParam.LoadFromFile(const FileName: string; BlobType: TBlobType);
- Var
- S : TFileStream;
- begin
- S:=TFileStream.Create(FileName,fmOpenRead);
- Try
- LoadFromStream(S,BlobType);
- Finally
- FreeAndNil(S);
- end;
- end;
- Procedure TParam.LoadFromStream(Stream: TStream; BlobType: TBlobType);
- Var
- Temp : String;
- begin
- FDataType:=BlobType;
- With Stream do
- begin
- Position:=0;
- SetLength(Temp,Size);
- ReadBuffer(Pointer(Temp)^,Size);
- FValue:=Temp;
- end;
- end;
- Procedure TParam.SetBlobData(Buffer: Pointer; ASize: Integer);
- Var
- Temp : String;
- begin
- SetLength(Temp,ASize);
- Move(Buffer^,Temp,ASize);
- AsBlob:=Temp;
- end;
- Procedure TParam.SetData(Buffer: Pointer);
- Function FromTimeStamp(T,D : Integer) : TDateTime;
- Var TS : TTimeStamp;
- begin
- TS.Time:=T;
- TS.Date:=D;
- Result:=TimeStampToDateTime(TS);
- end;
- begin
- case FDataType of
- ftUnknown : DatabaseErrorFmt(SUnknownParamFieldType,[Name],DataSet);
- ftSmallint : AsSmallInt:=PSmallint(Buffer)^;
- ftWord : AsWord:=PWord(Buffer)^;
- ftInteger,
- ftAutoInc : AsInteger:=PInteger(Buffer)^;
- ftCurrency : AsCurrency:= PDouble(Buffer)^;
- ftFloat : AsFloat:=PDouble(Buffer)^;
- ftBoolean : AsBoolean:=PWordBool(Buffer)^;
- ftString,
- ftFixedChar: AsString:=StrPas(Buffer);
- ftMemo : AsMemo:=StrPas(Buffer);
- ftTime : AsTime:=FromTimeStamp(PInteger(Buffer)^,DateDelta);
- ftDate : Asdate:=FromTimeStamp(0,PInteger(Buffer)^);
- ftDateTime : AsDateTime:=TimeStampToDateTime(MSecsToTimeStamp(trunc(PDouble(Buffer)^)));
- ftCursor : FValue:=0;
- ftBlob,
- ftGraphic..ftTypedBinary,
- ftOraBlob,
- ftOraClob : SetBlobData(Buffer, StrLen(PChar(Buffer)));
- else
- DatabaseErrorFmt(SBadParamFieldType,[Name],DataSet);
- end;
- end;
|