535 |
|
{ISQLParams} |
536 |
|
function getCount: integer; |
537 |
|
function getSQLParam(index: integer): ISQLParam; |
538 |
+ |
function ParamExists(Idx: AnsiString): boolean; |
539 |
|
function ByName(Idx: AnsiString): ISQLParam ; virtual; |
540 |
|
function GetModified: Boolean; |
541 |
|
function GetHasCaseSensitiveParams: Boolean; |
562 |
|
{IResults} |
563 |
|
function getCount: integer; |
564 |
|
function ByName(Idx: AnsiString): ISQLData; virtual; |
565 |
+ |
function FieldExists(Idx: AnsiString): boolean; |
566 |
|
function getSQLData(index: integer): ISQLData; |
567 |
|
procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte); |
568 |
|
function GetStatement: IStatement; |
1657 |
|
begin |
1658 |
|
case SQLType of |
1659 |
|
SQL_TEXT, SQL_VARYING: |
1660 |
< |
Result := NewNumeric(GetAsString); |
1660 |
> |
Result := StrToNumeric(GetAsString); |
1661 |
|
|
1662 |
|
SQL_SHORT: |
1663 |
|
Result := NumericFromRawValues(PShort(SQLData)^, Scale); |
1672 |
|
SQL_DEC34, |
1673 |
|
SQL_DEC_FIXED, |
1674 |
|
SQL_INT128: |
1675 |
< |
Result := NewNumeric(GetAsBCD); |
1675 |
> |
Result := BCDToNumeric(GetAsBCD); |
1676 |
|
|
1677 |
|
else |
1678 |
|
IBError(ibxeInvalidDataConversion, [nil]); |
1818 |
|
AsDouble := Value |
1819 |
|
else |
1820 |
|
if not CanChangeMetaData and ((SQLType <> SQL_INT64) or (Scale <> -4)) then |
1821 |
< |
SetAsNumeric(NewNumeric(Value)) |
1821 |
> |
SetAsNumeric(CurrToNumeric(Value)) |
1822 |
|
else |
1823 |
|
begin |
1824 |
|
Changing; |
1836 |
|
begin |
1837 |
|
CheckActive; |
1838 |
|
if not CanChangeMetaData and ((SQLType <> SQL_INT64) or (Scale <> 0)) then |
1839 |
< |
SetAsNumeric(NewNumeric(Value)) |
1839 |
> |
SetAsNumeric(IntToNumeric(Value)) |
1840 |
|
else |
1841 |
|
begin |
1842 |
|
Changing; |
1983 |
|
procedure TSQLDataItem.SetAsDouble(Value: Double); |
1984 |
|
begin |
1985 |
|
CheckActive; |
1986 |
< |
if IsNullable then |
1987 |
< |
IsNull := False; |
1986 |
> |
if not CanChangeMetaData and (SQLType <> SQL_DOUBLE) then |
1987 |
> |
SetAsNumeric(DoubleToNumeric(Value)) |
1988 |
> |
else |
1989 |
> |
begin |
1990 |
> |
if IsNullable then |
1991 |
> |
IsNull := False; |
1992 |
|
|
1993 |
< |
Changing; |
1994 |
< |
SQLType := SQL_DOUBLE; |
1995 |
< |
DataLength := SizeOf(Double); |
1996 |
< |
Scale := 0; |
1997 |
< |
PDouble(SQLData)^ := Value; |
1998 |
< |
Changed; |
1993 |
> |
Changing; |
1994 |
> |
SQLType := SQL_DOUBLE; |
1995 |
> |
DataLength := SizeOf(Double); |
1996 |
> |
Scale := 0; |
1997 |
> |
PDouble(SQLData)^ := Value; |
1998 |
> |
Changed; |
1999 |
> |
end; |
2000 |
|
end; |
2001 |
|
|
2002 |
|
procedure TSQLDataItem.SetAsFloat(Value: Float); |
2003 |
|
begin |
2004 |
|
CheckActive; |
2005 |
< |
if IsNullable then |
2006 |
< |
IsNull := False; |
2005 |
> |
if not CanChangeMetaData and (SQLType <> SQL_FLOAT) then |
2006 |
> |
SetAsNumeric(DoubleToNumeric(Value)) |
2007 |
> |
else |
2008 |
> |
begin |
2009 |
> |
if IsNullable then |
2010 |
> |
IsNull := False; |
2011 |
|
|
2012 |
< |
Changing; |
2013 |
< |
SQLType := SQL_FLOAT; |
2014 |
< |
DataLength := SizeOf(Float); |
2015 |
< |
Scale := 0; |
2016 |
< |
PSingle(SQLData)^ := Value; |
2017 |
< |
Changed; |
2012 |
> |
Changing; |
2013 |
> |
SQLType := SQL_FLOAT; |
2014 |
> |
DataLength := SizeOf(Float); |
2015 |
> |
Scale := 0; |
2016 |
> |
PSingle(SQLData)^ := Value; |
2017 |
> |
Changed; |
2018 |
> |
end; |
2019 |
|
end; |
2020 |
|
|
2021 |
|
procedure TSQLDataItem.SetAsLong(Value: Long); |
2022 |
|
begin |
2023 |
|
CheckActive; |
2024 |
|
if not CanChangeMetaData and ((SQLType <> SQL_LONG) or (Scale <> 0)) then |
2025 |
< |
SetAsNumeric(NewNumeric(Value)) |
2025 |
> |
SetAsNumeric(IntToNumeric(Value)) |
2026 |
|
else |
2027 |
|
begin |
2028 |
|
if IsNullable then |
2070 |
|
begin |
2071 |
|
CheckActive; |
2072 |
|
if not CanChangeMetaData and ((SQLType <> SQL_SHORT) or (Scale <> 0)) then |
2073 |
< |
SetAsNumeric(NewNumeric(Value)) |
2073 |
> |
SetAsNumeric(IntToNumeric(Value)) |
2074 |
|
else |
2075 |
|
begin |
2076 |
|
Changing; |
2101 |
|
else case VarType(Value) of |
2102 |
|
varEmpty, varNull: |
2103 |
|
IsNull := True; |
2104 |
< |
varSmallint, varInteger, varByte, |
2104 |
> |
varSmallint, varInteger, varByte, varLongWord, |
2105 |
|
varWord, varShortInt, varInt64: |
2106 |
< |
SetAsNumeric(NewNumeric(Int64(Value))); |
2106 |
> |
SetAsNumeric(IntToNumeric(Int64(Value))); |
2107 |
|
varSingle, varDouble: |
2108 |
|
AsDouble := Value; |
2109 |
|
varCurrency: |
2110 |
< |
SetAsNumeric(NewNumeric(Currency(Value))); |
2110 |
> |
SetAsNumeric(CurrToNumeric(Currency(Value))); |
2111 |
|
varBoolean: |
2112 |
|
AsBoolean := Value; |
2113 |
|
varDate: |
2144 |
|
with FFirebirdClientAPI do |
2145 |
|
case GetSQLType of |
2146 |
|
SQL_LONG: |
2147 |
< |
PLong(SQLData)^ := SafeInteger(Value.clone(Scale).getRawValue); |
2147 |
> |
PLong(SQLData)^ := SafeInteger(Value.AdjustScaleTo(Scale).getRawValue); |
2148 |
|
SQL_SHORT: |
2149 |
< |
PShort(SQLData)^ := SafeSmallInt(Value.clone(Scale).getRawValue); |
2149 |
> |
PShort(SQLData)^ := SafeSmallInt(Value.AdjustScaleTo(Scale).getRawValue); |
2150 |
|
SQL_INT64: |
2151 |
< |
PInt64(SQLData)^ := Value.clone(Scale).getRawValue; |
2151 |
> |
PInt64(SQLData)^ := Value.AdjustScaleTo(Scale).getRawValue; |
2152 |
|
SQL_TEXT, SQL_VARYING: |
2153 |
|
SetAsString(Value.getAsString); |
2154 |
|
SQL_D_FLOAT, |
2177 |
|
|
2178 |
|
if not CanChangeMetaData then |
2179 |
|
begin |
2180 |
< |
SetAsNumeric(NewNumeric(aValue)); |
2180 |
> |
SetAsNumeric(BCDToNumeric(aValue)); |
2181 |
|
Exit; |
2182 |
|
end; |
2183 |
|
|
2512 |
|
SQL_DEC34, |
2513 |
|
SQL_INT128: |
2514 |
|
if TryStrToBCD(Value,BCDValue) then |
2515 |
< |
SetAsNumeric(NewNumeric(BCDValue)) |
2515 |
> |
SetAsNumeric(BCDToNumeric(BCDValue)) |
2516 |
|
else |
2517 |
|
DoSetString; |
2518 |
|
|
3293 |
|
end; |
3294 |
|
end; |
3295 |
|
|
3296 |
+ |
function TSQLParams.ParamExists(Idx: AnsiString): boolean; |
3297 |
+ |
begin |
3298 |
+ |
CheckActive; |
3299 |
+ |
Result := FSQLParams.ColumnByName(Idx) <> nil; |
3300 |
+ |
end; |
3301 |
+ |
|
3302 |
|
function TSQLParams.ByName(Idx: AnsiString): ISQLParam; |
3303 |
|
var aIBXSQLVAR: TSQLVarData; |
3304 |
|
begin |
3418 |
|
end; |
3419 |
|
end; |
3420 |
|
|
3421 |
+ |
function TResults.FieldExists(Idx: AnsiString): boolean; |
3422 |
+ |
begin |
3423 |
+ |
Result := FResults.ColumnByName(Idx) <> nil; |
3424 |
+ |
end; |
3425 |
+ |
|
3426 |
|
function TResults.getSQLData(index: integer): ISQLData; |
3427 |
|
begin |
3428 |
|
CheckActive; |