duration console get_integer("duration (minutes)""minutes"minimum= maximum= * director_id get_and_set_director(dbdirectorcursor db cursor(cursor execute("insert into dvds "(titleyeardurationdirector_id"values (????)"(titleyeardurationdirector_id)db commit(this function starts with the same code as the equivalent function from the dvds-dbm py programbut once we have gathered the datait is quite different the director the user entered may or may not be in the directors tableso we have get_and_set_director(function that inserts the director if they are not already in the databaseand in either case returns the director' id ready for it to be inserted into the dvds table with all the data available we execute an sql insert statement we don' need to specify record id since sqlite will automatically provide one for us in the query we have used question marks for placeholders each is replaced by the corresponding value in the sequence that follows the string containing the sql statement named placeholders can also be used as we will see when we look at editing record although it is possible to avoid using placeholders and simply format the sql string with the data embedded into itwe recommend always using placeholders and leaving the burden of correctly encoding and escaping the data items to the database module another benefit of using placeholders is that they improve security since they prevent arbitrary sql from being maliciously injected into query def get_and_set_director(dbdirector)director_id get_director_id(dbdirectorif director_id is not nonereturn director_id cursor db cursor(cursor execute("insert into directors (namevalues (?)"(director,)db commit(return get_director_id(dbdirectorthis function returns the id of the given directorinserting new director record if necessary if record is inserted we retrieve its id using the get_director_id(function we tried in the first place def get_director_id(dbdirector)cursor db cursor(cursor execute("select id from directors where name=?"(director,)