Higher-level GeographyUpdates added

This commit is contained in:
Rick Falkvinge
2014-12-22 15:54:10 +01:00
parent dd1896140c
commit 4792cc9f5a
5 changed files with 113 additions and 2 deletions
+28
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Globalization;
using Swarmops.Basic.Enums;
using Swarmops.Basic.Types;
using Swarmops.Basic.Types.Structure;
@@ -42,6 +43,33 @@ namespace Swarmops.Database
#endregion
public BasicGeographyUpdate GetGeographyUpdate(int identity)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
GetDbCommand(
"SELECT " + geographyUpdateFieldSequence + " WHERE GeographyUpdateId=" + identity.ToString(CultureInfo.InvariantCulture), connection);
using (DbDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
return ReadGeographyUpdateFromDataReader(reader);
}
throw new ArgumentException ("No such GeographyUpdate: " +
identity.ToString (CultureInfo.InvariantCulture));
}
}
}
public BasicGeographyUpdate[] GetAllGeographyUpdates()
{
List<BasicGeographyUpdate> result = new List<BasicGeographyUpdate>();