Skip to content

Commit 268c556

Browse files
committed
changed city,country,title to select by value% (also case insensitive)
1 parent f518f13 commit 268c556

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Database.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void Database::selectMovieByID(string movieID)
134134
void Database::selectMovieByTitle(string movieTitle)
135135
{
136136
counter = selectCounter = 0;
137-
string query = "SELECT * FROM MOVIES WHERE TITLE LIKE '%" + movieTitle + "%'";
137+
string query = "SELECT * FROM MOVIES WHERE TITLE LIKE '" + movieTitle + "%'";
138138

139139
rc = sqlite3_exec(dbFile, query.c_str(), countCallback, (void *)data, &errMsg);
140140

@@ -149,7 +149,7 @@ void Database::selectMovieByTitle(string movieTitle)
149149
void Database::selectLocationByCity(string cityName)
150150
{
151151
counter = selectCounter = 0;
152-
string query = "SELECT * FROM LOCATIONS WHERE CITY = '" + cityName + "'";
152+
string query = "SELECT * FROM LOCATIONS WHERE CITY LIKE '" + cityName + "%'";
153153

154154
rc = sqlite3_exec(dbFile, query.c_str(), countCallback, (void *)data, &errMsg);
155155

@@ -164,7 +164,7 @@ void Database::selectLocationByCity(string cityName)
164164
void Database::selectLocationByCountry(string countryName)
165165
{
166166
counter = selectCounter = 0;
167-
string query = "SELECT * FROM LOCATIONS WHERE COUNTRY = '" + countryName + "'";
167+
string query = "SELECT * FROM LOCATIONS WHERE COUNTRY LIKE '" + countryName + "%'";
168168

169169
rc = sqlite3_exec(dbFile, query.c_str(), countCallback, (void *)data, &errMsg);
170170

src/fcgi

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)