public Query clone()
        {
            Query q = new Query();

            q.setMaxRows(_maxRows);
            q.setFirstRow(_firstRow);
            q.getSelectClause().setDistinct(_selectClause.isDistinct());
            foreach (FromItem item in _fromClause.getItems())
            {
                q.from(item.clone());
            }
            foreach (SelectItem item in _selectClause.getItems())
            {
                q.select(item.clone(q));
            }
            foreach (FilterItem item in _whereClause.getItems())
            {
                q.where (item.clone());
            }
            foreach (GroupByItem item in _groupByClause.getItems())
            {
                q.groupBy(item.clone());
            }
            foreach (FilterItem item in _havingClause.getItems())
            {
                q.having(item.clone());
            }
            foreach (OrderByItem item in _orderByClause.getItems())
            {
                q.orderBy(item.clone());
            }
            return(q);
        } // clone()
        } // executeQuery()

        /**
         * Determines if all the select items are 'simple' meaning that they just
         * represent scans of values in columns.
         *
         * @param clause
         * @return
         */
        private bool isSimpleSelect(SelectClause clause)
        {
            if (clause.isDistinct())
            {
                return(false);
            }
            foreach (SelectItem item in clause.getItems())
            {
                if (item.getAggregateFunction() != null || item.getExpression() != null)
                {
                    return(false);
                }
            }
            return(true);
        } // isSimpleSelect()