2

I am working on ArcSDE10.2.2 Oracle11G(11.2.0.4) enterprise geodatabase with user base 600+ and 2000 versions( Created from DEFAULT). For effective GDB compression and optimized performance delta count need to be controlled and there is user dependency for posting the version edits to default. I want to enlist all versions having outstanding number of edits which has been posted yet. I want to check it using SQL query/python script etc.

Any suggestion inputs please share.

  • SQL and Python are very different solutions (the latter is simple, the former hyper-difficult), yet your question title specifies SQL. I suggest you edit the question title to remove "using SQL interface". – Vince Feb 25 '15 at 11:58
  • In your question you have mentioned "...SQL query/python script etc." What etc means?! Is ArcObjects an option for you? – Farid Cheraghi Feb 25 '15 at 12:58
  • I am expecting any SQL script which can help to identify the number of outstanding/unposted edits based on states and state_lineages. Incase someone has used ArcObjects or Python scripts to identify such edits can also share thier views. – Mahender Singh Feb 25 '15 at 13:45
1

With the following method you can loop through your versions of a table and check for their difference with their parent version:

        public static IFIDSet FindVersionDifferences(IWorkspace workspace, String childVersionName, String parentVersionName, String tableName, esriDifferenceType differenceType)
        {
            // Get references to the child and parent versions.
            IVersionedWorkspace versionedWorkspace = (IVersionedWorkspace)workspace;
            IVersion childVersion = versionedWorkspace.FindVersion(childVersionName);
            IVersion parentVersion = versionedWorkspace.FindVersion(parentVersionName);

            // Cast to the IVersion2 interface to find the common ancestor.
            IVersion2 childVersion2 = (IVersion2)childVersion;
            IVersion commonAncestorVersion = childVersion2.GetCommonAncestor(parentVersion);

            // Cast the child version to IFeatureWorkspace and open the table.
            IFeatureWorkspace childFWS = (IFeatureWorkspace)childVersion;
            ITable childTable = childFWS.OpenTable(tableName);

            // Cast the common ancestor version to IFeatureWorkspace and open the table.
            IFeatureWorkspace commonAncestorFWS = (IFeatureWorkspace)commonAncestorVersion;
            ITable commonAncestorTable = commonAncestorFWS.OpenTable(tableName);

            // Cast to the IVersionedTable interface to create a difference cursor.
            IVersionedTable versionedTable = (IVersionedTable)childTable;
            IDifferenceCursor differenceCursor = versionedTable.Differences(commonAncestorTable, differenceType, null);

            // Create output variables for the IDifferenceCursor.Next method and a FID set.
            IFIDSet fidSet = new FIDSetClass();
            IRow differenceRow = null;
            int objectID = -1;

            // Step through the cursor, showing the ID of each modified row.
            differenceCursor.Next(out objectID, out differenceRow);
            while (objectID != -1)
            {
                fidSet.Add(objectID);
                differenceCursor.Next(out objectID, out differenceRow);
            }

            fidSet.Reset();
            return fidSet;
        }

The return type of this method is IFIDSet. This interface has a IFIDSet.Count method that returns the number of differences.

When working with ArcGIS Softwares and SDKs, Esri recommends to avoid using SQL. However there are possibilities to some extents but not everything is possible to do with pure SQL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.