ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/client/FBSQLData.pas
(Generate patch)

Comparing ibx/branches/udr/client/FBSQLData.pas (file contents):
Revision 373 by tony, Thu Jan 6 14:14:57 2022 UTC vs.
Revision 381 by tony, Sat Jan 15 00:06:22 2022 UTC

# Line 1655 | Line 1655 | var aValue: Int64;
1655   begin
1656    case SQLType of
1657     SQL_TEXT, SQL_VARYING:
1658 <     Result := NewNumeric(GetAsString);
1658 >     Result := StrToNumeric(GetAsString);
1659  
1660     SQL_SHORT:
1661       Result := NumericFromRawValues(PShort(SQLData)^, Scale);
# Line 1670 | Line 1670 | begin
1670     SQL_DEC34,
1671     SQL_DEC_FIXED,
1672     SQL_INT128:
1673 <     Result := NewNumeric(GetAsBCD);
1673 >     Result := BCDToNumeric(GetAsBCD);
1674  
1675     else
1676       IBError(ibxeInvalidDataConversion, [nil]);
# Line 1816 | Line 1816 | begin
1816      AsDouble := Value
1817    else
1818    if not CanChangeMetaData and ((SQLType <> SQL_INT64) or (Scale <> -4)) then
1819 <    SetAsNumeric(NewNumeric(Value))
1819 >    SetAsNumeric(CurrToNumeric(Value))
1820    else
1821    begin
1822      Changing;
# Line 1834 | Line 1834 | procedure TSQLDataItem.SetAsInt64(Value:
1834   begin
1835    CheckActive;
1836    if not CanChangeMetaData and ((SQLType <> SQL_INT64) or (Scale <> 0)) then
1837 <    SetAsNumeric(NewNumeric(Value))
1837 >    SetAsNumeric(IntToNumeric(Value))
1838    else
1839    begin
1840      Changing;
# Line 1981 | Line 1981 | end;
1981   procedure TSQLDataItem.SetAsDouble(Value: Double);
1982   begin
1983    CheckActive;
1984 <  if IsNullable then
1985 <    IsNull := False;
1984 >  if not CanChangeMetaData and (SQLType <> SQL_DOUBLE) then
1985 >    SetAsNumeric(DoubleToNumeric(Value))
1986 >  else
1987 >  begin
1988 >    if IsNullable then
1989 >      IsNull := False;
1990  
1991 <  Changing;
1992 <  SQLType := SQL_DOUBLE;
1993 <  DataLength := SizeOf(Double);
1994 <  Scale := 0;
1995 <  PDouble(SQLData)^ := Value;
1996 <  Changed;
1991 >    Changing;
1992 >    SQLType := SQL_DOUBLE;
1993 >    DataLength := SizeOf(Double);
1994 >    Scale := 0;
1995 >    PDouble(SQLData)^ := Value;
1996 >    Changed;
1997 >  end;
1998   end;
1999  
2000   procedure TSQLDataItem.SetAsFloat(Value: Float);
2001   begin
2002    CheckActive;
2003 <  if IsNullable then
2004 <    IsNull := False;
2003 >  if not CanChangeMetaData and (SQLType <> SQL_FLOAT) then
2004 >    SetAsNumeric(DoubleToNumeric(Value))
2005 >  else
2006 >  begin
2007 >    if IsNullable then
2008 >      IsNull := False;
2009  
2010 <  Changing;
2011 <  SQLType := SQL_FLOAT;
2012 <  DataLength := SizeOf(Float);
2013 <  Scale := 0;
2014 <  PSingle(SQLData)^ := Value;
2015 <  Changed;
2010 >    Changing;
2011 >    SQLType := SQL_FLOAT;
2012 >    DataLength := SizeOf(Float);
2013 >    Scale := 0;
2014 >    PSingle(SQLData)^ := Value;
2015 >    Changed;
2016 >  end;
2017   end;
2018  
2019   procedure TSQLDataItem.SetAsLong(Value: Long);
2020   begin
2021    CheckActive;
2022    if not CanChangeMetaData and ((SQLType <> SQL_LONG) or (Scale <> 0)) then
2023 <    SetAsNumeric(NewNumeric(Value))
2023 >    SetAsNumeric(IntToNumeric(Value))
2024    else
2025    begin
2026      if IsNullable then
# Line 2058 | Line 2068 | procedure TSQLDataItem.SetAsShort(Value:
2068   begin
2069    CheckActive;
2070    if not CanChangeMetaData and ((SQLType <> SQL_SHORT) or (Scale <> 0)) then
2071 <    SetAsNumeric(NewNumeric(Value))
2071 >    SetAsNumeric(IntToNumeric(Value))
2072    else
2073    begin
2074      Changing;
# Line 2089 | Line 2099 | begin
2099    else case VarType(Value) of
2100      varEmpty, varNull:
2101        IsNull := True;
2102 <    varSmallint, varInteger, varByte,
2102 >    varSmallint, varInteger, varByte, varLongWord,
2103        varWord, varShortInt, varInt64:
2104 <        SetAsNumeric(NewNumeric(Int64(Value)));
2104 >        SetAsNumeric(IntToNumeric(Int64(Value)));
2105      varSingle, varDouble:
2106        AsDouble := Value;
2107      varCurrency:
2108 <      SetAsNumeric(NewNumeric(Currency(Value)));
2108 >      SetAsNumeric(CurrToNumeric(Currency(Value)));
2109      varBoolean:
2110        AsBoolean := Value;
2111      varDate:
# Line 2132 | Line 2142 | begin
2142    with FFirebirdClientAPI do
2143    case GetSQLType of
2144    SQL_LONG:
2145 <      PLong(SQLData)^ := SafeInteger(Value.clone(Scale).getRawValue);
2145 >      PLong(SQLData)^ := SafeInteger(Value.AdjustScaleTo(Scale).getRawValue);
2146    SQL_SHORT:
2147 <    PShort(SQLData)^ := SafeSmallInt(Value.clone(Scale).getRawValue);
2147 >    PShort(SQLData)^ := SafeSmallInt(Value.AdjustScaleTo(Scale).getRawValue);
2148    SQL_INT64:
2149 <    PInt64(SQLData)^ := Value.clone(Scale).getRawValue;
2149 >    PInt64(SQLData)^ := Value.AdjustScaleTo(Scale).getRawValue;
2150    SQL_TEXT, SQL_VARYING:
2151     SetAsString(Value.getAsString);
2152    SQL_D_FLOAT,
# Line 2165 | Line 2175 | begin
2175  
2176    if not CanChangeMetaData then
2177    begin
2178 <    SetAsNumeric(NewNumeric(aValue));
2178 >    SetAsNumeric(BCDToNumeric(aValue));
2179      Exit;
2180    end;
2181  
# Line 2500 | Line 2510 | begin
2510    SQL_DEC34,
2511    SQL_INT128:
2512      if TryStrToBCD(Value,BCDValue) then
2513 <      SetAsNumeric(NewNumeric(BCDValue))
2513 >      SetAsNumeric(BCDToNumeric(BCDValue))
2514      else
2515        DoSetString;
2516  

Comparing ibx/branches/udr/client/FBSQLData.pas (property svn:eol-style):
Revision 373 by tony, Thu Jan 6 14:14:57 2022 UTC vs.
Revision 381 by tony, Sat Jan 15 00:06:22 2022 UTC

# Line 0 | Line 1
1 + native

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines