예제 #1
0
def delete_student(usn):
    try:
        with db.DbContext() as Connection:
            cursor = Connection.cursor()
            cursor.execute("DELETE FROM student WHERE usn=?",(usn,))
    except Exception as e:
        print(str(e))
예제 #2
0
def add_student(usn, name, sem, placed):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("INSERT INTO student(usn, name, sem, placed) VALUES(?,?,?,?)",(usn, name, sem, placed))
    except Exception as e:
        print(str(e))
예제 #3
0
def reg_stu_internship(usn, iid, status):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("INSERT INTO registration(iid, usn, status) VALUES(?,?,?)",(iid,usn, status))
    except Exception as e:
        print(str(e))
예제 #4
0
def delete_internship(id):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("DELETE FROM internship where id=? ",(id,))
    except Exception as e:
        print(str(e))
예제 #5
0
def update_stu_intership_status(usn, iid, status):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("UPDATE registration set status=? WHERE usn=? and iid=?",(status,usn,iid))
    except Exception as e:
        print(str(e))
예제 #6
0
def delete_internship(id):
    try:
        with db.DbContext() as conn:
            cursor = conn.cursor()
            cursor.execute("Delete from internship where id = ?", (id, ))
    except Exception as e:
        print(e)
예제 #7
0
def update_student(usn,sem):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("UPDATE student set sem=? WHERE usn=?",(sem, usn,))
    except Exception as e:
        print(str(e))   
예제 #8
0
def delete_internship(name):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("delete the intership where iname=: ", (name, ))

    except Exception as e:
        print(str(e))
예제 #9
0
def delete_student(name):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("delete the student where name=: ", (name, ))

    except Exception as e:
        print(str(e))
예제 #10
0
def delete_internship(id):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("delete from internship where id=?", (id, ))
            print("Internship with ID:{id} deleted!")
    except Exception as e:
        print(f"{str(e)}")
예제 #11
0
def delete_student(usn):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("delete from student where usn=?", (usn, ))
            print("Student deleted!")
    except Exception as e:
        print(f"{str(e)}")
예제 #12
0
def company_ws_count():
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("SELECT count(company) FROM (SELECT DISTINCT company FROM  internship)")
            company_count = cursor.fetchone()
            print(f"Total companies that provide internship : {company_count[0]}\n")
    except Exception as e:
        print(str(e))
예제 #13
0
def student_ws_count():
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("SELECT count(*) from student")
            student_count = cursor.fetchone()
            print(f"Total students : {student_count[0]}")
    except Exception as e:
        print(str(e))
예제 #14
0
def change_status_internship(id, status):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("update internship set status = ? where id=?",
                           (status, id))
            print("Internship With ID:{id} Status updated!")
    except Exception as e:
        print(f"{str(e)}")
예제 #15
0
def add_internship(iname,company,i_year):
    id = _get_new_id()
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("insert into internship(id,iname,company,i_year,status) values(?,?,?,?,?)",(id,iname,company,i_year,1))
            print(f"Internship is added successfully with id:{id}")
    except Exception as e:
        print(str(e))
예제 #16
0
def change_status_internship(status, name):
    try:
        with db.DbContext() as conn:
            cursor = conn.cursor()
            cursor.execute("UPDATE internship set status = ? where iname = ? ",
                           (status, name))
            conn.commit()
    except Exception as e:
        print(e)
예제 #17
0
def add_student_internship(usn, iid, status):
    try:
        with db.DbContext() as conn:
            cursor = conn.cursor()
            cursor.execute("insert into registration values(?,?,?)",
                           (iid, usn, status))

    except Exception as e:
        print(e)
예제 #18
0
def delete_student(usn):
    try:
        with db.DbContext() as conn:
            cursor = conn.cursor()
            cursor.execute("Delete from student where usn = ?", (usn, ))
            print("Successfully deleted")

    except Exception as e:
        print(e)
예제 #19
0
def update_stu_intership_status(usn, status):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("update register set status = ? where usn=?",
                           (status, usn))
            print("Status updated!")
    except Exception as e:
        print(f"{str(e)}")
예제 #20
0
def view_all_reg_student():
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("select iid,usn,status from register")
            rows = cursor.fetchall()
            register_pro_lst = [Register(*row) for row in rows]
            _view_registered_list(register_pro_lst)
    except Exception as e:
        print(str(e))
예제 #21
0
def view_all_internships():
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("select id,iname,company,i_year,status from internship")
            rows = cursor.fetchall()
            intern_pro_lst = [Internship(*row) for row in rows]
            _view_internship_list(intern_pro_lst)
    except Exception as e:
        print(str(e))
예제 #22
0
def reg_student_internship(usn, iid):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute(
                "insert into register(iid,usn,status) values(?,?,?)",
                (iid, usn, 0))
            print(f"Student registered successfully for iid:{iid} internship")
    except Exception as e:
        print(str(e))
예제 #23
0
def update_stu_intership_status(usn, status):
    try:
        with db.DbContext() as conn:
            cursor = conn.cursor()
            cursor.execute("UPDATE registration set status = ? where usn = ?",
                           (status, usn))
            print(f"Status: {status} successfully updated")

    except Exception as e:
        print(e)
예제 #24
0
def add_student_internship(name, sem, usn, placed):
    iid = _get_new_id()
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("insert into student values(?,?,?,?)",
                           (usn, name, sem, placed))
            print(f"student is added successfully with id:{iid}")
    except Exception as e:
        print(str(e))
예제 #25
0
def update_student(usn, sem):
    try:
        with db.DbContext() as conn:
            cursor = conn.cursor()
            cursor.execute("UPDATE student set sem = ? where usn = ?",
                           (sem, usn))
            print("Student successfully updated")

    except Exception as e:
        print(e)
예제 #26
0
def search_internship_by_name(name):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("select all from intrship where ename:", (name, ))
            row = cursor.fetchone()
            intern_pro_lst = [Internship(*row)]
            _view_internship_list(intern_pro_lst)
    except Exception as e:
        print(str(e))
예제 #27
0
def view_all_students():
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute("select usn,name,sem,placed from student")
            rows = cursor.fetchall()
            student_pro_lst = [Student(*row) for row in rows]
            _view_student_list(student_pro_lst)
    except Exception as e:
        print(str(e))
예제 #28
0
def add_student(usn, name, sem, placed):
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute(
                "insert into student(usn,name,sem,placed) values(?,?,?,?)",
                (usn, name, sem, placed))
            print(f"Student is added successfully!!")
    except Exception as e:
        print(str(e))
예제 #29
0
def add_student(usn, name, sem, placed):
    try:
        with db.DbContext() as conn:
            cursor = conn.cursor()
            cursor.execute(
                "insert into student(usn,name,sem,placed) values(?,?,?,?)",
                (usn, name, sem, placed))
            print(f"Registration is successfull")

    except Exception as e:
        print(e)
예제 #30
0
def company_ws_count():
    try:
        with db.DbContext() as connection:
            cursor = connection.cursor()
            cursor.execute(
                "select company,count(*) from internship group by company")
            rows = cursor.fetchall()
            company_pro_lst = [Company(*row) for row in rows]
            _view_company_count(company_pro_lst)
    except Exception as e:
        print(str(e))