Пример #1
0
        /**
         * Method declaration
         *
         *
         * @param type
         *
         * @return
         *
         * @throws Exception
         */
        public object getValue(int type)
        {
            object o = getValue();

            if (o == null || iDataType == type)
            {
                return(o);
            }

            string s = Column.convertobject(o);

            return(Column.convertstring(s, type));
        }
Пример #2
0
        /**
         * Method declaration
         *
         *
         * @param o
         * @param datatype
         *
         * @return
         *
         * @throws Exception
         */
        private bool testValueList(object o,
                                   int datatype)
        {
            if (iType == VALUELIST)
            {
                if (datatype != iDataType)
                {
                    o = Column.convertobject(o, iDataType);
                }

                return(hList.ContainsKey(o));
            }
            else if (iType == QUERY)
            {
                // todo: convert to valuelist before if everything is resolvable
                Result r    = sSelect.getResult(0);
                Record n    = r.rRoot;
                int    type = r.iType[0];

                if (datatype != type)
                {
                    o = Column.convertobject(o, type);
                }

                while (n != null)
                {
                    object o2 = n.data[0];

                    if (o2 != null && o2.Equals(o))
                    {
                        return(true);
                    }

                    n = n.next;
                }

                return(false);
            }

            throw Trace.error(Trace.WRONG_DATA_TYPE);
        }
Пример #3
0
        /**
         * Method declaration
         *
         *
         * @param type
         *
         * @return
         *
         * @throws Exception
         */
        public object getValue(int type)
        {
            resolve();

            Result r    = getResult(2);             // 2 records are (already) too much
            int    size = r.getSize();
            int    len  = r.getColumnCount();

            Trace.check(size == 1 && len == 1, Trace.SINGLE_VALUE_EXPECTED);

            object o = r.rRoot.data[0];

            if (r.iType[0] == type)
            {
                return(o);
            }

            string s = Column.convertobject(o);

            return(Column.convertstring(s, type));
        }