import sqlite3

class Database:
    def __init__(self, database_file):
        self.db = sqlite3.connect(database_file)

    def run_sql_file(self, sql_file_path):
        sql_script_string = ''
        with open(sql_file_path, 'r') as sql_file:
            sql_script_string = sql_file.read()
        
        cursor = self.db.cursor()
        cursor.executescript(sql_script_string)
        self.db.commit()

    def select(self, query, values):
        # Query the database for the specified index
        cursor = self.db.cursor()
        cursor.execute(query, values)
        result = cursor.fetchone()
        if result:
            return result
        else:
            return None

    def selectall(self, query, values = None):
        # Query the database for the specified index
        cursor = self.db.cursor()

        if values is None:
            cursor.execute(query)
        else:
            cursor.execute(query, values)

        result = cursor.fetchall()
        if result:
            return result
        else:
            return None

    def insert(self, query, values):
        # Insert new entry into the database
        cursor = self.db.cursor()
        cursor.execute(query, values)
        new_id = cursor.lastrowid
        self.db.commit()

        return new_id
