Problem with Firebird and QRDesign
Posted: 21.10.2009, 19:30
When you have different domains (especially Short Integers) in your Firebird DB and you are using QRDesign, everytime an exception will be thrown here. Can you fix this please? Using Zeos now on Delphi 2009 and it's working really great. Thanks for your effort!
Klaus
procedure TZParamsSQLDA.UpdateString(const Index: Integer; Value: AnsiString);
var
SQLCode: SmallInt;
Stream: TStream;
begin
CheckRange(Index);
// SetFieldType(Index, Length(Value) + 1, SQL_TEXT + 1, 0);
{$R-}
with FXSQLDA.sqlvar[Index] do
begin
if (sqlind <> nil) and (sqlind^ = -1) then
Exit;
SQLCode := (sqltype and not(1));
case SQLCode of
SQL_TEXT : EncodeString(SQL_TEXT, Index, Value);
SQL_VARYING : EncodeString(SQL_VARYING, Index, Value);
SQL_SHORT : PInteger(sqldata)^ := StrToInt(Value); //This line was added!!!
SQL_LONG : PInteger(sqldata)^ := StrToInt(Value);
SQL_TYPE_DATE : EncodeString(SQL_DATE, Index, Value);
SQL_BLOB:
begin
Stream := TStringStream.Create(Value);
try
WriteBlob(index, Stream);
finally
Stream.Free;
end;
end;
else begin
raise EZIBConvertError.Create(SErrorConvertion);
end;
end;
if (sqlind <> nil) then
sqlind^ := 0; // not null
end;
{$IFOPT D+}
{$R+}
{$ENDIF}
end;
Klaus
procedure TZParamsSQLDA.UpdateString(const Index: Integer; Value: AnsiString);
var
SQLCode: SmallInt;
Stream: TStream;
begin
CheckRange(Index);
// SetFieldType(Index, Length(Value) + 1, SQL_TEXT + 1, 0);
{$R-}
with FXSQLDA.sqlvar[Index] do
begin
if (sqlind <> nil) and (sqlind^ = -1) then
Exit;
SQLCode := (sqltype and not(1));
case SQLCode of
SQL_TEXT : EncodeString(SQL_TEXT, Index, Value);
SQL_VARYING : EncodeString(SQL_VARYING, Index, Value);
SQL_SHORT : PInteger(sqldata)^ := StrToInt(Value); //This line was added!!!
SQL_LONG : PInteger(sqldata)^ := StrToInt(Value);
SQL_TYPE_DATE : EncodeString(SQL_DATE, Index, Value);
SQL_BLOB:
begin
Stream := TStringStream.Create(Value);
try
WriteBlob(index, Stream);
finally
Stream.Free;
end;
end;
else begin
raise EZIBConvertError.Create(SErrorConvertion);
end;
end;
if (sqlind <> nil) then
sqlind^ := 0; // not null
end;
{$IFOPT D+}
{$R+}
{$ENDIF}
end;