Fix for geo lookup: need exact match
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user