From ab92dff5be6bd9c6a632b9128f970b4793446bb2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 26 Aug 2019 03:00:28 +0100 Subject: a few changes to db generic tables --- OpenSim/Data/Null/NullGenericDataHandler.cs | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'OpenSim/Data/Null') diff --git a/OpenSim/Data/Null/NullGenericDataHandler.cs b/OpenSim/Data/Null/NullGenericDataHandler.cs index dd9d190..0b6e49b 100644 --- a/OpenSim/Data/Null/NullGenericDataHandler.cs +++ b/OpenSim/Data/Null/NullGenericDataHandler.cs @@ -42,6 +42,47 @@ namespace OpenSim.Data.Null /// public class NullGenericDataHandler { + protected List Get(string field, string val, List inputEntities) + { + List entities = inputEntities; + + entities + = entities.Where( + e => + { + FieldInfo fi = typeof(T).GetField(field); + if (fi == null) + throw new NotImplementedException(string.Format("No field {0} for val {1}", field, val)); + + return fi.GetValue(e).ToString() == val; + } + ).ToList(); + + return entities; + } + + protected List Get(string field, string[] vals, List inputEntities) + { + List entities = new List(); + + for (int i = 0; i < vals.Length; i++) + { + entities.AddRange (inputEntities.Where( + e => + { + FieldInfo fi = typeof(T).GetField(field); + if (fi == null) + throw new NotImplementedException(string.Format("No field {0} for val {1}", field, vals[i])); + + return fi.GetValue(e).ToString() == vals[i]; + } + ).ToList() + ); + } + return entities; + } + + protected List Get(string[] fields, string[] vals, List inputEntities) { List entities = inputEntities; -- cgit v1.1