Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 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
Пример #6
0
 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
Пример #7
0
 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
Пример #8
0
 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