Beispiel #1
0
        // Map HGrid to HHisItem[].  Grid must have ts and val columns.
        public static HHisItem[] gridToItems(HGrid grid)
        {
            HCol ts  = grid.col("ts");
            HCol val = grid.col("val");

            HHisItem[] items = new HHisItem[grid.numRows];
            for (int i = 0; i < items.Length; ++i)
            {
                HRow row = grid.row(i);
                // Timestamp can't be NULL but val can
                items[i] = new HHisItem((HDateTime)row.get(ts, true), row.get(val, false));
            }
            return(items);
        }
Beispiel #2
0
        /**
         * Query one entity record that matches the given filter.  If
         * there is more than one record, then it is undefined which one is
         * returned.  If there are no matches than return null or raise
         * UnknownRecException based on checked flag.
         * NOTE: Was final
         */
        public HDict read(string filter, bool bChecked)
        {
            HGrid grid = readAll(filter, 1);

            if (grid.numRows > 0)
            {
                return(grid.row(0));
            }
            if (bChecked)
            {
                throw new Exception("rec not found for: " + filter);
            }
            return(null);
        }
Beispiel #3
0
        /**
         * Read a list of entity records by their unique identifier.
         * Return a grid where each row of the grid maps to the respective
         * id array (indexes line up).  If checked is true and any one of the
         * ids cannot be resolved then raise UnknownRecException for first id
         * not resolved.  If checked is false, then each id not found has a
         * row where every cell is null.
         * NOTE: Was final
         */
        public HGrid readByIds(HRef[] ids, bool bChecked)
        {
            HGrid grid = onReadByIds(ids);

            if (bChecked)
            {
                for (int i = 0; i < grid.numRows; ++i)
                {
                    if (grid.row(i).missing("id"))
                    {
                        throw new Exception("rec not found for: " + ids[i].ToString());
                    }
                }
            }
            return(grid);
        }