ArcGISCompare.GeoDbProcs.GetValueOccurrences C# (CSharp) Method

GetValueOccurrences() static private method

static private GetValueOccurrences ( IWorkspace theWS, String which, AttributeMappingData theMap, String theV ) : int
theWS IWorkspace
which String
theMap AttributeMappingData
theV String
return int
    internal static int GetValueOccurrences(IWorkspace theWS, String which, AttributeMappingData theMap, String theV)
    {
      IFeatureClass theFC = null;
      String fieldName = "";
      esriFieldType theT = esriFieldType.esriFieldTypeString;

      ISQLSyntax theS = (ISQLSyntax)theWS;
      switch (which)
      {
        case "Template":
          theFC = GetFeatureClass(theWS, theMap.srcFC);
          fieldName = theS.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierPrefix) + theMap.srcAtt + theS.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierSuffix);
          theT = theMap.srcDT;
          break;
        case "Implementation":
          theFC = GetFeatureClass(theWS, theMap.destFC);
          fieldName = theS.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierPrefix) + theMap.destAtt + theS.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierSuffix);
          theT = theMap.destDT;
          break;
      }

      IQueryFilter theQF = new QueryFilterClass();
      switch (theT)
      {
        case esriFieldType.esriFieldTypeString:
          if (theV == "") { theQF.WhereClause = fieldName + " IS NOT NULL AND " + fieldName + " <> ''"; }
          else { theQF.WhereClause = fieldName + " = '" + theV + "'"; }
          break;
        case esriFieldType.esriFieldTypeInteger:
          if (theV == "") { theQF.WhereClause = fieldName + " IS NOT NULL AND " + fieldName + " <> 0"; }
          else { theQF.WhereClause = fieldName + " = " + theV; }
          break;
      }

      return theFC.FeatureCount(theQF);
    }