protected virtual void Query() { TraceManager.TraceInformation("CQ Query: {0}", m_queryStr); // prepare result set OAdResultset result = CQWrapper.BuildResultSet(m_userSession, m_queryStr); // enable record count before execute so that no of records can be fetched CQWrapper.EnableRecordCount(result); // execute the query CQWrapper.ExecuteResultSet(result); // lookup for dbid column bool dbidExist = false; int dbidColumnIndex = 0; int columnCount = CQWrapper.GetResultSetColumnCount(result); for (int colIter = 1; colIter <= columnCount; colIter++) { if (string.Equals(CQWrapper.GetColumnLabel(result, colIter), "dbid", StringComparison.OrdinalIgnoreCase)) { dbidExist = true; dbidColumnIndex = colIter; break; } } Debug.Assert(dbidExist, "dbid does not exist in resultset"); int recordCount = CQWrapper.GetRecordCount(result); TraceManager.TraceInformation("CQ Query: returned {0} record(s)", recordCount); // cache dbids m_resultSetDbIds = new int[recordCount]; int index = 0; while (CQWrapper.ResultSetMoveNext(result) == CQConstants.SUCCESS) { string dbid = (string)CQWrapper.GetColumnValue(result, dbidColumnIndex); m_resultSetDbIds[index++] = int.Parse(dbid); Trace.TraceInformation("DEBUG: dbid : {0}", int.Parse(dbid)); } MakeSureDBIDsAreUnique(); Trace.TraceInformation("Total number of records after removing the duplicate dbids: {0}", m_resultSetDbIds.Length); }