Package Framework

Examples of Framework.IntegerData


            throw new Error(Error.SQL_OPERATION_UNINITIALIZED, "AddConstraint", this).getException();

        }
        else if (this.getOperation() == BusinessQuery.OP_SELECT) {

            this.addConstraint(new TextData().replaceParameters("t%1.%2%3?", new IntegerData(tableIndex), columnName, this.infixOperator(operation, 1)).toString());

            this.getData().get(0).getValues().add(value);

        }
        else {
View Full Code Here


                    this.addConstraint(tableIndex, qq_GetWhereText.toString());

                }
                else if (this.getOperation() != BusinessQuery.OP_SELECT) {

                    throw new Error(Error.SQL_ILLEGAL_FOR_OPERATION, "AddConstraint", this, new IntegerData(this.getOperation()), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();

                }
                else if (op == ConstraintOperation.OP_FOR_UPDATE) {

                    stack.deleteRow(stack.size()- 1);
                    this.setForUpdate(true);

                }
                else if (op == ConstraintOperation.OP_DISTINCT) {

                    stack.deleteRow(stack.size()- 1);
                    this.setDistinct(true);

                }
                else if (op == ConstraintOperation.OP_NO_COLLECTIVE) {

                    stack.deleteRow(stack.size()- 1);
                    this.setOptions(SqlQuery.OPT_NO_COLLECTIVE);

                }
                else if (op == ConstraintOperation.OP_USE_COLLECTIVE) {

                    stack.deleteRow(stack.size()- 1);
                    this.setOptions(this.getOptions()&(~(SqlQuery.OPT_NO_COLLECTIVE|SqlQuery.OPT_COLLECTIVE_FOR_ONE)));

                }
                else if (op == ConstraintOperation.OP_MAX_ROWS) {

                    stack.deleteRow(stack.size()- 1);
                    node = stack.get(stack.size()-1);
                    if (!(node instanceof ConstraintValue)) {
                        throw new Error(Error.QC_NEED_VALUE_NODE, "AddConstraint", this).getException();
                    }
                    else {
                        this.setMaxRows(((ConstraintValue)node).getValue().asI4());
                        stack.deleteRow(stack.size()- 1);
                    }

                }
                else if ((op&ConstraintOperation.TYPE_MASK) == ConstraintOperation.TYPE_ORDERBY) {

                    stack.deleteRow(stack.size()- 1);
                    node = stack.get(stack.size()-1);
                    if (!(node instanceof ConstraintAttr)) {
                        throw new Error(Error.QC_NEED_ATTR_NODE, "AddConstraint", this).getException();
                    }
                    else {
                        TextData c = null, oldClause = null;
                        ConstraintAttr attrNode = (ConstraintAttr)node;
                        int t = attrNode.getTableIndex();
                        // ------------------------------------
                        // Parameters for call to GetColumnName
                        // ------------------------------------
                        ParameterHolder_integer qq_tableIndex = new ParameterHolder_integer(t);
                        ParameterHolder_TextData qq_columnName = new ParameterHolder_TextData();
                        attrNode.getEntity().getColumnName(attrNode.getAttr(), qq_tableIndex, qq_columnName);
                        t = qq_tableIndex.getInt();
                        c = (TextData)qq_columnName.getObject();
                        if (this.getOrderClause().getActualSize() > 0) {
                            oldClause = this.getOrderClause();
                            this.setOrderClause(new TextData());
                        }
                        this.getOrderClause().replaceParameters("t%1.%2", new IntegerData(t), c);
                        if (op == ConstraintOperation.OP_ORDERBY_DESC) {
                            this.getOrderClause().concat(" desc");
                        }
                        if (oldClause != null) {
                            this.getOrderClause().concat(", ");
View Full Code Here

            throw new Error(Error.SQL_OPERATION_UNINITIALIZED, "AddConstraint", this).getException();

        }
        else if (this.getOperation() == BusinessQuery.OP_SELECT && tableIndex > 1) {

            throw new Error(Error.SQL_ILLEGAL_FOR_OPERATION, "AddConstraint", this, new IntegerData(this.getOperation()), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();

        }
        else if (constraint != null && !("".equals(constraint))) {

            if (this.getWhereClause().get(tableIndex-1).getActualSize() > 0) {
View Full Code Here

            return;

        }
        else if (this.getOperation() != BusinessQuery.OP_UPDATE && this.getOperation() != BusinessQuery.OP_INSERT) {

            throw new Error(Error.SQL_ILLEGAL_FOR_OPERATION, "AddValue", this, new IntegerData(this.getOperation()), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();

        }
        else {

            stack = new Array_Of_ConstraintNode<ConstraintNode>();
View Full Code Here

     *     The ClearColumnList method is used to clear the column list.<br>
     * <p>
     */
    public void clearColumnList() {
        if (this.getOperation() != BusinessQuery.OP_SELECT) {
            throw new Error(Error.SQL_ILLEGAL_FOR_OPERATION, "ClearColumnList", this, new IntegerData(this.getOperation()), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
        }

        this.columnList = new Array_Of_TextData<TextData>();
        this.columnList.set(0, new TextData());
    }
View Full Code Here

            }
            else {
                attrMask.setInt(attrMask.getInt()|SqlQuery.ATTRTYPE_DB);
            }
            if (this.getOperation() == BusinessQuery.OP_SELECT) {
                result.replaceParameters("t%1.%2", new IntegerData(t), c);
            }
            else {
                result.concat(c);
                tableIndex.setInt(t);
            }

        }
        else if (node instanceof ConstraintConstant) {

            result.setValue( ((ConstraintConstant)node).getValue() );

        }
        else if (node instanceof ConstraintOperation) {

            opNodeOp = ((ConstraintOperation)node).getOperation();
            opNodeOpCode = opNodeOp&ConstraintOperation.OPCODE_MASK;

            if (opNodeOpCode == ConstraintOperation.OPCODE_IN) {

                if (stack.size() < 2) {
                    throw new Error(Error.QC_CONSTRAINT_STACK_EMPTY, "GetWhereText", this).getException();
                }

                result.setValue( "(" );

                if (!(stack.get(stack.size()-1) instanceof ConstraintAttr)) {
                    throw new Error(Error.QC_NEED_ATTR_NODE, "GetWhereText", this).getException();
                }
                else {
                    // -----------------------------------
                    // Parameters for call to GetWhereText
                    // -----------------------------------
                    ParameterHolder_integer qq_attrMask = new ParameterHolder_integer(attrMask.getInt());
                    ParameterHolder_integer qq_valueCount = new ParameterHolder_integer(valueCount.getInt());
                    ParameterHolder_integer qq_tableIndex = new ParameterHolder_integer(tableIndex.getInt());
                    TextData qq_GetWhereText = this.getWhereText(stack, qq_attrMask, qq_valueCount, qq_tableIndex);
                    attrMask.setInt(qq_attrMask.getInt());
                    valueCount.setInt(qq_valueCount.getInt());
                    tableIndex.setInt(qq_tableIndex.getInt());
                    c = qq_GetWhereText;
                }

                while (stack.size() > 1 && stack.get(stack.size()-1) instanceof ConstraintAttr) {
                    c.replaceRange(", ", 0, 0);
                    // -----------------------------------
                    // Parameters for call to GetWhereText
                    // -----------------------------------
                    ParameterHolder_integer qq_attrMask = new ParameterHolder_integer(attrMask.getInt());
                    ParameterHolder_integer qq_valueCount = new ParameterHolder_integer(valueCount.getInt());
                    ParameterHolder_integer qq_tableIndex = new ParameterHolder_integer(tableIndex.getInt());
                    TextData qq_GetWhereText = this.getWhereText(stack, qq_attrMask, qq_valueCount, qq_tableIndex);
                    attrMask.setInt(qq_attrMask.getInt());
                    valueCount.setInt(qq_valueCount.getInt());
                    tableIndex.setInt(qq_tableIndex.getInt());
                    c.replaceRange(qq_GetWhereText, 0, 0);
                }

                result.concat(c);
                result.concat(") in (");

                if (!(stack.get(stack.size()-1) instanceof ConstraintValue)) {
                    throw new Error(Error.QC_NEED_VALUE_NODE, "GetWhereText", this).getException();
                }
                else {
                    result.concat(((ConstraintValue)(stack.get(stack.size()-1))).getValue());
                    stack.deleteRow(stack.size()- 1);
                }
                result.concat(")");

                if (stack.size() > 0 && stack.get(stack.size()-1) instanceof ConstraintSqlData) {
                    Array_Of_DataValue<DataValue> qq_localVector = ((ConstraintSqlData)(stack.get(stack.size()-1))).getData().getValues();
                    if (qq_localVector != null) {
                        for (DataValue d : qq_localVector) {
                            this.getData().get(tableIndex.getInt()-1).getValues().add(d);
                        }
                    }
                    stack.deleteRow(stack.size()- 1);
                }

            }
            else if (opNodeOpCode == ConstraintOperation.OPCODE_LEFTJOIN || opNodeOpCode == ConstraintOperation.OPCODE_RIGHTJOIN || opNodeOpCode == ConstraintOperation.OPCODE_EQUIJOIN) {
                boolean doFancyJoin = opNodeOpCode != ConstraintOperation.OPCODE_EQUIJOIN && this.getDBSession().getDBVendorType() != Constants.DB_VT_ORACLE && this.getDBSession().getDBVendorType() != Constants.DB_VT_SYBASE;
                int oldFromTable = 0, newFromTable = 0, oldToTable = 0, newToTable = 0;
                if (opNodeOpCode == ConstraintOperation.OPCODE_EQUIJOIN) {
                    this.setOptions(this.getOptions()|SqlQuery.OPT_INNER_JOIN);
                }
                else {
                    this.setOptions(this.getOptions()|SqlQuery.OPT_OUTER_JOIN);
                }
                TextData c3 = new TextData();
                if (doFancyJoin) {
                    node = stack.get(stack.size()-1);
                    if (!(node instanceof ConstraintAttr)) {
                        throw new Error(Error.QC_NEED_ATTR_NODE, "GetWhereText", this).getException();
                    }
                    attrNode = (ConstraintAttr)node;
                    if (attrNode.getTableIndex() > this.tableList.size()) {
                        throw new Error(Error.QC_ILLEGAL_TABLE_INDEX, "GetWhereText", this, new IntegerData(attrNode.getTableIndex()), new IntegerData(this.tableList.size())).getException();
                    }
                    node = stack.get(stack.size()-1-1);
                    if (!(node instanceof ConstraintAttr)) {
                        throw new Error(Error.QC_NEED_ATTR_NODE, "GetWhereText", this).getException();
                    }
                    if (((ConstraintAttr)node).getTableIndex() > this.tableList.size()) {
                        throw new Error(Error.QC_ILLEGAL_TABLE_INDEX, "GetWhereText", this, new IntegerData(attrNode.getTableIndex()), new IntegerData(this.tableList.size())).getException();
                    }
                    t = attrNode.getEntity().getTableAliases().get(attrNode.getTableIndex()-1).getValue();
                    int t2 = ((ConstraintAttr)node).getEntity().getTableAliases().get(((ConstraintAttr)node).getTableIndex()-1).getValue();
                    //
                    //  We want to put in a join for attrNode.  We know the table
                    //  aliases t, and t2 to use.  We have to check that these
                    //  tables aren't already participating in a join.  If either of
                    //  them are then we will have to make a new table alias for that
                    //  table and put in an addtional equijoin between the old alias
                    //  and the new based, of course, on the key columns.  The one
                    //  exception is that t can participate in multiple joins if
                    //  the OPT_NO_MULT_OUTER_JOIN option is not set.
                    //
                    int t3 = 0;
                    if (this.tableList.get(t2-1).getPrevTable() != null) {
                        oldToTable = t2;
                        this.addTable(this.tableList.get(t2-1).getTableName());
                        for (int i = 1; i <= attrNode.getEntity().getNumKeyAttrs(); i++) {
                            t3 = attrNode.getTableIndex();
                            // ------------------------------------
                            // Parameters for call to GetColumnName
                            // ------------------------------------
                            ParameterHolder_integer qq_tableIndex = new ParameterHolder_integer(t3);
                            ParameterHolder_TextData qq_columnName = new ParameterHolder_TextData();
                            attrNode.getEntity().getColumnName(i, qq_tableIndex, qq_columnName);
                            t3 = qq_tableIndex.getInt();
                            c = (TextData)qq_columnName.getObject();
                            if (c == null) {
                                c = new TextData();
                            }
                            this.addConstraint(c3.replaceParameters("t%1.%2 = t%3.%2", new IntegerData(t2), c, this.getNumTables()).toString());
                        }
                        t2 = this.getNumTables().getValue();
                        newToTable = t2;
                    }
                    if (this.tableList.get(t-1).getNextTable() == null) {
                        this.tableList.get(t-1).setNextTable(new Array_Of_SqlQueryTable<SqlQueryTable>());
                        this.tableList.get(t-1).getNextTable().add(this.tableList.get(t2-1));
                        this.tableList.get(t2-1).setPrevTable(this.tableList.get(t-1));
                    }
                    else if ((this.getOptions()&SqlQuery.OPT_NO_MULT_OUTER_JOIN) == 0) {
                        this.tableList.get(t-1).getNextTable().add(this.tableList.get(t2-1));
                        this.tableList.get(t2-1).setPrevTable(this.tableList.get(t-1));
                    }
                    else {
                        oldFromTable = t;
                        this.addTable(this.tableList.get(t-1).getTableName());
                        for (int i = 1; i <= attrNode.getEntity().getNumKeyAttrs(); i++) {
                            t3 = attrNode.getTableIndex();
                            // ------------------------------------
                            // Parameters for call to GetColumnName
                            // ------------------------------------
                            ParameterHolder_integer qq_tableIndex = new ParameterHolder_integer(t3);
                            ParameterHolder_TextData qq_columnName = new ParameterHolder_TextData();
                            attrNode.getEntity().getColumnName(i, qq_tableIndex, qq_columnName);
                            t3 = qq_tableIndex.getInt();
                            c = (TextData)qq_columnName.getObject();
                            if (c == null) {
                                c = new TextData();
                            }
                            this.addConstraint(c3.replaceParameters("t%1.%2 = t%3.%2", new IntegerData(t), c, this.getNumTables()).toString());
                        }
                        t = this.getNumTables().getValue();
                        newFromTable = t;
                        this.tableList.get(t-1).setNextTable(new Array_Of_SqlQueryTable<SqlQueryTable>());
                        this.tableList.get(t-1).getNextTable().add(this.tableList.get(t2-1));
                        this.tableList.get(t2-1).setPrevTable(this.tableList.get(t-1));
                    }
                    this.tableList.get(t-1).setJoinOp(opNodeOpCode);
                    if (this.getDBSession().getDBVendorType() != Constants.DB_VT_INFORMIX) {
                        this.tableList.get(t2-1).setOnClause(result);
                    }
                }
                //
                //   We've now completed linking the joined tables together in the
                //   table list.  Now we need to create the join condition.  Depending
                //   on the database this may end up in the where clause or in the
                //   join clause.
                //
                int params = (opNodeOp&ConstraintOperation.PCOUNT_MASK)/ConstraintOperation.PCOUNT_INCREMENT;
                if (stack.size() < params*2) {
                    throw new Error(Error.QC_CONSTRAINT_STACK_EMPTY, "GetWhereText", this).getException();
                }
                int format = this.operationFormat(opNodeOp);
                if (doFancyJoin) {
                    c2 = new TextData(" = ");
                }
                else {
                    c2 = this.infixOperator(opNodeOp, 1);
                }
                for (int i = 1; i <= params*2; i++) {
                    if (i > 1) {
                        if ((i&1) > 0) {
                            result.concat(" and ");
                        }
                        else {
                            result.concat(c2);
                        }
                    }
                    node = stack.get(stack.size()-1);
                    if (!(node instanceof ConstraintAttr)) {
                        throw new Error(Error.QC_NEED_ATTR_NODE, "GetWhereText", this).getException();
                    }
                    stack.deleteRow(stack.size()- 1);
                    attrNode = (ConstraintAttr)node;
                    t = attrNode.getTableIndex();
                    // ------------------------------------
                    // Parameters for call to GetColumnName
                    // ------------------------------------
                    ParameterHolder_integer qq_tableIndex = new ParameterHolder_integer(t);
                    ParameterHolder_TextData qq_columnName = new ParameterHolder_TextData();
                    attrNode.getEntity().getColumnName(attrNode.getAttr(), qq_tableIndex, qq_columnName);
                    t = qq_tableIndex.getInt();
                    c = (TextData)qq_columnName.getObject();
                    if (t == oldFromTable) {
                        t = newFromTable;
                    }
                    else if (t == oldToTable) {
                        t = newToTable;
                    }
                    if (c == null) {
                        c = new TextData();
                    }
                    result.concat(c3.replaceParameters("t%1.%2", new IntegerData(t), c));
                    if ((i&1) == 0 && (format&SqlQuery.OP_POSTFIX_MASK) > 0) {
                        result.concat(this.postfixOperator(opNodeOp));
                    }
                }
                if (doFancyJoin && this.getDBSession().getDBVendorType() != Constants.DB_VT_INFORMIX) {
View Full Code Here

                        result.setValue( " left outer join " );
                        break;
                    }

                    default: {
                        throw new Error(Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR, "InfixOperator", this, new IntegerData(operation), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
                    }
                }

                break;
            }
            case ConstraintOperation.OPCODE_RIGHTJOIN: {
                switch (this.getDBSession().getDBVendorType()) {
                    case Constants.DB_VT_SYBASE: {
                        result.setValue( " =* " );
                        break;
                    }
                    case Constants.DB_VT_ORACLE: {
                        result.setValue( " (+) = " );
                        break;
                    }
                    case Constants.DB_VT_RDB: {
                        result.setValue( " right outer join " );
                        break;
                    }
                    case Constants.DB_VT_INFORMIX: {
                        result.setValue( ", " );
                        break;
                    }
                    case Constants.DB_VT_INGRES: {
                        result.setValue( " right join " );
                        break;
                    }
                    case Constants.DB_VT_ODBC: {
                        result.setValue( " right outer join " );
                        break;
                    }

                    default: {
                        throw new Error(Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR, "InfixOperator", this, new IntegerData(operation), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
                    }
                }


                break;
            }

            default: {
                throw new Error(Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR, "InfixOperator", this, new IntegerData(operation), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();

            }
        }

        return result;
View Full Code Here

                break;
            }

            default: {
                throw new Error(Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR, "OperationFormat", this, new IntegerData(operation), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();

            }
        }

        return format;
View Full Code Here

                }
                else if (this.getDBSession().getDBVendorType() == Constants.DB_VT_ODBC) {
                    result.setValue( "}" );
                }
                else {
                    throw new Error(Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR, "PostfixOperator", this, new IntegerData(operation), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
                }

                break;
            }
            case ConstraintOperation.OPCODE_RTRIMFIXED: {
                result = this.postfixOperator(ConstraintOperation.OPCODE_RTRIM);

                break;
            }
            case ConstraintOperation.OPCODE_NULL: {
                result.setValue( " is null" );

                break;
            }
            case ConstraintOperation.OPCODE_NOTNULL: {
                result.setValue( " is not null" );

                break;
            }
            case ConstraintOperation.OPCODE_LEFTJOIN: {
                if (this.getDBSession().getDBVendorType() == Constants.DB_VT_ORACLE) {
                    result.setValue( " (+)" );
                }
                else {
                    throw new Error(Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR, "PostfixOperator", this, new IntegerData(operation), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
                }

                break;
            }

            default: {
                throw new Error(Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR, "PostfixOperator", this, new IntegerData(operation), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();

            }
        }

        return result;
View Full Code Here

            case ConstraintOperation.OPCODE_RIGHTJOIN: {
                if (this.getDBSession().getDBVendorType() == Constants.DB_VT_INFORMIX) {
                    result.setValue( "outer " );
                }
                else {
                    throw new Error(Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR, "PrefixOperator", this, new IntegerData(operation), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();
                }

                break;
            }

            default: {
                throw new Error(Error.SQL_ILLEGAL_CONSTRAINT_OPERATOR, "PrefixOperator", this, new IntegerData(operation), Error.qq_Resolver.cERROR_METHODNAME_ORIGINATOR_PARAM1).getException();

            }
        }

        return result;
View Full Code Here

TOP

Related Classes of Framework.IntegerData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.