def insert_random(self, table_name): connection = database_helper.connect() cursor = database_helper.get_cursor(connection) random_item = randomizer.generate_random_item(database_helper.get_table_object(table_name)) result = database_helper.insert_item(connection, cursor, table_name, random_item) database_helper.close_database_connection(connection, cursor) return result
def find_query(self, table_name, input, object_to_find): connection = database_helper.connect() cursor = database_helper.get_cursor(connection) sql = self.get_find_query(table_name, input) cursor.execute(sql, object_to_find) result = cursor.fetchall() database_helper.close_database_connection(connection, cursor) print(result) return result
def select_all(self, table_name): connection = database_helper.connect() cursor = database_helper.get_cursor(connection) result = database_helper.select_all(connection, cursor, table_name) database_helper.close_database_connection(connection, cursor) return result
def query(self, sql_query): connection = database_helper.connect() cursor = database_helper.get_cursor(connection) result = database_helper.query(connection, cursor, sql_query) database_helper.close_database_connection(connection, cursor) return result
def update_item(self, table_name, object_to_update, new_object): connection = database_helper.connect() cursor = database_helper.get_cursor(connection) result = database_helper.update_item(connection, cursor, table_name, object_to_update, new_object) database_helper.close_database_connection(connection, cursor) return result
def delete_item(self, table_name, object_to_delete): connection = database_helper.connect() cursor = database_helper.get_cursor(connection) result = database_helper.delete_item(connection, cursor, table_name, object_to_delete) database_helper.close_database_connection(connection, cursor) return result
def select_item(self, table_name, obj_to_find): connection = database_helper.connect() cursor = database_helper.get_cursor(connection) result = database_helper.select_item(connection, cursor, table_name, obj_to_find) database_helper.close_database_connection(connection, cursor) return result
def insert_item(self, obj, table_name): connection = database_helper.connect() cursor = database_helper.get_cursor(connection) result = database_helper.insert_item(connection, cursor, table_name, obj) database_helper.close_database_connection(connection, cursor) return result