535 |
|
{ISQLParams} |
536 |
|
function getCount: integer; |
537 |
|
function getSQLParam(index: integer): ISQLParam; |
538 |
< |
function ByName(Idx: AnsiString): ISQLParam ; |
538 |
> |
function ByName(Idx: AnsiString): ISQLParam ; virtual; |
539 |
|
function GetModified: Boolean; |
540 |
|
function GetHasCaseSensitiveParams: Boolean; |
541 |
|
function GetStatement: IStatement; |
560 |
|
constructor Create(aResults: TSQLDataArea); |
561 |
|
{IResults} |
562 |
|
function getCount: integer; |
563 |
< |
function ByName(Idx: AnsiString): ISQLData; |
563 |
> |
function ByName(Idx: AnsiString): ISQLData; virtual; |
564 |
|
function getSQLData(index: integer): ISQLData; |
565 |
|
procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte); |
566 |
|
function GetStatement: IStatement; |
874 |
|
Scale := 0; |
875 |
|
if (SQLType <> SQL_VARYING) and (SQLType <> SQL_TEXT) then |
876 |
|
IBError(ibxeUnableTosetaTextType,[Index,Name,TSQLDataItem.GetSQLTypeName(SQLType)]); |
877 |
+ |
if not CanChangeMetaData and (Length(aValue) > GetSize) then |
878 |
+ |
IBError(ibxeStringOverflow,[Length(aValue),DataLength]); |
879 |
|
SetSQLData(PByte(PAnsiChar(FVarString)),Length(aValue)); |
880 |
|
end; |
881 |
|
|
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); |
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]); |
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; |
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; |
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 |
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; |
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: |
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, |
2175 |
|
|
2176 |
|
if not CanChangeMetaData then |
2177 |
|
begin |
2178 |
< |
SetAsNumeric(NewNumeric(aValue)); |
2178 |
> |
SetAsNumeric(BCDToNumeric(aValue)); |
2179 |
|
Exit; |
2180 |
|
end; |
2181 |
|
|
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 |
|
|