treatment strategies
May 14, 2020
white-collar legislation
May 14, 2020

C++

C++
Paper instructions:
Problem 7.1
In this problem, we will be utilizing the SQLite serverless database library to load and query a database file. The required library libsqlite3.so and header file sqlite3.h appear to be installed on some Athena workstations (but not on the Athena1 server). If you cannot find it on your own machine’s distribution, you can download the source code from http://www.sqlite.org/ download.html. Generally, for your machine, you will have to compile the library yourself. For Linux, use the .tar.gz source code amalgamation package that contains the configure and makefile support. To compile for Linux, extract the files, run ./configure, make, and make install. For other platforms, you will need to compile and install the library yourself.
(a) Download the source code prob1.c and movie database file movies.db from Stellar. The database contains a list of movies indexed by BarCode. The list also contains the MovieTitle, MovieCategory, ProductionYear, Format, Language, and Web fields for each movie. In this part, we will use the sqlite3 library to load this database and perform simple SQL queries. (In case you’re curious, the database lists information for movies available from the library in the Sidney Pacific dormitory.) The source code will get you started.
For this part, you need to fill in the missing code to the database file, perform an SQL query, and close the database. In particular, you will be expected to use the sqlite3 (), sqlite3 exec(), and sqlite3 close() functions in your code. Read the documentation available on the SQLite website for details.
Via Stellar, turn in your code for this part, as well as your program’s output for the first three SQL queries provided in your code.