package persistlayer;

import java.sql.Connection;
import java.sql.ResultSet;

//This class is the primary persistent (model) layer class. 
//It explicitly communicates with the DbAccessImpl
public class CarPersistImpl {

	//global variables
	DbAccessImpl db = new DbAccessImpl();
	Connection con = db.connect();
	
	public ResultSet getCars() {
		ResultSet rs;
		String query = "SELECT * FROM cars";
		rs = db.retrieve(con, query);
		return rs;
	}

	public ResultSet getTypes() {
		String query = "SELECT carType FROM cars";
		return db.retrieve(con, query);
	}

	public ResultSet getModels() {
		String query = "SELECT model FROM cars";
		return db.retrieve(con, query);
	}

	public ResultSet getMakes() {
		String query = "SELECT make FROM cars";
		return db.retrieve(con, query);
	}

	public ResultSet getCar(String id) {
		String query = "SELECT * FROM cars where id = \'" + id + "\'";
		return db.retrieve(con, query);
	}

	
}

@@ -919,14 +919,298 @@
 ery);%0A%09%7D
+%0A%09%0A%09public boolean verifyData(String d1, String d2)%0A%09%7B%0A%09%09ResultSet rs = null; %0A%09%09%0A%09%09String query = %22select * from rental_dates where startDate = %22 + d1 + %22 AND endDate = %22 + d2; %0A%09%09%0A%09%09rs = db.retrieve(con, query); %0A%09%09%0A%09%09if (rs == null)%0A%09%09%09return false; %0A%09%09else %0A%09%09%09return true; %0A%09%09%0A%09%7D
 %0A%0A%09%0A%7D%0A

update car persist to verify rental date