Exemple #1
0
        /**
         * Method declaration
         *
         *
         * @param f
         * @param ownfilter
         *
         * @throws Exception
         */
        public void resolve(TableFilter f, bool ownfilter)
        {
            if (eCondition != null)
            {
                // first set the table filter in the condition
                eCondition.resolve(f);

                if (f != null && ownfilter)
                {
                    // the table filter tries to get as many conditions as possible
                    // but only if the table filter belongs to this query
                    f.setCondition(eCondition);
                }
            }

            int len = eColumn.Length;

            for (int i = 0; i < len; i++)
            {
                eColumn[i].resolve(f);
            }
        }
Exemple #2
0
        /**
         * Method declaration
         *
         *
         * @param f
         *
         * @throws Exception
         */
        public void resolve(TableFilter f)
        {
            if (f != null && iType == COLUMN)
            {
                if (sTable == null || f.getName().Equals(sTable))
                {
                    int i = f.getTable().searchColumn(sColumn);

                    if (i != -1)
                    {
                        // todo: other error message: multiple tables are possible
                        Trace.check(tFilter == null || tFilter == f,
                                    Trace.COLUMN_NOT_FOUND, sColumn);

                        tFilter   = f;
                        iColumn   = i;
                        sTable    = f.getName();
                        iDataType = f.getTable().getColumnType(i);
                    }
                }
            }

            // currently sets only data type
            // todo: calculate fixed expressions if possible
            if (eArg != null)
            {
                eArg.resolve(f);
            }

            if (eArg2 != null)
            {
                eArg2.resolve(f);
            }

            if (sSelect != null)
            {
                sSelect.resolve(f, false);
                sSelect.resolve();
            }

            /*			if (fFunction != null)
             *                      {
             *                              fFunction.resolve(f);
             *                      }
             */
            if (iDataType != 0)
            {
                return;
            }

            switch (iType)
            {
            /*				case FUNCTION:
             *                                      iDataType = fFunction.getReturnType();
             *
             *                                      break;
             */
            case QUERY:
                iDataType = sSelect.eColumn[0].iDataType;

                break;

            case NEGATE:
                iDataType = eArg.iDataType;

                break;

            case ADD:

            case SUBTRACT:

            case MULTIPLY:

            case DIVIDE:
                iDataType = eArg.iDataType;

                break;

            case CONCAT:
                iDataType = Column.VARCHAR;

                break;

            case NOT:

            case EQUAL:

            case BIGGER_EQUAL:

            case BIGGER:

            case SMALLER:

            case SMALLER_EQUAL:

            case NOT_EQUAL:

            case LIKE:

            case AND:

            case OR:

            case IN:

            case EXISTS:
                iDataType = Column.BIT;

                break;

            case COUNT:
                iDataType = Column.INTEGER;

                break;

            case MAX:

            case MIN:

            case SUM:

            case AVG:
                iDataType = eArg.iDataType;

                break;

            case CONVERT:

                // it is already set
                break;

            case IFNULL:

            case CASEWHEN:
                iDataType = eArg2.iDataType;

                break;
            }
        }