Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 10 of 18 total |
AV on closing a query - NOTE! v3.30!!! |
Tue, Mar 17 2009 4:25 PM | Permanent Link |
"Jeff Cook" | Kia Orana All - particularly the ancient ones still running DBSIAM v3!
I'm getting an AV on closing a query. Stepping through the code I get to the marked line below and get the AV ------------------------------------ procedure TUnusedTenants.ActivateQuery; begin if (pickBefore.Date <> dtLast) or (sPMLast <> cboPM.Text) then try dtLast := pickBefore.Date; sPMLast := cboPM.Text; Screen.Cursor := crSQLWait; StatusBar1.Panels[0].Text := 'Checking Tenants'; Application.ProcessMessages; with qryTenants do begin Close; // <<< AV here!!!! <<<<<<<<<<<<<<<<<<<<<<<<<< if cboPM.Text = 'ALL' then SQL[9] := '' else SQL[9] := 'AND UPPER(PM.Name) = ' + QuotedStr(UpperCase(cboPM.Text)); ParamByName('BeforeDate').AsDate := pickBefore.Date; Open; StatusBar1.Panels[0].Text := IntToStr(RecordCount) + ' Tenants found'; end; finally grdTenants.SetFocus; Screen.Cursor := crDefault; end; end; ------------------------------------ I "OK" the AV message and end up in DBISAMEN.pas here:- procedure TDataCursor.CheckForChangeDetection; begin >>>> here >>>> if FDataDirectory.DataSession.StrictChangeDetection then ReadLockTable else CheckForCursorChanges; end; ------------------------------------ Whatever is going on? I'm in a bit of code that I haven't touched for yonks and have no idea how to proceed. Any suggestions welcome (yeah, yeah I know ... upgrade to v4 or EDB - but that is a major mission!) Kia Manuia Jeff ----------------- Here is some stuff from madExcept ... exception class : EAccessViolation exception message : Access violation at address 005EDA66 in module 'apm.exe'. Read of address 00000004. main thread ($e34): 005eda66 +00a apm.exe dbisamen 9967 +1 TDataCursor.CheckForChangeDetection 0060220f +01f apm.exe dbisamen 21684 +3 TDataCursor.ResetFilter 005b8b46 +056 apm.exe dbisamsq 6305 +2 TDataQuery.BuildSubSelectFilter 0064158c +768 apm.exe dbisamlb 11445 +226 EvaluateExpressionToken 00640f31 +10d apm.exe dbisamlb 11241 +22 EvaluateExpressionToken 00604bd6 +036 apm.exe dbisamen 23079 +3 TDataCursor.EvaluateFilterForRecord 00604aa2 +07e apm.exe dbisamen 23033 +16 TDataCursor.NavigateNonIndexedRecords 005ea790 +058 apm.exe dbisamen 8595 +7 TFilter.BuildNonIndexedBitmap 005e917f +49f apm.exe dbisamen 7984 +136 TFilter.EvaluateFilter 005e8b95 +049 apm.exe dbisamen 7789 +7 TFilter.Update 00603fcf +1bf apm.exe dbisamen 22626 +43 TDataCursor.UpdateAllFilters 005f8e3e +01e apm.exe dbisamen 16023 +5 TDataCursor.RefreshRangeAndFilters 005eda41 +031 apm.exe dbisamen 9960 +6 TDataCursor.CheckForCursorChanges 005eda83 +027 apm.exe dbisamen 9970 +4 TDataCursor.CheckForChangeDetection 00601f63 +173 apm.exe dbisamen 21595 +45 TDataCursor.DropFilter 005a858b +01f apm.exe dbisamsq 1290 +3 TJoin.FreeJoinFilterHandle 005a7f84 +014 apm.exe dbisamsq 1069 +1 TJoin.Destroy 00404178 +008 apm.exe System TObject.Free 005a8c43 +02f apm.exe dbisamsq 1488 +3 TSourceTable.FreeJoins 005abbb6 +036 apm.exe dbisamsq 3035 +3 TDataQuery.FreeSourceTables 005ab822 +022 apm.exe dbisamsq 2922 +2 TDataQuery.Destroy 00404178 +008 apm.exe System TObject.Free 005aad3d +029 apm.exe dbisamsq 2636 +3 TQueryStatement.FreeDataQueries 005a9cda +096 apm.exe dbisamsq 2020 +17 -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz + Joan and Jeff Cook The Cooks Oasis www.cookislandsoasis.com |
Tue, Mar 17 2009 5:23 PM | Permanent Link |
Sean | Jeff,
Assuming that qryTenants is not nil, is it possible that it was freed somewhere else in code but the pointer was not set to nil? The access violation on a nil or invalid object reference won't occur until a data element of the instance is accessed, so it might take it until that deeper method to run into a problem. From the point of the exception I'd also be looking to make sure the session and database are valid. Good hunting, Sean Jeff Cook wrote: > Kia Orana All - particularly the ancient ones still running DBSIAM v3! > > I'm getting an AV on closing a query. Stepping through the code I get > to the marked line below and get the AV > ------------------------------------ > procedure TUnusedTenants.ActivateQuery; > begin > if (pickBefore.Date <> dtLast) > or (sPMLast <> cboPM.Text) then > try > dtLast := pickBefore.Date; > sPMLast := cboPM.Text; > Screen.Cursor := crSQLWait; > StatusBar1.Panels[0].Text := 'Checking Tenants'; > Application.ProcessMessages; > with qryTenants do > begin > Close; // <<< AV here!!!! <<<<<<<<<<<<<<<<<<<<<<<<<< > if cboPM.Text = 'ALL' then SQL[9] := '' > else SQL[9] := 'AND UPPER(PM.Name) = ' + > QuotedStr(UpperCase(cboPM.Text)); > ParamByName('BeforeDate').AsDate := pickBefore.Date; > Open; > StatusBar1.Panels[0].Text := IntToStr(RecordCount) + ' Tenants > found'; > end; > finally > grdTenants.SetFocus; > Screen.Cursor := crDefault; > end; > end; > ------------------------------------ > I "OK" the AV message and end up in DBISAMEN.pas here:- > > procedure TDataCursor.CheckForChangeDetection; > begin >>>>> here >>>> if FDataDirectory.DataSession.StrictChangeDetection then > ReadLockTable > else > CheckForCursorChanges; > end; > ------------------------------------ > > Whatever is going on? I'm in a bit of code that I haven't touched for > yonks and have no idea how to proceed. > > Any suggestions welcome (yeah, yeah I know ... upgrade to v4 or EDB - > but that is a major mission!) > > Kia Manuia > > Jeff > > ----------------- > Here is some stuff from madExcept ... > > exception class : EAccessViolation > exception message : Access violation at address 005EDA66 in module > 'apm.exe'. Read of address 00000004. > > main thread ($e34): > 005eda66 +00a apm.exe dbisamen 9967 +1 > TDataCursor.CheckForChangeDetection > 0060220f +01f apm.exe dbisamen 21684 +3 > TDataCursor.ResetFilter > 005b8b46 +056 apm.exe dbisamsq 6305 +2 > TDataQuery.BuildSubSelectFilter > 0064158c +768 apm.exe dbisamlb 11445 +226 > EvaluateExpressionToken > 00640f31 +10d apm.exe dbisamlb 11241 +22 > EvaluateExpressionToken > 00604bd6 +036 apm.exe dbisamen 23079 +3 > TDataCursor.EvaluateFilterForRecord > 00604aa2 +07e apm.exe dbisamen 23033 +16 > TDataCursor.NavigateNonIndexedRecords > 005ea790 +058 apm.exe dbisamen 8595 +7 > TFilter.BuildNonIndexedBitmap > 005e917f +49f apm.exe dbisamen 7984 +136 > TFilter.EvaluateFilter > 005e8b95 +049 apm.exe dbisamen 7789 +7 > TFilter.Update > 00603fcf +1bf apm.exe dbisamen 22626 +43 > TDataCursor.UpdateAllFilters > 005f8e3e +01e apm.exe dbisamen 16023 +5 > TDataCursor.RefreshRangeAndFilters > 005eda41 +031 apm.exe dbisamen 9960 +6 > TDataCursor.CheckForCursorChanges > 005eda83 +027 apm.exe dbisamen 9970 +4 > TDataCursor.CheckForChangeDetection > 00601f63 +173 apm.exe dbisamen 21595 +45 > TDataCursor.DropFilter > 005a858b +01f apm.exe dbisamsq 1290 +3 > TJoin.FreeJoinFilterHandle > 005a7f84 +014 apm.exe dbisamsq 1069 +1 > TJoin.Destroy > 00404178 +008 apm.exe System > TObject.Free > 005a8c43 +02f apm.exe dbisamsq 1488 +3 > TSourceTable.FreeJoins > 005abbb6 +036 apm.exe dbisamsq 3035 +3 > TDataQuery.FreeSourceTables > 005ab822 +022 apm.exe dbisamsq 2922 +2 > TDataQuery.Destroy > 00404178 +008 apm.exe System > TObject.Free > 005aad3d +029 apm.exe dbisamsq 2636 +3 > TQueryStatement.FreeDataQueries > 005a9cda +096 apm.exe dbisamsq 2020 +17 > > > |
Tue, Mar 17 2009 5:31 PM | Permanent Link |
"Robert" | "Jeff Cook" <jeffc@aspect.co.nz> wrote in message news:3D0D7D2C-A379-4484-9952-6E3888E54D99@news.elevatesoft.com... > Whatever is going on? I'm in a bit of code that I haven't touched for > yonks and have no idea how to proceed. > > Any suggestions welcome (yeah, yeah I know ... upgrade to v4 or EDB - > but that is a major mission!) > There is an obscure bug in Delphi that can cause some or all of the databases sessions etc in a datamodule to become disconnected from each other. I think (long time ago, vague recollection) it had something to do with opening the same project with two copies of Delphi running on the same computer. Regardless, I would check the query to make sure it points to the right places. Another option, to delete que tQuery and re-add it to the datamodule. Don't you love this stuff? Robert |
Tue, Mar 17 2009 9:09 PM | Permanent Link |
"Jeff Cook" | Robert wrote:
> > There is an obscure bug in Delphi that can cause some or all of the > databases sessions etc in a datamodule to become disconnected from > each other. I think (long time ago, vague recollection) it had > something to do with opening the same project with two copies of > Delphi running on the same computer. Regardless, I would check the > query to make sure it points to the right places. > Hi Robert Thanks for the suggestions. As far as I can see everything is hooked up properly and I tried deleting the query and creating it again and (once I had got my datasources hooked up againeverything works the same - including the AV Cheers Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz + Joan and Jeff Cook The Cooks Oasis www.cookislandsoasis.com |
Tue, Mar 17 2009 9:16 PM | Permanent Link |
"Jeff Cook" | Sean wrote:
> > Assuming that qryTenants is not nil, is it possible that it was freed > somewhere else in code but the pointer was not set to nil? The access > violation on a nil or invalid object reference won't occur until a > data element of the instance is accessed, so it might take it until > that deeper method to run into a problem. From the point of the > exception I'd also be looking to make sure the session and database > are valid. > Proved that qryTenants is not nil and there is no "Free", "Release" or "nil" in the module - and the module isn't "used" anywhere apart from the main screen call - and the query isn't passed as a parameter to any other module. I've removed all manual "prepares" on all queries for good measure. Might leave this til tomorrow as it is doing my head in trying to think of other things to look at and try! Thanks for your ideas. Cheers Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz + Joan and Jeff Cook The Cooks Oasis www.cookislandsoasis.com |
Wed, Mar 18 2009 4:48 PM | Permanent Link |
Sean | Bummer. Have you tried creating the query completely in code and then
destroying it when you are finished? Slower, but you get a clean starting point every time - maybe there is a subtle bug in your version of DBISAM from reusing the query object in the manner that it is being used. Good luck, Sean Jeff Cook wrote: > Sean wrote: >> Assuming that qryTenants is not nil, is it possible that it was freed >> somewhere else in code but the pointer was not set to nil? The access >> violation on a nil or invalid object reference won't occur until a >> data element of the instance is accessed, so it might take it until >> that deeper method to run into a problem. From the point of the >> exception I'd also be looking to make sure the session and database >> are valid. >> > Proved that qryTenants is not nil and there is no "Free", "Release" or > "nil" in the module - and the module isn't "used" anywhere apart from > the main screen call - and the query isn't passed as a parameter to any > other module. I've removed all manual "prepares" on all queries for > good measure. > > Might leave this til tomorrow as it is doing my head in trying to think > of other things to look at and try! > > Thanks for your ideas. > > Cheers > > Jeff > |
Wed, Mar 18 2009 4:59 PM | Permanent Link |
"Jeff Cook" | Jeff Cook wrote:
> > Might leave this til tomorrow as it is doing my head in trying to > think of other things to look at and try! > Tomorrow came and it isn't looking better (though Cyclone Ken has just passed by without hitting us except for almighty precipitation!). Decided not to reactivate my query at the end of the processing and simple exit the module - but now I get exactly the same error on closing the module - as I should have expected as freeing the form will close the query. So I'm back to where I started - why does closing the query cause an AV???? Cheers Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz + Joan and Jeff Cook The Cooks Oasis www.cookislandsoasis.com |
Thu, Mar 19 2009 12:02 AM | Permanent Link |
"Jeff Cook" | Sean wrote:
> Bummer. Have you tried creating the query completely in code and then > destroying it when you are finished? Slower, but you get a clean > starting point every time - maybe there is a subtle bug in your > version of DBISAM from reusing the query object in the manner that it > is being used. > OK, now I have tried that and get exactly the same problem. However I now know what causes the problem - but not how to fix it! The SQL is used to select Tenants for deletion. The SQL can be opened and closed multiple times with no problem (e.g. changing the selection criteria and thus the WHERE). BUT if I use the query result in a "while not EOF do .. Next" loop to actually delete the tenants - using the tenantcode from the query, then I get an AV as I close the query. Same happens if I use SQL to delete the tenant or .Delete. Comment out the delete and it all works OK - except the purpose is defeated The query is below Cheers Jeff ============================================================ SELECT T.TenantCode, T.SortKey, T.StartDate, T.VacateDate, P.StreetNumber, P.StreetName, P.Suburb, IF(P.Managed THEN "Yes" ELSE "No") AS Managed, True AS Selected, PM.Name FROM Tenants T JOIN Properties P ON P.PropertyCode = T.PropertyCode JOIN Portfolios Pf ON Pf.PortfolioCode = P.PortfolioCode JOIN PropertyManagers PM on PM.PMCode = Pf.PMCode WHERE VacateDate < :BeforeDate /* 9 */ AND TenantCode NOT IN ( SELECT DISTINCT TT.TenantCode FROM TenantTrans TT WHERE (( TT.TransType <> "B/Fwd") OR (TT.Balance <> 0) OR (TT.RentDue <> 0) OR (TT.Rent <> 0) OR (TT.Debt <> 0) OR (TT.LettingFee <> 0) OR (TT.Bond <> 0)) ) AND TenantCode NOT IN ( SELECT DISTINCT AT.TenantCode FROM AdminTrans AT WHERE (AT.BondDisbursed = 'Y' ) ) ORDER BY T.SortKey -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz + Joan and Jeff Cook The Cooks Oasis www.cookislandsoasis.com |
Thu, Mar 19 2009 1:08 AM | Permanent Link |
Sean | Jeff, How about fill a temp table or list with the primary keys of the records you want to delete during the loop, close the query, and then perform the delete from the list. Shouldn't have to do it, but it may get you around the bug. Sean Jeff Cook wrote: > Sean wrote: > >> Bummer. Have you tried creating the query completely in code and then >> destroying it when you are finished? Slower, but you get a clean >> starting point every time - maybe there is a subtle bug in your >> version of DBISAM from reusing the query object in the manner that it >> is being used. >> > > OK, now I have tried that and get exactly the same problem. > > However I now know what causes the problem - but not how to fix it! > > The SQL is used to select Tenants for deletion. The SQL can be opened > and closed multiple times with no problem (e.g. changing the selection > criteria and thus the WHERE). > > BUT if I use the query result in a "while not EOF do .. Next" loop to > actually delete the tenants - using the tenantcode from the query, then > I get an AV as I close the query. Same happens if I use SQL to delete > the tenant or .Delete. Comment out the delete and it all works OK - > except the purpose is defeated > > The query is below > > Cheers > > Jeff > ============================================================ > SELECT T.TenantCode, T.SortKey, T.StartDate, T.VacateDate, > P.StreetNumber, P.StreetName, P.Suburb, > IF(P.Managed THEN "Yes" ELSE "No") AS Managed, > True AS Selected, PM.Name > FROM Tenants T > JOIN Properties P ON P.PropertyCode = T.PropertyCode > JOIN Portfolios Pf ON Pf.PortfolioCode = P.PortfolioCode > JOIN PropertyManagers PM on PM.PMCode = Pf.PMCode > WHERE VacateDate < :BeforeDate > /* 9 */ > AND TenantCode NOT IN > ( > SELECT DISTINCT TT.TenantCode > FROM TenantTrans TT > WHERE (( TT.TransType <> "B/Fwd") > OR (TT.Balance <> 0) > OR (TT.RentDue <> 0) > OR (TT.Rent <> 0) > OR (TT.Debt <> 0) > OR (TT.LettingFee <> 0) > OR (TT.Bond <> 0)) > ) > AND TenantCode NOT IN > ( > SELECT DISTINCT AT.TenantCode > FROM AdminTrans AT > WHERE (AT.BondDisbursed = 'Y' ) > ) > ORDER BY T.SortKey |
Thu, Mar 19 2009 1:30 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Jeff,
<< I'm getting an AV on closing a query. Stepping through the code I get to the marked line below and get the AV >> If you can send me a project that reproduces this, I'll have a look and see if I can get you a source code fix. -- Tim Young Elevate Software www.elevatesoft.com |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Saturday, June 22, 2024 at 05:51 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |