Esempio n. 1
0
 def operate(self):
     if base.operation.operate(self):
         self.dbname = self.getSingleOption("name")
         self.where = self.getSingleOption("where")
         db = db_objects.db(self.dbname)
         data = db.delete_tag(self.where)
         errorMessage = data[0]
         data = data[1]
         if errorMessage == None:
             if self.where == None:
                 print self.output_string("Delete all tag",
                                          base.Colors.Purple, True)
             else:
                 print self.output_string(
                     "Delete tag where (%s)" % (str(self.where)),
                     base.Colors.Purple, True)
                 pass
             for row in data:
                 print "\t", self.output_string("[deleted] ",
                                                base.Colors.Red, True),
                 print self.output_string(str(row[0]), base.Colors.Red,
                                          False), ":",
                 print self.output_string(str(row[1]), base.Colors.Red,
                                          False)
                 pass
             pass
         else:
             self.error(errorMessage)
     return False
Esempio n. 2
0
 def operate(self):
     if base.operation.operate(self):
         self.dbname = self.getSingleOption("name")
         self.detail = self.getSingleOption("detail")
         db = db_objects.db(self.dbname)
         if not db.exists():
             self.error("Benchmark data does not exist.")
             self.error("\tLooking for '%s'."%(db.name))
             return False
         fromTable = "sqlite_master"
         where = "type = 'table'"
         select = "*"
         (errorMessage,data) = db.raw_query(select,fromTable,where)
         print self.output_string("Table names",base.Colors.Purple,True)
         
         if errorMessage == None:
             data = data[1]
             for i in data:
                 if self.detail:
                     print "\n\t",self.output_string(str(i[1]),base.Colors.Blue,False)
                     statement = i[4]
                     start_index = statement.find("(")
                     statement = statement[start_index+1:len(statement)-1]
                     members = statement.split(",")
                     for m in members:
                         print "\t\t",self.output_string(str(m),base.Colors.Cyan,False)
                 else:
                     print "\t",self.output_string(str(i[1]),base.Colors.Blue,False)
         else:
             self.error(errorMessage)
             pass
     return False
Esempio n. 3
0
 def operate(self):
     if base.operation.operate(self):
         self.dbname = self.getSingleOption("name")
         self.location = self.getSingleOption("location")
         self.db = db_objects.db(self.dbname)
         db_report = db_objects.db_report.db_report(self.db)
         return db_report.report(self, self.location)
     return False
Esempio n. 4
0
 def setup(self):
     self.db = db_objects.db(self.dbname)
     self.db.create_database()
     self.suite_name = "."
     if self.arguments and len(self.arguments):
         self.suite_name = self.arguments[0]
     self.suite_name = os.path.abspath(self.suite_name)
     self.suite_info = self.__read_suite_info__(self.suite_name,True)
     if self.suite_info:
         root_suite = self.__find_parent__(self.suite_info)
         if root_suite:
             if self.__update_suite_info_database__(root_suite):
                 return self.__update_case_database__(self.suite_info)
     return (None,None)
Esempio n. 5
0
 def __init__(self):
     runnable.operation.__init__(self)
     self.add_argument("engine","str","ig","engine (ig)")
     self.add_argument("page_size","eval",14,"page size page_size=pow(2,value) valid_values=[10,11,12,13,14,15,16]")
     self.add_argument("diskmap",int,None,"disk map variable (for config).")
     self.add_argument("hostmap","str",None,"host map variable (for config) [remote | local].")
     self.config     = config.ig.Config
     self.rootResultsPath = os.path.abspath("results")
     self.version = None
     self.engine  = "ig"
     self.propertyFile = ig_property.PropertyFile("ig.properties")
     self.db = db_objects.db()
     self.db.create_database()
     self.diskmap = None
     self.hostmap = None
     pass
Esempio n. 6
0
 def operate(self):
     if base.operation.operate(self):
         self.dbname = self.getSingleOption("name")
         self.select = self.getSingleOption("select")
         self.fromTable = self.getSingleOption("from")
         self.where = self.getSingleOption("where")
         db = db_objects.db(self.dbname)
         print self.output_string("Query results", base.Colors.Purple, True)
         (errorMessage, data) = db.raw_query(self.select, self.fromTable,
                                             self.where)
         if errorMessage == None:
             description = data[0]
             data = data[1]
             counter = len(description)
             print "\n--"
             for d in description:
                 print self.output_string(d[0], base.Colors.Blue, True),
                 if counter > 1:
                     print "|",
                     pass
                 counter -= 1
                 pass
             print "\n--"
             for row in data:
                 counter = len(row)
                 for item in row:
                     if (type(item)
                             == types.StringType) or (type(item)
                                                      == types.UnicodeType):
                         print self.output_string('"%s"' % (item),
                                                  base.Colors.Blue, False),
                     else:
                         print self.output_string(item, base.Colors.Blue,
                                                  False),
                         pass
                     if counter > 1:
                         print "|",
                         pass
                     counter -= 1
                     pass
                 print
             print "--\n"
             pass
         else:
             self.error(errorMessage)
             pass
     return False
