Prepared statements

Job ID: 35142962

Budget: ₹600 – ₹1,500 INR

Write a program that adds to a menu based program for the Sakila database. The starter file contains code (similar to the in-class demo) for running a query to view customer rental information using prepared statements. Add to the main.cpp the code to connect to the database file. You should fill in the viewCustomer function which will be run when the user chooses option 2. This function should run a query that gets the customer information for all customers in the database and uses that to display a menu of options containing the id - last name, first name to the user. Based on the user choice the function should print the customer's name, phone number, address including city, email address, if they are active and last update for the record. You should use prepared statements to run the queries.

INPUT VALIDATION: You should make sure whenever a user makes a choice from a menu that it is a valid menu option. When choosing a customer from the menu, if the user chooses something outside of the range of valid customers then you should print an error. You also have to handle input failure by adding a !cin condtion to your input validation loop, and making sure that you do cin.clear() and cin.ignore() when you have !cin so that you can clean up any input stream problems.
Related categories: C Programming SQL