예제 #1
0
        /**
         * Method declaration
         *
         *
         * @return
         *
         * @throws Exception
         */
        public Result processSelect()
        {
            Select select = parseSelect();

            if (select.sIntoTable == null)
            {
                // [email protected] begin changes from 1.50
                //	   return select.getResult(cChannel.getMaxRows());
                return select.getResult( select.limitStart, select.limitCount );
                // [email protected] end changes from 1.50
            }
            else
            {
                Result r = select.getResult(0);
                Table  t = new Table(dDatabase, true, select.sIntoTable, false);

                t.addColumns(r);
                t.createPrimaryKey();

                // SELECT .. INTO can't fail because of violation of primary key
                t.insert(r, cChannel);
                dDatabase.linkTable(t);

                int i = r.getSize();

                r = new Result();
                r.iUpdateCount = i;

                return r;
            }
        }
예제 #2
0
        /**
         * Method declaration
         *
         *
         * @param outerjoin
         *
         * @return
         *
         * @throws Exception
         */
        private TableFilter parseTableFilter(bool outerjoin)
        {
            string token = tTokenizer.getstring();
            Table  t = null;

            if (token.Equals("("))
            {
                tTokenizer.getThis("SELECT");

                Select s = parseSelect();
                Result r = s.getResult(0);

                // it's not a problem that this table has not a unique name
                t = new Table(dDatabase, false, "SYSTEM_SUBQUERY", false);

                tTokenizer.getThis(")");
                t.addColumns(r);
                t.createPrimaryKey();

                // subquery creation can't fail because of violation of primary key
                t.insert(r, cChannel);
            }
            else
            {
                cChannel.check(token, Access.SELECT);

                t = dDatabase.getTable(token, cChannel);
            }

            string sAlias = null;

            token = tTokenizer.getstring();

            if (token.Equals("AS"))
            {
                sAlias = tTokenizer.getName();
            }
            else if (tTokenizer.wasName())
            {
                sAlias = token;
            }
            else
            {
                tTokenizer.back();
            }

            return new TableFilter(t, sAlias, outerjoin);
        }