Page 1 of 1

1. Explain why this is dangerous code. How would you modify it to run safely? form = cgi.FieldStorage() acc = form.getfi

Posted: Sun Jul 03, 2022 11:23 am
by answerhappygod
1. Explain why this is dangerous code. How would you modify itto run safely? form = cgi.FieldStorage() acc =form.getfirst('accession') qry = "SELECT * FROM gene WHEREaccession = '{0}'".format(acc) curs.execute(qry)
2. It is said you should 'clean up your connections' beforeending your python scripts that connect to a database. What methodsdoes this mean you should remember to call? (hint: think about yourconnection and cursor.)