def create(cls, file, module, cls_name, func, elapsed): """Inserts a new time sample into the database with the given information. :param file: The file the sample is from :type file: str :param module: The module the sample is from :type module: str :param cls_name: The name of the class the sample is from :type cls_name: str :param func: The name of the function the sample is from :type func: str :param elapsed: The elapsed time in seconds :type elapsed: float """ q = "INSERT INTO {} VALUES('{}', '{}', '{}', '{}', {})" SqliteConnection.get().execute( q.format(cls.meta['table'], file, module, cls_name, func, elapsed))
def configure(self, options, conf): """Configure this plugin using the given options""" super(PerfDumpPlugin, self).configure(options, conf) if not self.enabled: return try: self.html_output_file = options.perfdump_html_file except: pass self.db = SqliteConnection.get(self.database_name)
def create(cls, file, module, cls_name, func, elapsed): """Inserts a new time sample into the database with the given information. :param file: The file the sample is from :type file: str :param module: The module the sample is from :type module: str :param cls_name: The name of the class the sample is from :type cls_name: str :param func: The name of the function the sample is from :type func: str :param elapsed: The elapsed time in seconds :type elapsed: float """ q = "INSERT INTO {} VALUES('{}', '{}', '{}', '{}', {})" SqliteConnection.get().execute(q.format(cls.meta['table'], file, module, cls_name, func, elapsed))
def preloop(self): self.db = SqliteConnection.get() self.db.row_factory = sqlite3.Row
def get_cursor(cls): """Return a message list cursor that returns sqlite3.Row objects""" db = SqliteConnection.get() db.row_factory = sqlite3.Row return db.cursor()