|
|
|
|
@ -28,6 +28,27 @@ int main()
|
|
|
|
|
|
|
|
|
|
driver = get_driver_instance();
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/songs")([](){
|
|
|
|
|
con = driver->connect(getenv("DBURL"),getenv("DBUSER"),getenv("DBPWD"));
|
|
|
|
|
con->setSchema("my_group_songs");
|
|
|
|
|
stmt = con->createStatement();
|
|
|
|
|
crow::json::wvalue entries;
|
|
|
|
|
|
|
|
|
|
ResultSet *res = stmt->executeQuery("SELECT * FROM songs WHERE learned=True ORDER BY title ASC;");
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
while (res->next()) {
|
|
|
|
|
int id = res->getInt("id");
|
|
|
|
|
string title = res->getString("title");
|
|
|
|
|
string notes = res->getString("notes");
|
|
|
|
|
entries[i] = {{"id", id}, {"title", title}, {"notes", notes}};
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delete res;
|
|
|
|
|
return entries;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/categories")([](){
|
|
|
|
|
connect();
|
|
|
|
|
crow::json::wvalue entries;
|
|
|
|
|
|