Update von Lazarus und damit auch ZEOS auf Version 8.
Alte Projekte laufen nach einigen Anpassungen wieder, aber eines wehrt sich.
In der Unit ZDbcAdoStatement in der Procedure
procedure TZAdoPreparedStatement.SetTimestamp(Index: Integer;
{$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} AValue: TZTimeStamp);
kommt es zu einer Zugriffsverletzung, reading from address $0000000000000000.
Size ist 2 und beim Setzen auf 8 kommt der Fehler.
Kann es sein, dass {$IFNDEF GENERIC_INDEX}-1{$ENDIF} das Problem verursacht?
Wenn ich das richtig deute, wird ohne GENERIC_INDEX der Index um Eins verringert???
Code: Alles auswählen
procedure TZAdoPreparedStatement.SetTimestamp(Index: Integer;
{$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} AValue: TZTimeStamp);
var V: OleVariant;
label jmp_Assign;
begin
case CheckParameterIndex(Index{$IFNDEF GENERIC_INDEX}-1{$ENDIF}, stTimeStamp) of
adDBTimeStamp, adDBDate, adDBTime:
with FAdoCommand.Parameters[Index{$IFNDEF GENERIC_INDEX}-1{$ENDIF}] do begin
if Size <> 8 then //size is initializesd to ole record sizes are not 8
Size := 8; // but we can't assign it using the OleVariants -> set to Dbl size
goto jmp_Assign;
end;
adDate: begin
jmp_Assign: V := null;
tagVariant(V).vt := VT_DATE;
TryTimeStampToDateTime(AValue, PDateTime(@tagVariant(V).date)^);
FAdoCommand.Parameters[Index{$IFNDEF GENERIC_INDEX}-1{$ENDIF}].Value := V;
end;
adBSTR, adChar, adVarChar, adLongVarChar, adWChar, adVarWChar,
adLongVarWChar: SetPWideChar(Index, PWideChar(fByteBuffer), DateTimeToUni(AValue.Hour,
AValue.Minute, AValue.Second, AValue.Fractions, AValue.Hour, AValue.Minute,
AValue.Fractions, PWideChar(fByteBuffer),
ConSettings.WriteFormatSettings.TimeFormat, False, AValue.IsNegative));
else begin
TryTimeStampToDateTime(AValue, PDateTime(fByteBuffer)^);
SetDouble(Index, PDouble(fByteBuffer)^);
end;
end;
end;