Ejemplo n.º 1
0
def get_one_task(id):
    try:
        conn,db=connect_db()
        query=db.execute("select id,name,description from tasks where id=?",[id])
        data=query.fetchone()
        conn.commit()
        db.close()
        return data
    except:
        pass
Ejemplo n.º 2
0
def get_all_task():
    try:
        conn,db=connect_db()
        query=db.execute("select id,name,description from tasks")
        data=query.fetchall()
        conn.commit()
        db.close()
        return data
    except:
        pass
Ejemplo n.º 3
0
def delete_task(id):
    try:
        conn,db=connect_db()
        db.execute("delete from tasks where id=?",
        [id])
        conn.commit()
        db.close()
        return True
    except:
        return Flase
Ejemplo n.º 4
0
def create_task(name,description):
    try:
        conn,db=connect_db()
        db.execute("insert into tasks (name,description) values(?,?)",
        (name,description))
        conn.commit()
        db.close()
        return True
    except:
        return Flase
Ejemplo n.º 5
0
def update_task(id,name,description):
    try:
        conn,db=connect_db()
        db.execute("update tasks set name=?,description=? where id=?",
        (name,description,id))
        conn.commit()
        db.close()
        return True
    except:
        return Flase