Example #1
0
def create_shell(data):
    """ Db shells : Create Shell """

    query = 'INSERT INTO shells(shell_id, vision, thought, tag_name, created) VALUES(?, ?, ?, ?, ?);'
    cur = conn.cursor()
    cur.execute(query, data)
    conn.commit()
    return cur.lastrowid
Example #2
0
def delete_shell_search(id_):
    """ Db shells_search : Delete Shell Search """

    query = f'DELETE FROM shells_search WHERE shell_id=?;'
    cur = conn.cursor()
    cur.execute(query, [id_])
    conn.commit()
    return cur.lastrowid
Example #3
0
def create_shell_search(data):
    """ Db shells_search : Save entry to Shell Search """

    query = 'INSERT INTO shells_search(vision, thought, shell_id) VALUES(?, ?, ?);'
    cur = conn.cursor()
    cur.execute(query, data)
    conn.commit()
    return cur.lastrowid
Example #4
0
def update_shell_search(id_, vision, thought):
    """ Db shells_search : Update Shell Search """

    query = f'UPDATE shells_search SET vision=?, thought=? WHERE shell_id=?;'
    cur = conn.cursor()
    cur.execute(query, (vision, thought, id_))
    conn.commit()
    return cur.lastrowid
Example #5
0
def delete_shell_by_tag_name(name):
    """ Db shells : Delete Shell """

    query = f'DELETE FROM shells WHERE tag_name="{name}";'
    cur = conn.cursor()
    cur.execute(query)
    conn.commit()
    return cur.lastrowid
Example #6
0
def delete_shell(id):
    """ Db shells : Delete Shell """

    query = f'DELETE FROM shells WHERE shell_id="{id}";'
    cur = conn.cursor()
    cur.execute(query)
    conn.commit()
    return cur.lastrowid
Example #7
0
def update_shell(id_, vision, thought, tag):
    """ Db shells : Update Shell """

    query = f'UPDATE shells SET vision=?, thought=?, tag_name=?, created=? WHERE shell_id=?;'
    cur = conn.cursor()
    cur.execute(query, (vision, thought, tag, datetime.now(), id_))
    conn.commit()
    return cur.lastrowid
Example #8
0
def update_shell_update_tag_to_default(tag_name, updated_name='default'):
    """ Db shells : Update Shell """

    query = f'UPDATE shells SET tag_name="{updated_name}" WHERE tag_name="{tag_name}";'
    cur = conn.cursor()
    cur.execute(query)
    conn.commit()
    return cur.lastrowid
Example #9
0
def create_tag(data):
    """ Db tags : Create Tag """

    query = 'INSERT INTO tags(tag_id, tag_name) VALUES(?, ?);'
    cur = conn.cursor()
    cur.execute(query, data)
    conn.commit()
    return cur.lastrowid
Example #10
0
def delete_shell_search_by_tag_name(name):
    """ Db shells_search : Delete Shell Search """

    query = '''
                DELETE FROM shells_search WHERE shell_id IN (
                    SELECT shell_id FROM shells WHERE tag_name=?
                );
            '''
    cur = conn.cursor()
    cur.execute(query, [name])
    conn.commit()
    return cur.lastrowid