Cached updates, filter, moving position in datalink, user data input -> access violation in SDAC
Cached updates, filter, moving position in datalink, user data input -> access violation in SDAC
Hi,
I'm having trouble with the newest version of SDAC. I need some special drawing in TDBGrid - I've written an TDBGrid descendant and overriden the Paint method to scan all the rows visible in grid:
procedure TMyDBGrid.Paint;
var
i, oldactiverec: integer;
begin
oldactiverec := Datalink.ActiveRecord;
try
for i := 0 to Datalink.BufferCount - 1 do begin
Datalink.ActiveRecord := i;
if datasource.dataset.fields[0].AsVariant = '1' then begin
// some processing
end;
end;
finally
Datalink.ActiveRecord := oldactiverec;
end;
inherited;
end;
It worked fine using BDE and it works also fine using SDAC, but an access vilotation (sometimes only an assert) occurs somewhere in SDAC units under following circumstances:
1. the TMSQuery shown in the grid has active cached updates
2. the TMSQuery is filtered and some rows are because of this filter not visible
3. user begins to the change data in the grid - immediately after keypress this AV occurs
Do you have an idea? I could send you the example.
Thanks.
I'm having trouble with the newest version of SDAC. I need some special drawing in TDBGrid - I've written an TDBGrid descendant and overriden the Paint method to scan all the rows visible in grid:
procedure TMyDBGrid.Paint;
var
i, oldactiverec: integer;
begin
oldactiverec := Datalink.ActiveRecord;
try
for i := 0 to Datalink.BufferCount - 1 do begin
Datalink.ActiveRecord := i;
if datasource.dataset.fields[0].AsVariant = '1' then begin
// some processing
end;
end;
finally
Datalink.ActiveRecord := oldactiverec;
end;
inherited;
end;
It worked fine using BDE and it works also fine using SDAC, but an access vilotation (sometimes only an assert) occurs somewhere in SDAC units under following circumstances:
1. the TMSQuery shown in the grid has active cached updates
2. the TMSQuery is filtered and some rows are because of this filter not visible
3. user begins to the change data in the grid - immediately after keypress this AV occurs
Do you have an idea? I could send you the example.
Thanks.
I'm using full version 3.55.0.16 and delphi 7 now.
I removed the ExceptionLog - without any change, still access violation.
I tried it on 2 workstations (windows server 2003 and windows 2000) - exception on both of them.
I simply start the exe, jump to the column "summe" a press there "1" - immediate exception.
Should I send you also the compiled executable and the test-database?
I removed the ExceptionLog - without any change, still access violation.
I tried it on 2 workstations (windows server 2003 and windows 2000) - exception on both of them.
I simply start the exe, jump to the column "summe" a press there "1" - immediate exception.
Should I send you also the compiled executable and the test-database?
this is the generated database creation script (the datarows are same as in the sent example) - perhaps some problem with collation order (?)
CREATE DATABASE [test] ON (NAME = N'test', FILENAME = N'C:\Programme\Microsoft SQL Server\MSSQL\data\test.mdf' , SIZE = 1, FILEGROWTH = 10%) LOG ON (NAME = N'test_log', FILENAME = N'C:\Programme\Microsoft SQL Server\MSSQL\data\test_log.LDF' , FILEGROWTH = 10%)
COLLATE Latin1_General_CI_AS
GO
exec sp_dboption N'test', N'autoclose', N'false'
GO
exec sp_dboption N'test', N'bulkcopy', N'false'
GO
exec sp_dboption N'test', N'trunc. log', N'false'
GO
exec sp_dboption N'test', N'torn page detection', N'true'
GO
exec sp_dboption N'test', N'read only', N'false'
GO
exec sp_dboption N'test', N'dbo use', N'false'
GO
exec sp_dboption N'test', N'single', N'false'
GO
exec sp_dboption N'test', N'autoshrink', N'false'
GO
exec sp_dboption N'test', N'ANSI null default', N'false'
GO
exec sp_dboption N'test', N'recursive triggers', N'false'
GO
exec sp_dboption N'test', N'ANSI nulls', N'false'
GO
exec sp_dboption N'test', N'concat null yields null', N'false'
GO
exec sp_dboption N'test', N'cursor close on commit', N'false'
GO
exec sp_dboption N'test', N'default to local cursor', N'false'
GO
exec sp_dboption N'test', N'quoted identifier', N'false'
GO
exec sp_dboption N'test', N'ANSI warnings', N'false'
GO
exec sp_dboption N'test', N'auto create statistics', N'true'
GO
exec sp_dboption N'test', N'auto update statistics', N'true'
GO
if( ( (@@microsoftversion / power(2, 24) =
and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
exec sp_dboption N'test', N'db chaining', N'false'
GO
use [test]
GO
CREATE TABLE [dbo].[handytarife] (
[name] [char] (40) COLLATE Latin1_General_CI_AS NULL
) ON [PRIMARY]
GO
CREATE DATABASE [test] ON (NAME = N'test', FILENAME = N'C:\Programme\Microsoft SQL Server\MSSQL\data\test.mdf' , SIZE = 1, FILEGROWTH = 10%) LOG ON (NAME = N'test_log', FILENAME = N'C:\Programme\Microsoft SQL Server\MSSQL\data\test_log.LDF' , FILEGROWTH = 10%)
COLLATE Latin1_General_CI_AS
GO
exec sp_dboption N'test', N'autoclose', N'false'
GO
exec sp_dboption N'test', N'bulkcopy', N'false'
GO
exec sp_dboption N'test', N'trunc. log', N'false'
GO
exec sp_dboption N'test', N'torn page detection', N'true'
GO
exec sp_dboption N'test', N'read only', N'false'
GO
exec sp_dboption N'test', N'dbo use', N'false'
GO
exec sp_dboption N'test', N'single', N'false'
GO
exec sp_dboption N'test', N'autoshrink', N'false'
GO
exec sp_dboption N'test', N'ANSI null default', N'false'
GO
exec sp_dboption N'test', N'recursive triggers', N'false'
GO
exec sp_dboption N'test', N'ANSI nulls', N'false'
GO
exec sp_dboption N'test', N'concat null yields null', N'false'
GO
exec sp_dboption N'test', N'cursor close on commit', N'false'
GO
exec sp_dboption N'test', N'default to local cursor', N'false'
GO
exec sp_dboption N'test', N'quoted identifier', N'false'
GO
exec sp_dboption N'test', N'ANSI warnings', N'false'
GO
exec sp_dboption N'test', N'auto create statistics', N'true'
GO
exec sp_dboption N'test', N'auto update statistics', N'true'
GO
if( ( (@@microsoftversion / power(2, 24) =

exec sp_dboption N'test', N'db chaining', N'false'
GO
use [test]
GO
CREATE TABLE [dbo].[handytarife] (
[name] [char] (40) COLLATE Latin1_General_CI_AS NULL
) ON [PRIMARY]
GO
Thank you for example, we reproduce the problem.
The reason of the problem is that in the loop of drawing ActiveRecords greater then must fit for specified filter are chosen. Standard DBGrid as a loop parameter uses DataLink.DataSource.DataSet.FRecordCount (see TCustomDBGrid.UpdateRowCount).
At your case it would be correct to use the same algorithm.
The reason of the problem is that in the loop of drawing ActiveRecords greater then must fit for specified filter are chosen. Standard DBGrid as a loop parameter uses DataLink.DataSource.DataSet.FRecordCount (see TCustomDBGrid.UpdateRowCount).
At your case it would be correct to use the same algorithm.