コード例 #1
0
        /**
         * Method declaration
         *
         *
         * @return
         */
        public string getTableName()
        {
            if (iType == ASTERIX)
            {
                return(sTable);
            }

            if (iType == COLUMN)
            {
                if (tFilter == null)
                {
                    return(sTable);
                }
                else
                {
                    return(tFilter.getTable().getName());
                }
            }

            // todo
            return("");
        }
コード例 #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;
            }
        }
コード例 #3
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;
            }
        }