idk this works for me I guess
This commit is contained in:
parent
5ff6670b3c
commit
f41ccf5257
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
project(park)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
26
Query.cpp
26
Query.cpp
@ -94,16 +94,16 @@ Customer query_customer_with_id(int id) {
|
||||
|
||||
|
||||
|
||||
// vector<Park_spot> populate_spots(){
|
||||
// vector<Park_spot> spots;
|
||||
// SQLite::Statement query(data::db, "SELECT * FROM Park_spot WHERE id > 0;");
|
||||
// // query.bind(1, 2);
|
||||
// while (query.executeStep()) {
|
||||
// int id = query.getColumn(0);
|
||||
// int taken = query.getColumn(1);
|
||||
// int cid = query.getColumn(2);
|
||||
// // park_customers.push_back(query_customer_with_id(cid));
|
||||
// spots.push_back({id, taken, cid});
|
||||
// }
|
||||
// return spots;
|
||||
// }
|
||||
vector<Park_spot> populate_spots(){
|
||||
vector<Park_spot> spots;
|
||||
SQLite::Statement query(data::db, "SELECT * FROM Park_spot WHERE id > 0;");
|
||||
// query.bind(1, 2);
|
||||
while (query.executeStep()) {
|
||||
int id = query.getColumn(0);
|
||||
int taken = query.getColumn(1);
|
||||
int cid = query.getColumn(2);
|
||||
// park_customers.push_back(query_customer_with_id(cid));
|
||||
spots.push_back({id, taken, cid});
|
||||
}
|
||||
return spots;
|
||||
}
|
28
main.cpp
28
main.cpp
@ -43,21 +43,23 @@ int main() {
|
||||
cout << "\n" << i.id << "," << i.parked_customer;
|
||||
}
|
||||
|
||||
populate_spots();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
vector<Park_spot> populate_spots(){
|
||||
vector<Park_spot> spots;
|
||||
SQLite::Statement query(data::db, "SELECT * FROM Park_spot WHERE id > 0;");
|
||||
// query.bind(1, 2);
|
||||
while (query.executeStep()) {
|
||||
int id = query.getColumn(0);
|
||||
int taken = query.getColumn(1);
|
||||
int cid = query.getColumn(2);
|
||||
// park_customers.push_back(query_customer_with_id(cid));
|
||||
spots.push_back({id, taken, cid});
|
||||
}
|
||||
return spots;
|
||||
}
|
||||
// vector<Park_spot> populate_spots(){
|
||||
// vector<Park_spot> spots;
|
||||
// SQLite::Statement query(data::db, "SELECT * FROM Park_spot WHERE id > 0;");
|
||||
// // query.bind(1, 2);
|
||||
// while (query.executeStep()) {
|
||||
// int id = query.getColumn(0);
|
||||
// int taken = query.getColumn(1);
|
||||
// int cid = query.getColumn(2);
|
||||
// // park_customers.push_back(query_customer_with_id(cid));
|
||||
// spots.push_back({id, taken, cid});
|
||||
// }
|
||||
// return spots;
|
||||
// }
|
Loading…
Reference in New Issue
Block a user