aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs')
-rw-r--r--OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs146
1 files changed, 73 insertions, 73 deletions
diff --git a/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs b/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs
index 2b20a79..b718fe4 100644
--- a/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs
+++ b/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs
@@ -1,73 +1,73 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using TribalMedia.Framework.Data; 5using TribalMedia.Framework.Data;
6 6
7namespace OpenSim.Framework.Data 7namespace OpenSim.Framework.Data
8{ 8{
9 public class OpenSimObjectFieldMapper<TObject, TField> : ObjectField<TObject, TField> 9 public class OpenSimObjectFieldMapper<TObject, TField> : ObjectField<TObject, TField>
10 { 10 {
11 public OpenSimObjectFieldMapper(TableMapper tableMapper, string fieldName, 11 public OpenSimObjectFieldMapper(TableMapper tableMapper, string fieldName,
12 ObjectGetAccessor<TObject, TField> rowMapperGetAccessor, 12 ObjectGetAccessor<TObject, TField> rowMapperGetAccessor,
13 ObjectSetAccessor<TObject, TField> rowMapperSetAccessor) 13 ObjectSetAccessor<TObject, TField> rowMapperSetAccessor)
14 : base(tableMapper, fieldName, rowMapperGetAccessor, rowMapperSetAccessor) 14 : base(tableMapper, fieldName, rowMapperGetAccessor, rowMapperSetAccessor)
15 { 15 {
16 } 16 }
17 17
18 public override void ExpandField<TObj>(TObj obj, System.Data.Common.DbCommand command, List<string> fieldNames) 18 public override void ExpandField<TObj>(TObj obj, System.Data.Common.DbCommand command, List<string> fieldNames)
19 { 19 {
20 string fieldName = FieldName; 20 string fieldName = FieldName;
21 object value = GetParamValue(obj); 21 object value = GetParamValue(obj);
22 22
23 if (ValueType == typeof(LLVector3)) 23 if (ValueType == typeof(LLVector3))
24 { 24 {
25 LLVector3 vector = (LLVector3)value; 25 LLVector3 vector = (LLVector3)value;
26 26
27 RawAddParam(command, fieldNames, fieldName + "X", vector.X); 27 RawAddParam(command, fieldNames, fieldName + "X", vector.X);
28 RawAddParam(command, fieldNames, fieldName + "Y", vector.Y); 28 RawAddParam(command, fieldNames, fieldName + "Y", vector.Y);
29 RawAddParam(command, fieldNames, fieldName + "Z", vector.Z); 29 RawAddParam(command, fieldNames, fieldName + "Z", vector.Z);
30 } 30 }
31 else if (ValueType == typeof(LLQuaternion)) 31 else if (ValueType == typeof(LLQuaternion))
32 { 32 {
33 LLQuaternion quaternion = (LLQuaternion)value; 33 LLQuaternion quaternion = (LLQuaternion)value;
34 34
35 RawAddParam(command, fieldNames, fieldName + "X", quaternion.X); 35 RawAddParam(command, fieldNames, fieldName + "X", quaternion.X);
36 RawAddParam(command, fieldNames, fieldName + "Y", quaternion.Y); 36 RawAddParam(command, fieldNames, fieldName + "Y", quaternion.Y);
37 RawAddParam(command, fieldNames, fieldName + "Z", quaternion.Z); 37 RawAddParam(command, fieldNames, fieldName + "Z", quaternion.Z);
38 RawAddParam(command, fieldNames, fieldName + "W", quaternion.W); 38 RawAddParam(command, fieldNames, fieldName + "W", quaternion.W);
39 } 39 }
40 else 40 else
41 { 41 {
42 base.ExpandField<TObj>(obj, command, fieldNames); 42 base.ExpandField<TObj>(obj, command, fieldNames);
43 } 43 }
44 } 44 }
45 45
46 protected override object GetValue(DataReader reader) 46 protected override object GetValue(DataReader reader)
47 { 47 {
48 object value; 48 object value;
49 49
50 OpenSimDataReader osreader = (OpenSimDataReader) reader; 50 OpenSimDataReader osreader = (OpenSimDataReader) reader;
51 51
52 if (ValueType == typeof(LLVector3)) 52 if (ValueType == typeof(LLVector3))
53 { 53 {
54 value = osreader.GetVector(FieldName); 54 value = osreader.GetVector(FieldName);
55 } 55 }
56 else if (ValueType == typeof(LLQuaternion)) 56 else if (ValueType == typeof(LLQuaternion))
57 { 57 {
58 value = osreader.GetQuaternion(FieldName); 58 value = osreader.GetQuaternion(FieldName);
59 } 59 }
60 else if (ValueType == typeof(LLUUID)) 60 else if (ValueType == typeof(LLUUID))
61 { 61 {
62 Guid guid = reader.GetGuid(FieldName); 62 Guid guid = reader.GetGuid(FieldName);
63 value = new LLUUID(guid); 63 value = new LLUUID(guid);
64 } 64 }
65 else 65 else
66 { 66 {
67 value = base.GetValue(reader); 67 value = base.GetValue(reader);
68 } 68 }
69 69
70 return value; 70 return value;
71 } 71 }
72 } 72 }
73} 73}