On my application I have some forms and a datamodule to store all the database stuff, but when I try to save some information to the database one end; command causes a SIGSEV with ZDbcCache on line 795 (Index :=-1; the line content), but if I change the end position this works well (or I suppose so), but the problem is that the same end works on the other forms that I have, so this end placement is a (visual) exception only in my 'place register' form.
Using Lazarus 1.6 and Zeos 7.1.4
Hier is how I use the code in the User Register Form
Code: Select all
try
with datam.qry do begin
datam.connection.AutoCommit:=True;
datam.connection.StartTransaction;
SQL.Clear;
SQL.Text='INSERT INTO ...';
ParamByName('param').AsString:=tedit.Text;
ParamByName('param').AsInteger:=combobox.ItemIndex;
ExecSQL;
try
datam.connection.Commit;
clear_data_fields;
except
datam.Rollback;
ShowMessage('Error');
end;
end; //this end is fine and before the second try end;
except
ShowMessage('Impossible to connect to the database');
end;
Code: Select all
try
with datam.qry do begin
datam.connection.AutoCommit:=True;
datam.connection.StartTransaction;
SQL.Clear;
SQL.Text='INSERT INTO ...';
ParamByName('param').AsString:=tedit.Text;
ParamByName('param').AsInteger:=combobox.ItemIndex;
ExecSQL;
end; //in the Place Register form I'm obliged to use it hier
try
datam.connection.Commit;
clear_data_fields;
except
datam.Rollback;
ShowMessage('Error');
end;
except
ShowMessage('Impossible to connect to the database');
end;
Code: Select all
{**
Cleans the specified row buffer.
@param Buffer a pointer to row buffer.
}
procedure TZRowAccessor.ClearBuffer(Buffer: PZRowBuffer);
var
I: Integer;
P: PPointer;
begin
with Buffer^ do
begin
Index := -1; //LINE 795
UpdateType := utUnmodified;
BookmarkFlag := 0;
for I := 0 to FColumnCount - 1 do
case FColumnTypes[I] of
stAsciiStream, stUnicodeStream, stBinaryStream:
if (Columns[FColumnOffsets[I]] = 0) then
SetBlobObject(Buffer, I + 1, nil);
stBytes,stGUID,stString, stUnicodeString:
if PNativeUInt(@Columns[FColumnOffsets[I] +1])^ > 0 then
begin
P := PPointer(@Columns[FColumnOffsets[I] +1]);
System.Dispose(P^);
end;
end;
FillChar(Columns, FColumnsSize, 0);
for I := 0 to FColumnCount - 1 do Columns[FColumnOffsets[I]] := 1;
end;
end;