Selaa lähdekoodia

fcl-db: base: +TParam.AsByte (for Delphi compatibility)

git-svn-id: trunk@49603 -
(cherry picked from commit ab86ce7e62db2add637961e3ff98a7703c86cb2c)
lacak 4 vuotta sitten
vanhempi
commit
aadb08980b
2 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 2 0
      packages/fcl-db/src/base/db.pas
  2. 8 0
      packages/fcl-db/src/base/dsparams.inc

+ 2 - 0
packages/fcl-db/src/base/db.pas

@@ -1278,6 +1278,7 @@ type
     Procedure SetAsBCD(const AValue: Currency);
     Procedure SetAsBCD(const AValue: Currency);
     Procedure SetAsBlob(const AValue: TBlobData);
     Procedure SetAsBlob(const AValue: TBlobData);
     Procedure SetAsBoolean(AValue: Boolean);
     Procedure SetAsBoolean(AValue: Boolean);
+    Procedure SetAsByte(const AValue: LongInt);
     Procedure SetAsBytes(const AValue: TBytes);
     Procedure SetAsBytes(const AValue: TBytes);
     Procedure SetAsCurrency(const AValue: Currency);
     Procedure SetAsCurrency(const AValue: Currency);
     Procedure SetAsDate(const AValue: TDateTime);
     Procedure SetAsDate(const AValue: TDateTime);
@@ -1317,6 +1318,7 @@ type
     Property AsBCD : Currency read GetAsCurrency write SetAsBCD;
     Property AsBCD : Currency read GetAsCurrency write SetAsBCD;
     Property AsBlob : TBlobData read GetAsBytes write SetAsBlob;
     Property AsBlob : TBlobData read GetAsBytes write SetAsBlob;
     Property AsBoolean : Boolean read GetAsBoolean write SetAsBoolean;
     Property AsBoolean : Boolean read GetAsBoolean write SetAsBoolean;
+    Property AsByte : LongInt read GetAsInteger write SetAsByte;
     Property AsBytes : TBytes read GetAsBytes write SetAsBytes;
     Property AsBytes : TBytes read GetAsBytes write SetAsBytes;
     Property AsCurrency : Currency read GetAsCurrency write SetAsCurrency;
     Property AsCurrency : Currency read GetAsCurrency write SetAsCurrency;
     Property AsDate : TDateTime read GetAsDateTime write SetAsDate;
     Property AsDate : TDateTime read GetAsDateTime write SetAsDate;

+ 8 - 0
packages/fcl-db/src/base/dsparams.inc

@@ -748,6 +748,12 @@ begin
   Value:=AValue;
   Value:=AValue;
 end;
 end;
 
 
+procedure TParam.SetAsByte(const AValue: LongInt);
+begin
+  FDataType:=ftByte;
+  Value:=AValue;
+end;
+
 Procedure TParam.SetAsBytes(const AValue: TBytes);
 Procedure TParam.SetAsBytes(const AValue: TBytes);
 begin
 begin
   FDataType:=ftVarBytes;
   FDataType:=ftVarBytes;
@@ -968,6 +974,7 @@ begin
   if Assigned(Field) then
   if Assigned(Field) then
     case FDataType of
     case FDataType of
       ftUnknown  : DatabaseErrorFmt(SUnknownParamFieldType,[Name],DataSet);
       ftUnknown  : DatabaseErrorFmt(SUnknownParamFieldType,[Name],DataSet);
+      ftByte     : Field.AsInteger:=AsByte;
       // Need TField.AsSmallInt
       // Need TField.AsSmallInt
       ftSmallint : Field.AsInteger:=AsSmallInt;
       ftSmallint : Field.AsInteger:=AsSmallInt;
       // Need TField.AsWord
       // Need TField.AsWord
@@ -1009,6 +1016,7 @@ begin
     FDataType:=Field.DataType;
     FDataType:=Field.DataType;
     case Field.DataType of
     case Field.DataType of
       ftUnknown  : DatabaseErrorFmt(SUnknownParamFieldType,[Name],DataSet);
       ftUnknown  : DatabaseErrorFmt(SUnknownParamFieldType,[Name],DataSet);
+      ftByte     : AsByte:=Field.AsInteger;
       // Need TField.AsSmallInt
       // Need TField.AsSmallInt
       ftSmallint : AsSmallint:=Field.AsInteger;
       ftSmallint : AsSmallint:=Field.AsInteger;
       // Need TField.AsWord
       // Need TField.AsWord