msaccess-vcs-addin icon indicating copy to clipboard operation
msaccess-vcs-addin copied to clipboard

Question about leftover crud in exported querydefs

Open jhgarrison opened this issue 3 years ago • 1 comments
trafficstars

I refactored a section of my code, involving renaming a few objects and painfully fixing all references. I have a set of queries that were refactored, based on the renamed objects.

The exported .bas files for the queries still contain references to the old pre-refactor names inside an unnamed BEGIN block, and in a dbMemo property named "OrderBy", even though there is no order-by clause in the query.:

Below is an example, with all the offending references marked with >>>. All of these refer to tables or queries that no longer exist. I searched MSysObjects and MSysQueries but can't find any of these references. I depend on being able to grep the exported source to verify (in this instance, for example) that I did the refactoring correctly and didn't leave any dangling references to old names.

I also notice vcs-index.json contains references to files that haven't existed in quite a while.

Can you shed some light on where this obsolete data is stored and how to get rid of it in the export?

    Operation =3
    Name ="tmpActivity_capability"
    Option =0
    Where ="(((tblActivity.activityId)=[pActivityId]))"
    Begin InputTables
        Name ="tblActivity"
        Name ="ttbAuthCapability"
    End
    Begin OutputColumns
        Name ="activityId"
        Expression ="tblActivity.activityId"
        Name ="activityName"
        Expression ="tblActivity.activityName"
        Name ="authCapID"
        Expression ="ttbAuthCapability.authCapID"
        Name ="authCapName"
        Expression ="ttbAuthCapability.authCapName"
        Alias ="isSufficient"
        Name ="isSufficient"
        Expression ="sqlbitand([authCapId],[capRequired])<>0"
    End
    dbBoolean "ReturnsRecords" ="-1"
    dbInteger "ODBCTimeout" ="60"
    dbByte "RecordsetType" ="0"
    dbBoolean "OrderByOn" ="-1"
    dbByte "Orientation" ="0"
    dbByte "DefaultView" ="2"
    dbBoolean "FilterOnLoad" ="0"
    dbBoolean "OrderByOnLoad" ="-1"
    dbBoolean "TotalsRow" ="0"
>>> dbMemo "OrderBy" ="[qrySessionType_memberRole].[sessionTypeId], [qrySessionType_memberRole].[sessio"
>>>     "nTypeName]"
    dbBoolean "UseTransaction" ="-1"
    Begin
        Begin
            dbText "Name" ="isValid"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qrySessionType_memberRole_cross.memberRoleId"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qrySessionType_memberRole_cross.sessionTypeName"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qrySessionType_memberRole_cross.roleName"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qrySessionType_memberRole_cross.sessionTypeId"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="tblSessionType_memberRole.memberRoleId"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="tblSessionType_memberRole.sessionTypeId"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="tblSessionType.sessionTypeId"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="tblSessionType.sessionTypeName"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="tblMemberRole.memberRoleId"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="tblMemberRole.roleName"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="k1"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="k2"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="tblSessionType_memberRole.owner"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qrySessionType_X_memberRole.memberRoleId"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qrySessionType_X_location.sessionTypeId"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qrySessionType_X_location.sessionTypeName"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qrySessionType_X_location.locationId"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qrySessionType_X_location.locationName"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="qryActivity_X_location.sessionTypeId"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="qryActivity_X_location.activityId"
            dbLong "AggregateType" ="-1"
        End
        Begin
>>>         dbText "Name" ="qryActivity_X_location.sessionTypeName"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="qryActivity_X_location.activityName"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="qryActivity_X_location.locationId"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="qryActivity_X_location.locationName"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="tblActivity.activityId"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="tblActivity.activityName"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="ttbAuthCapability.authCapID"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="ttbAuthCapability.authCapName"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="isSufficient"
            dbLong "AggregateType" ="-1"
        End
        Begin
            dbText "Name" ="ttbAuthCapability.authGlobal"
            dbLong "AggregateType" ="-1"
        End
    End
    Begin
        State =0
        Left =51
        Top =97
        Right =2200
        Bottom =1220
        Left =-1
        Top =-1
        Right =2123
        Bottom =342
        Left =0
        Top =0
        ColumnsShown =651
        Begin
            Left =178
            Top =109
            Right =322
            Bottom =253
            Top =0
            Name ="tblActivity"
            Name =""
        End
        Begin
            Left =453
            Top =128
            Right =597
            Bottom =272
            Top =0
            Name ="ttbAuthCapability"
            Name =""
        End
    End

The matching .sql for completeness

INSERT INTO tmpActivity_capability ( activityId, activityName, authCapID, authCapName, isSufficient )
SELECT tblActivity.activityId, tblActivity.activityName, ttbAuthCapability.authCapID, ttbAuthCapability.authCapName, sqlbitand([authCapId],[capRequired])<>0 AS isSufficient
FROM tblActivity, ttbAuthCapability
WHERE (((tblActivity.activityId)=[pActivityId]));```

jhgarrison avatar Oct 06 '22 00:10 jhgarrison

I assume you're using 3.x. I have seen several cases when the index incorrectly determines age / update state and doesn't fully export the relevant bits.

Also, if you removed a query/object, it's possible a non-full export may skip it. If you do a full export, does the crud still exist?

hecon5 avatar Nov 18 '22 14:11 hecon5