Search in sources :

Example 1 with ResultDesc

use of com.sun.jdo.spi.persistence.support.sqlstore.sql.ResultDesc in project Payara by payara.

the class SelectQueryPlan method addColumn.

/**
 * The addColumn method is used to specify a field for which data needs to
 * be retrieved and therefore for which we need  to select a column.
 *
 * @param fieldDesc The field for which we need to retrieve data and therefore
 * for which we need to select a column.
 * @param add Specifies if the field will be added to {@link ResultDesc}.
 * @param projection Pass the projection information for this field
 * to {@link ResultDesc}.
 */
private void addColumn(LocalFieldDesc fieldDesc, boolean add, boolean projection) {
    // 
    for (Iterator iter = fieldDesc.getColumnElements(); iter.hasNext(); ) {
        ColumnElement columnElement = (ColumnElement) iter.next();
        QueryTable table = findQueryTable(columnElement.getDeclaringTable());
        if (table == null)
            table = addQueryTable(columnElement.getDeclaringTable(), null);
        SelectStatement statement = (SelectStatement) getStatement(table);
        if (statement == null)
            statement = (SelectStatement) addStatement(table);
        if (add) {
            ColumnRef columnRef = statement.addColumn(columnElement, table);
            // initialize the resultDesc
            if (resultDesc == null) {
                resultDesc = new ResultDesc(config, aggregateResultType);
            }
            resultDesc.addField(fieldDesc, columnRef, projection);
        }
    }
}
Also used : ResultDesc(com.sun.jdo.spi.persistence.support.sqlstore.sql.ResultDesc) ColumnElement(org.netbeans.modules.dbschema.ColumnElement)

Aggregations

ResultDesc (com.sun.jdo.spi.persistence.support.sqlstore.sql.ResultDesc)1 ColumnElement (org.netbeans.modules.dbschema.ColumnElement)1