Search in sources :

Example 11 with LocalFieldDesc

use of com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc in project Payara by payara.

the class Statement method getColumnElementForValueNode.

/**
 * Gets the column information for the field to which <code>node</code>
 * is bound.
 * @param node The input node.
 * @return Returns null if the node isn't bound to a field. Otherwise
 * returns ColumnElement for the primary column of the field to which the
 * node is bound.
 */
private static ColumnElement getColumnElementForValueNode(ConstraintValue node) {
    ColumnElement columnElement = null;
    LocalFieldDesc field = node.getLocalField();
    if (field != null) {
        // For fields mapped to multiple columns, we assume
        // that all the columns have the same value in the database.
        // Hence we only use the primary column in where clause.
        columnElement = field.getPrimaryColumn();
    }
    return columnElement;
}
Also used : LocalFieldDesc(com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc) ColumnElement(org.netbeans.modules.dbschema.ColumnElement)

Example 12 with LocalFieldDesc

use of com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc in project Payara by payara.

the class Statement method processConstraintField.

private void processConstraintField(ConstraintField fieldNode, StringBuffer result) {
    LocalFieldDesc desc = null;
    QueryPlan thePlan = getOriginalPlan(fieldNode);
    if (fieldNode instanceof ConstraintFieldDesc) {
        desc = ((ConstraintFieldDesc) fieldNode).desc;
    } else if (fieldNode instanceof ConstraintFieldName) {
        desc = thePlan.config.getLocalFieldDesc(((ConstraintFieldName) fieldNode).name);
    } else {
        throw new JDOFatalInternalException(I18NHelper.getMessage(messages, // NOI18N
        "core.generic.notinstanceof", fieldNode.getClass().getName(), // NOI18N
        "ConstraintFieldDesc/ConstraintFieldName"));
    }
    generateColumnText(desc, thePlan, result);
}
Also used : LocalFieldDesc(com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc) JDOFatalInternalException(com.sun.jdo.api.persistence.support.JDOFatalInternalException)

Example 13 with LocalFieldDesc

use of com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc in project Payara by payara.

the class UpdateStatement method addLocalConstraints.

public void addLocalConstraints(int action, ForeignFieldDesc f, SQLStateManager sm) {
    for (int i = 0; i < f.localFields.size(); i++) {
        LocalFieldDesc lf = (LocalFieldDesc) f.localFields.get(i);
        if (action == QueryPlan.ACT_INSERT) {
            // For inserts into the join table, we get the values we are inserting
            // for the parent object and the added object.
            ColumnElement lc = (ColumnElement) f.assocLocalColumns.get(i);
            addColumn(lc, lf.getValue(sm));
        } else if (action == QueryPlan.ACT_DELETE) {
            LocalFieldDesc alf = (LocalFieldDesc) f.assocLocalFields.get(i);
            // For deletes from the join table, we get the constraint values
            // from the parent object and the remove object.
            addConstraint(alf, lf.getValue(sm));
        }
    }
}
Also used : LocalFieldDesc(com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc) ColumnElement(org.netbeans.modules.dbschema.ColumnElement)

Example 14 with LocalFieldDesc

use of com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc in project Payara by payara.

the class VerificationSelectPlan method processFields.

/**
 * There are no real fields to be selected for verification query.
 * This method just adds the tables for the version field.
 */
protected void processFields() {
    LocalFieldDesc[] versionFields = config.getVersionFields();
    for (int i = 0; i < versionFields.length; i++) {
        LocalFieldDesc versionField = versionFields[i];
        addTable(versionField);
    }
}
Also used : LocalFieldDesc(com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc)

Aggregations

LocalFieldDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.LocalFieldDesc)14 FieldDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.FieldDesc)3 ArrayList (java.util.ArrayList)3 ColumnElement (org.netbeans.modules.dbschema.ColumnElement)3 JDOFatalInternalException (com.sun.jdo.api.persistence.support.JDOFatalInternalException)2 ForeignFieldDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.ForeignFieldDesc)2 BitSet (java.util.BitSet)2 ClassDesc (com.sun.jdo.spi.persistence.support.sqlstore.model.ClassDesc)1 Constraint (com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint.Constraint)1 ConstraintFieldDesc (com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint.ConstraintFieldDesc)1