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/trunk/fbintf/client/FBSQLData.pas (file contents):
Revision 58 by tony, Mon Mar 6 10:20:02 2017 UTC vs.
Revision 59 by tony, Mon Mar 13 09:51:56 2017 UTC

# Line 162 | Line 162 | type
162       procedure SetAsShort(Value: short); virtual;
163       procedure SetAsString(Value: AnsiString); virtual;
164       procedure SetAsVariant(Value: Variant);
165 +     procedure SetAsNumeric(Value: Int64; aScale: integer);
166       procedure SetIsNull(Value: Boolean); virtual;
167       procedure SetIsNullable(Value: Boolean); virtual;
168       procedure SetName(aValue: AnsiString); virtual;
# Line 1629 | Line 1630 | begin
1630    end;
1631   end;
1632  
1633 + procedure TSQLDataItem.SetAsNumeric(Value: Int64; aScale: integer);
1634 + begin
1635 +  CheckActive;
1636 +  Changing;
1637 +  if IsNullable then
1638 +    IsNull := False;
1639 +
1640 +  SQLType := SQL_INT64;
1641 +  Scale := aScale;
1642 +  DataLength := SizeOf(Int64);
1643 +  PInt64(SQLData)^ := Value;
1644 +  Changed;
1645 + end;
1646 +
1647   procedure TSQLDataItem.SetAsBoolean(AValue: boolean);
1648   begin
1649    CheckActive;
# Line 1841 | Line 1856 | end;
1856  
1857   procedure TSQLParam.InternalSetAsString(Value: AnsiString);
1858   var b: IBlob;
1859 +    dt: TDateTime;
1860   begin
1861    CheckActive;
1862    if IsNullable then
# Line 1875 | Line 1891 | begin
1891      SQL_SHORT,
1892      SQL_LONG,
1893      SQL_INT64:
1894 <      SetAsInt64(StrToInt(Value));
1894 >      SetAsNumeric(AdjustScaleFromCurrency(StrToCurr(Value),GetScale),GetScale);
1895  
1896      SQL_D_FLOAT,
1897      SQL_DOUBLE,
# Line 1883 | Line 1899 | begin
1899        SetAsDouble(StrToFloat(Value));
1900  
1901      SQL_TIMESTAMP:
1902 <      SetAsDateTime(StrToDateTime(Value));
1902 >      if TryStrToDateTime(Value,dt) then
1903 >        SetAsDateTime(dt)
1904 >      else
1905 >        FIBXSQLVar.SetString(Value);
1906  
1907      SQL_TYPE_DATE:
1908 <      SetAsDate(StrToDateTime(Value));
1908 >      if TryStrToDateTime(Value,dt) then
1909 >        SetAsDate(dt)
1910 >      else
1911 >        FIBXSQLVar.SetString(Value);
1912  
1913      SQL_TYPE_TIME:
1914 <      SetAsTime(StrToDateTime(Value));
1914 >      if TryStrToDateTime(Value,dt) then
1915 >        SetAsTime(dt)
1916 >      else
1917 >        FIBXSQLVar.SetString(Value);
1918  
1919      else
1920        IBError(ibxeInvalidDataConversion,[nil]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines