From f41ccf5257a5312cd7b28836fa7595c939d26f4f Mon Sep 17 00:00:00 2001 From: Shaquille Soekhlal Date: Mon, 1 Jul 2019 22:38:06 -0300 Subject: [PATCH] idk this works for me I guess --- CMakeLists.txt | 2 +- Query.cpp | 26 +++++++++++++------------- main.cpp | 28 +++++++++++++++------------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dfd9a6..f965e73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.11) project(park) set(CMAKE_CXX_STANDARD 11) diff --git a/Query.cpp b/Query.cpp index bbc1a26..ecebb11 100644 --- a/Query.cpp +++ b/Query.cpp @@ -94,16 +94,16 @@ Customer query_customer_with_id(int id) { -// vector populate_spots(){ -// vector 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; -// } \ No newline at end of file +vector populate_spots(){ + vector 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; +} \ No newline at end of file diff --git a/main.cpp b/main.cpp index 3fc3dd5..872fd19 100644 --- a/main.cpp +++ b/main.cpp @@ -43,21 +43,23 @@ int main() { cout << "\n" << i.id << "," << i.parked_customer; } + populate_spots(); + } -vector populate_spots(){ - vector 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; -} \ No newline at end of file +// vector populate_spots(){ +// vector 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; +// } \ No newline at end of file