Example #1
0
    def iter_lines(self, lid = None, ltid = None, ltgid = None, top_dt = None,
            end_dt = None, host = None, area = None):
        d_cond = {}
        if lid is not None: d_cond["lid"] = lid
        if ltid is not None: d_cond["ltid"] = ltid
        if ltgid is not None: d_cond["ltgid"] = ltgid
        if top_dt is not None: d_cond["top_dt"] = top_dt
        if end_dt is not None: d_cond["end_dt"] = end_dt
        if area is None or area == "all":
            pass
        elif area[:5] == "host_":
            d_cond["host"] = area[5:]
        else:
            d_cond["area"] = area
        if host is not None: d_cond["host"] = host

        if len(d_cond) == 0:
            raise ValueError("More than 1 argument should NOT be None")

        for row in self._select_log(d_cond):
            lid = int(row[0])
            ltid = int(row[1])
            dt = self.db.datetime(row[2])
            host = row[3]
            if row[4] == "":
                l_w = []
            else:
                l_w = strutil.split_igesc(row[4], self._splitter)
            yield LogMessage(lid, self.lttable[ltid], dt, host, l_w)
Example #2
0
    def iter_lines(self, lid = None, ltid = None, ltgid = None, top_dt = None,
            end_dt = None, host = None, area = None):
        d_cond = {}
        if lid is not None: d_cond["lid"] = lid
        if ltid is not None: d_cond["ltid"] = ltid
        if ltgid is not None: d_cond["ltgid"] = ltgid
        if top_dt is not None: d_cond["top_dt"] = top_dt
        if end_dt is not None: d_cond["end_dt"] = end_dt
        if area is None or area == "all":
            pass
        elif area[:5] == "host_":
            d_cond["host"] = area[5:]
        else:
            d_cond["area"] = area
        if host is not None: d_cond["host"] = host

        if len(d_cond) == 0:
            raise ValueError("More than 1 argument should NOT be None")

        for row in self._select_log(d_cond):
            lid = int(row[0])
            ltid = int(row[1])
            dt = self.db.datetime(row[2])
            host = row[3]
            if row[4] == "":
                l_w = []
            else:
                l_w = strutil.split_igesc(row[4], self._splitter)
            yield LogMessage(lid, self.lttable[ltid], dt, host, l_w)
Example #3
0
 def _init_lttable(self):
     table_name = self.db.join_sql("left outer",
             "lt", "ltg", "ltid", "ltid")
     l_key = ("lt.ltid", "ltg.ltgid", "lt.ltw", "lt.lts", "lt.count")
     sql = self.db.select_sql(table_name, l_key)
     cursor = self.db.execute(sql)
     for row in cursor:
         ltid = int(row[0])
         ltgid = int(row[1])
         ltw = strutil.split_igesc(row[2], self._splitter)
         temp = row[3]
         if temp is None:
             lts = None
         else:
             lts = strutil.split_igesc(temp, self._splitter)
         count = int(row[4])
         self.lttable.restore_lt(ltid, ltgid, ltw, lts, count)
Example #4
0
 def _init_lttable(self):
     table_name = self.db.join_sql("left outer",
             "lt", "ltg", "ltid", "ltid")
     l_key = ("lt.ltid", "ltg.ltgid", "lt.ltw", "lt.lts", "lt.count")
     sql = self.db.select_sql(table_name, l_key)
     cursor = self.db.execute(sql)
     for row in cursor:
         ltid = int(row[0])
         ltgid = int(row[1])
         ltw = strutil.split_igesc(row[2], self._splitter)
         temp = row[3]
         if temp is None:
             lts = None
         else:
             lts = strutil.split_igesc(temp, self._splitter)
         count = int(row[4])
         self.lttable.restore_lt(ltid, ltgid, ltw, lts, count)
Example #5
0
 def iter_words(self, lid = None, ltid = None, ltgid = None, top_dt = None,
         end_dt = None, host = None, area = None):
     d_cond = {}
     if lid is not None: d_cond["lid"] = lid
     if ltid is not None: d_cond["ltid"] = ltid
     if ltgid is not None: d_cond["ltgid"] = ltgid
     if top_dt is not None: d_cond["top_dt"] = top_dt
     if end_dt is not None: d_cond["end_dt"] = end_dt
     if host is not None: d_cond["host"] = host
     if area is not None: d_cond["area"] = area
     if len(d_cond) == 0:
         raise ValueError("More than 1 argument should NOT be None")
     for row in self._select_log(d_cond):
         if row[4] == "":
             yield []
         else:
             yield strutil.split_igesc(row[4], self._splitter)
Example #6
0
 def iter_words(self, lid = None, ltid = None, ltgid = None, top_dt = None,
         end_dt = None, host = None, area = None):
     d_cond = {}
     if lid is not None: d_cond["lid"] = lid
     if ltid is not None: d_cond["ltid"] = ltid
     if ltgid is not None: d_cond["ltgid"] = ltgid
     if top_dt is not None: d_cond["top_dt"] = top_dt
     if end_dt is not None: d_cond["end_dt"] = end_dt
     if host is not None: d_cond["host"] = host
     if area is not None: d_cond["area"] = area
     if len(d_cond) == 0:
         raise ValueError("More than 1 argument should NOT be None")
     for row in self._select_log(d_cond):
         if row[4] == "":
             yield []
         else:
             yield strutil.split_igesc(row[4], self._splitter)