ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/IBCustomDataSet.pas
(Generate patch)

Comparing ibx/trunk/runtime/IBCustomDataSet.pas (file contents):
Revision 105 by tony, Thu Jan 18 14:37:32 2018 UTC vs.
Revision 106 by tony, Thu Jan 18 14:37:35 2018 UTC

# Line 2074 | Line 2074 | procedure TIBCustomDataSet.ColumnDataToB
2074                 ColumnIndex, FieldIndex: integer; Buffer: PChar);
2075   var
2076    LocalData: PByte;
2077 <  LocalDate, LocalDouble: Double;
2077 >  LocalDate: TDateTime;
2078 >  LocalDouble: Double;
2079    LocalInt: Integer;
2080    LocalBool: wordBool;
2081    LocalInt64: Int64;
# Line 2089 | Line 2090 | begin
2090      begin
2091        ColData := QryResults[ColumnIndex];
2092        case fdDataType of  {Get Formatted data for column types that need formatting}
2093 +        SQL_TYPE_DATE,
2094 +        SQL_TYPE_TIME,
2095          SQL_TIMESTAMP:
2096          begin
2097 <          LocalDate := TimeStampToMSecs(DateTimeToTimeStamp(ColData.AsDateTime));
2097 >          {This is an IBX native format and not the TDataset approach. See also GetFieldData}
2098 >          LocalDate := ColData.AsDateTime;
2099            LocalData := PByte(@LocalDate);
2100          end;
2097        SQL_TYPE_DATE:
2098        begin
2099          LocalInt := DateTimeToTimeStamp(ColData.AsDateTime).Date;
2100          LocalData := PByte(@LocalInt);
2101        end;
2102        SQL_TYPE_TIME:
2103        begin
2104          LocalInt := DateTimeToTimeStamp(ColData.AsDateTime).Time;
2105          LocalData := PByte(@LocalInt);
2106        end;
2101          SQL_SHORT, SQL_LONG:
2102          begin
2103            if (fdDataScale = 0) then
# Line 2829 | Line 2823 | begin
2823              end;
2824              SQL_BLOB, SQL_ARRAY, SQL_QUAD:
2825                Param.AsQuad := PISC_QUAD(data)^;
2826 <            SQL_TYPE_DATE:
2827 <            begin
2834 <              ts.Date := PInt(data)^;
2835 <              ts.Time := 0;
2836 <              Param.AsDate := TimeStampToDateTime(ts);
2837 <            end;
2838 <            SQL_TYPE_TIME:
2839 <            begin
2840 <              ts.Date := 0;
2841 <              ts.Time := PInt(data)^;
2842 <              Param.AsTime := TimeStampToDateTime(ts);
2843 <            end;
2826 >            SQL_TYPE_DATE,
2827 >            SQL_TYPE_TIME,
2828              SQL_TIMESTAMP:
2829 <              Param.AsDateTime :=
2830 <                       TimeStampToDateTime(MSecsToTimeStamp(trunc(PDouble(data)^)));
2829 >            {This is an IBX native format and not the TDataset approach. See also SetFieldData}
2830 >              Param.AsDateTime := PDateTime(data)^;
2831              SQL_BOOLEAN:
2832                Param.AsBoolean := PWordBool(data)^;
2833            end;
# Line 4170 | Line 4154 | begin
4154      for i := 0 to SQLParams.GetCount - 1 do
4155      begin
4156        cur_field := DataSource.DataSet.FindField(SQLParams[i].Name);
4157 <      cur_param := SQLParams[i];
4158 <      if (cur_field <> nil) then begin
4157 >      if (cur_field <> nil) then
4158 >      begin
4159 >        cur_param := SQLParams[i];
4160          if (cur_field.IsNull) then
4161            cur_param.IsNull := True
4162 <        else case cur_field.DataType of
4162 >        else
4163 >        case cur_field.DataType of
4164            ftString:
4165              cur_param.AsString := cur_field.AsString;
4166            ftBoolean:
# Line 4184 | Line 4170 | begin
4170            ftInteger:
4171              cur_param.AsLong := cur_field.AsInteger;
4172            ftLargeInt:
4173 <            cur_param.AsInt64 := TLargeIntField(cur_field).AsLargeInt;
4173 >            cur_param.AsInt64 := cur_field.AsLargeInt;
4174            ftFloat, ftCurrency:
4175             cur_param.AsDouble := cur_field.AsFloat;
4176            ftBCD:
# Line 4938 | Line 4924 | end;
4924   function TIBCustomDataSet.GetFieldData(Field: TField; Buffer: Pointer;
4925    NativeFormat: Boolean): Boolean;
4926   begin
4927 <  if (Field.DataType = ftBCD) and not NativeFormat then
4927 >  {These datatypes use IBX conventions and not TDataset conventions}
4928 >  if (Field.DataType in [ftBCD,ftDateTime,ftDate,ftTime]) and not NativeFormat then
4929      Result := InternalGetFieldData(Field, Buffer)
4930    else
4931      Result := inherited GetFieldData(Field, Buffer, NativeFormat);
# Line 4964 | Line 4951 | end;
4951   procedure TIBCustomDataSet.SetFieldData(Field: TField; Buffer: Pointer;
4952    NativeFormat: Boolean);
4953   begin
4954 <  if (not NativeFormat) and (Field.DataType = ftBCD) then
4954 >  {These datatypes use IBX conventions and not TDataset conventions}
4955 >  if (not NativeFormat) and (Field.DataType in [ftBCD,ftDateTime,ftDate,ftTime]) then
4956      InternalSetfieldData(Field, Buffer)
4957    else
4958      inherited SetFieldData(Field, buffer, NativeFormat);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines