idk this works for me I guess

This commit is contained in:
Shaquille Soekhlal 2019-07-01 22:38:06 -03:00
parent 5ff6670b3c
commit f41ccf5257
3 changed files with 29 additions and 27 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.11)
project(park) project(park)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)

View File

@ -94,16 +94,16 @@ Customer query_customer_with_id(int id) {
// vector<Park_spot> populate_spots(){ vector<Park_spot> populate_spots(){
// vector<Park_spot> spots; vector<Park_spot> spots;
// SQLite::Statement query(data::db, "SELECT * FROM Park_spot WHERE id > 0;"); SQLite::Statement query(data::db, "SELECT * FROM Park_spot WHERE id > 0;");
// // query.bind(1, 2); // query.bind(1, 2);
// while (query.executeStep()) { while (query.executeStep()) {
// int id = query.getColumn(0); int id = query.getColumn(0);
// int taken = query.getColumn(1); int taken = query.getColumn(1);
// int cid = query.getColumn(2); int cid = query.getColumn(2);
// // park_customers.push_back(query_customer_with_id(cid)); // park_customers.push_back(query_customer_with_id(cid));
// spots.push_back({id, taken, cid}); spots.push_back({id, taken, cid});
// } }
// return spots; return spots;
// } }

View File

@ -43,21 +43,23 @@ int main() {
cout << "\n" << i.id << "," << i.parked_customer; cout << "\n" << i.id << "," << i.parked_customer;
} }
populate_spots();
} }
vector<Park_spot> populate_spots(){ // vector<Park_spot> populate_spots(){
vector<Park_spot> spots; // vector<Park_spot> spots;
SQLite::Statement query(data::db, "SELECT * FROM Park_spot WHERE id > 0;"); // SQLite::Statement query(data::db, "SELECT * FROM Park_spot WHERE id > 0;");
// query.bind(1, 2); // // query.bind(1, 2);
while (query.executeStep()) { // while (query.executeStep()) {
int id = query.getColumn(0); // int id = query.getColumn(0);
int taken = query.getColumn(1); // int taken = query.getColumn(1);
int cid = query.getColumn(2); // int cid = query.getColumn(2);
// park_customers.push_back(query_customer_with_id(cid)); // // park_customers.push_back(query_customer_with_id(cid));
spots.push_back({id, taken, cid}); // spots.push_back({id, taken, cid});
} // }
return spots; // return spots;
} // }