Fix for geo lookup: need exact match

This commit is contained in:
Rick Falkvinge
2014-12-13 21:49:02 +01:00
parent aefc0bb16f
commit cd1e73d4c6
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -284,8 +284,7 @@ namespace Swarmops.Database
DbCommand command =
GetDbCommand (
"SELECT " + geographyFieldSequence + " WHERE Name like '" + geographyName.Replace ("'", "''") +
"%'",
"SELECT " + geographyFieldSequence + " WHERE Name ='" + geographyName.Replace ("'", "''") + "'",
connection);
using (DbDataReader reader = command.ExecuteReader())
+1 -1
View File
@@ -228,7 +228,7 @@ namespace Swarmops.Logic.Cache
Dictionary<int, List<BasicGeography>> hashedGeographies = GetHashedGeographies();
foreach (int entry in hashedGeographies.Keys)
{
if (hashedGeographies[entry][0].Name.ToLower().Trim().StartsWith (cmpName))
if (hashedGeographies[entry][0].Name.ToLower().Trim() == cmpName)
return hashedGeographies[entry][0];
}
//TODO: This can miss due to that the geography was added after last cache reload