Esempio n. 7
0
 def operate(self):
     if base.operation.operate(self):
         self.dbname = self.getSingleOption("name")
         self.select = self.getSingleOption("select")
         self.fromTable  = self.getSingleOption("from")
         self.where = self.getSingleOption("where")
         db = db_objects.db(self.dbname)
         print self.output_string("Query results",base.Colors.Purple,True)
         (errorMessage,data) = db.raw_query(self.select,self.fromTable,self.where)
         if errorMessage == None:
             description = data[0]
             data = data[1]
             counter = len(description)
             print "\n--"
             for d in description:
                 print self.output_string(d[0],base.Colors.Blue,True),
                 if counter > 1:
                     print "|",
                     pass
                 counter -= 1
                 pass
             print "\n--"
             for row in data:
                 counter = len(row)
                 for item in row:
                     if (type(item) == types.StringType) or (type(item) == types.UnicodeType):
                         print self.output_string('"%s"'%(item),base.Colors.Blue,False), 
                     else:
                         print self.output_string(item,base.Colors.Blue,False),
                         pass
                     if counter > 1:
                         print "|",
                         pass
                     counter -= 1
                     pass
                 print
             print "--\n"
             pass
         else:
             self.error(errorMessage)
             pass
     return False
Esempio n. 8
0
 def __init__(self):
     runnable.operation.__init__(self)
     self.add_argument("engine", "str", "ig", "engine (ig)")
     self.add_argument(
         "page_size", "eval", 14,
         "page size page_size=pow(2,value) valid_values=[10,11,12,13,14,15,16]"
     )
     self.add_argument("diskmap", int, None,
                       "disk map variable (for config).")
     self.add_argument("hostmap", "str", None,
                       "host map variable (for config) [remote | local].")
     self.config = config.ig.Config
     self.rootResultsPath = os.path.abspath("results")
     self.version = None
     self.engine = "ig"
     self.propertyFile = ig_property.PropertyFile("ig.properties")
     self.db = db_objects.db()
     self.db.create_database()
     self.diskmap = None
     self.hostmap = None
     pass
Esempio n. 9
0
 def operate(self):
     if base.operation.operate(self):
         self.dbname = self.getSingleOption("name")
         self.where = self.getSingleOption("where")    
         db = db_objects.db(self.dbname)
         data = db.delete_tag(self.where)
         errorMessage = data[0]
         data = data[1]
         if errorMessage == None:
             if self.where == None:
                 print self.output_string("Delete all tag",base.Colors.Purple,True)
             else:
                 print self.output_string("Delete tag where (%s)"%(str(self.where)),base.Colors.Purple,True)
                 pass
             for row in data:
                 print "\t",self.output_string("[deleted] ",base.Colors.Red,True),
                 print self.output_string(str(row[0]),base.Colors.Red,False),":",
                 print self.output_string(str(row[1]),base.Colors.Red,False)
                 pass
             pass
         else:
             self.error(errorMessage)
     return False
Esempio n. 10
0
    def operate(self):
        if base.operation.operate(self):
            self.dbname = self.getSingleOption("name")
            self.detail = self.getSingleOption("detail")
            db = db_objects.db(self.dbname)
            if not db.exists():
                self.error("Benchmark data does not exist.")
                self.error("\tLooking for '%s'." % (db.name))
                return False
            fromTable = "sqlite_master"
            where = "type = 'table'"
            select = "*"
            (errorMessage, data) = db.raw_query(select, fromTable, where)
            print self.output_string("Table names", base.Colors.Purple, True)

            if errorMessage == None:
                data = data[1]
                for i in data:
                    if self.detail:
                        print "\n\t", self.output_string(
                            str(i[1]), base.Colors.Blue, False)
                        statement = i[4]
                        start_index = statement.find("(")
                        statement = statement[start_index + 1:len(statement) -
                                              1]
                        members = statement.split(",")
                        for m in members:
                            print "\t\t", self.output_string(
                                str(m), base.Colors.Cyan, False)
                    else:
                        print "\t", self.output_string(str(i[1]),
                                                       base.Colors.Blue, False)
            else:
                self.error(errorMessage)
                pass
        return False