diff options
11 files changed, 322 insertions, 78 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDatabaseMapper.cs b/OpenSim/Framework/Data.MySQL/MySQLDatabaseMapper.cs new file mode 100644 index 0000000..1514f00 --- /dev/null +++ b/OpenSim/Framework/Data.MySQL/MySQLDatabaseMapper.cs | |||
@@ -0,0 +1,24 @@ | |||
1 | using System.Data.Common; | ||
2 | using MySql.Data.MySqlClient; | ||
3 | |||
4 | namespace OpenSim.Framework.Data.MySQL | ||
5 | { | ||
6 | public class MySQLDatabaseMapper : OpenSimDatabaseMapper | ||
7 | { | ||
8 | public MySQLDatabaseMapper(string connectionString) | ||
9 | : base(connectionString) | ||
10 | { | ||
11 | } | ||
12 | |||
13 | public override DbConnection GetNewConnection() | ||
14 | { | ||
15 | MySqlConnection connection = new MySqlConnection(m_connectionString); | ||
16 | return connection; | ||
17 | } | ||
18 | |||
19 | public override string CreateParamName(string fieldName) | ||
20 | { | ||
21 | return "?" + fieldName; | ||
22 | } | ||
23 | } | ||
24 | } | ||
diff --git a/OpenSim/Framework/Data/OpenSimDataReader.cs b/OpenSim/Framework/Data/OpenSimDataReader.cs new file mode 100644 index 0000000..225df60 --- /dev/null +++ b/OpenSim/Framework/Data/OpenSimDataReader.cs | |||
@@ -0,0 +1,39 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Data; | ||
4 | using System.Text; | ||
5 | using libsecondlife; | ||
6 | using TribalMedia.Framework.Data; | ||
7 | |||
8 | namespace OpenSim.Framework.Data | ||
9 | { | ||
10 | public class OpenSimDataReader : DataReader | ||
11 | { | ||
12 | public OpenSimDataReader(IDataReader source) : base(source) | ||
13 | { | ||
14 | } | ||
15 | |||
16 | public LLVector3 GetVector(string s) | ||
17 | { | ||
18 | float x = GetFloat(s + "X"); | ||
19 | float y = GetFloat(s + "Y"); | ||
20 | float z = GetFloat(s + "Z"); | ||
21 | |||
22 | LLVector3 vector = new LLVector3(x, y, z); | ||
23 | |||
24 | return vector; | ||
25 | } | ||
26 | |||
27 | public LLQuaternion GetQuaternion(string s) | ||
28 | { | ||
29 | float x = GetFloat(s + "X"); | ||
30 | float y = GetFloat(s + "Y"); | ||
31 | float z = GetFloat(s + "Z"); | ||
32 | float w = GetFloat(s + "W"); | ||
33 | |||
34 | LLQuaternion quaternion = new LLQuaternion(x, y, z, w); | ||
35 | |||
36 | return quaternion; | ||
37 | } | ||
38 | } | ||
39 | } | ||
diff --git a/OpenSim/Framework/Data/OpenSimDatabaseMapper.cs b/OpenSim/Framework/Data/OpenSimDatabaseMapper.cs new file mode 100644 index 0000000..2001110 --- /dev/null +++ b/OpenSim/Framework/Data/OpenSimDatabaseMapper.cs | |||
@@ -0,0 +1,23 @@ | |||
1 | using System.Data.Common; | ||
2 | using libsecondlife; | ||
3 | using TribalMedia.Framework.Data; | ||
4 | |||
5 | namespace OpenSim.Framework.Data | ||
6 | { | ||
7 | public abstract class OpenSimDatabaseMapper : DatabaseMapper | ||
8 | { | ||
9 | public OpenSimDatabaseMapper(string connectionString) : base(connectionString) | ||
10 | { | ||
11 | } | ||
12 | |||
13 | public override object ConvertToDbType(object value) | ||
14 | { | ||
15 | if (value is LLUUID) | ||
16 | { | ||
17 | return ((LLUUID) value).UUID.ToString(); | ||
18 | } | ||
19 | |||
20 | return base.ConvertToDbType(value); | ||
21 | } | ||
22 | } | ||
23 | } | ||
diff --git a/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs b/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs new file mode 100644 index 0000000..2b20a79 --- /dev/null +++ b/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs | |||
@@ -0,0 +1,73 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using TribalMedia.Framework.Data; | ||
6 | |||
7 | namespace OpenSim.Framework.Data | ||
8 | { | ||
9 | public class OpenSimObjectFieldMapper<TObject, TField> : ObjectField<TObject, TField> | ||
10 | { | ||
11 | public OpenSimObjectFieldMapper(TableMapper tableMapper, string fieldName, | ||
12 | ObjectGetAccessor<TObject, TField> rowMapperGetAccessor, | ||
13 | ObjectSetAccessor<TObject, TField> rowMapperSetAccessor) | ||
14 | : base(tableMapper, fieldName, rowMapperGetAccessor, rowMapperSetAccessor) | ||
15 | { | ||
16 | } | ||
17 | |||
18 | public override void ExpandField<TObj>(TObj obj, System.Data.Common.DbCommand command, List<string> fieldNames) | ||
19 | { | ||
20 | string fieldName = FieldName; | ||
21 | object value = GetParamValue(obj); | ||
22 | |||
23 | if (ValueType == typeof(LLVector3)) | ||
24 | { | ||
25 | LLVector3 vector = (LLVector3)value; | ||
26 | |||
27 | RawAddParam(command, fieldNames, fieldName + "X", vector.X); | ||
28 | RawAddParam(command, fieldNames, fieldName + "Y", vector.Y); | ||
29 | RawAddParam(command, fieldNames, fieldName + "Z", vector.Z); | ||
30 | } | ||
31 | else if (ValueType == typeof(LLQuaternion)) | ||
32 | { | ||
33 | LLQuaternion quaternion = (LLQuaternion)value; | ||
34 | |||
35 | RawAddParam(command, fieldNames, fieldName + "X", quaternion.X); | ||
36 | RawAddParam(command, fieldNames, fieldName + "Y", quaternion.Y); | ||
37 | RawAddParam(command, fieldNames, fieldName + "Z", quaternion.Z); | ||
38 | RawAddParam(command, fieldNames, fieldName + "W", quaternion.W); | ||
39 | } | ||
40 | else | ||
41 | { | ||
42 | base.ExpandField<TObj>(obj, command, fieldNames); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | protected override object GetValue(DataReader reader) | ||
47 | { | ||
48 | object value; | ||
49 | |||
50 | OpenSimDataReader osreader = (OpenSimDataReader) reader; | ||
51 | |||
52 | if (ValueType == typeof(LLVector3)) | ||
53 | { | ||
54 | value = osreader.GetVector(FieldName); | ||
55 | } | ||
56 | else if (ValueType == typeof(LLQuaternion)) | ||
57 | { | ||
58 | value = osreader.GetQuaternion(FieldName); | ||
59 | } | ||
60 | else if (ValueType == typeof(LLUUID)) | ||
61 | { | ||
62 | Guid guid = reader.GetGuid(FieldName); | ||
63 | value = new LLUUID(guid); | ||
64 | } | ||
65 | else | ||
66 | { | ||
67 | value = base.GetValue(reader); | ||
68 | } | ||
69 | |||
70 | return value; | ||
71 | } | ||
72 | } | ||
73 | } | ||
diff --git a/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs b/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs new file mode 100644 index 0000000..8026373 --- /dev/null +++ b/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs | |||
@@ -0,0 +1,143 @@ | |||
1 | using System; | ||
2 | using OpenSim.Framework; | ||
3 | using TribalMedia.Framework.Data; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Framework.Data | ||
7 | { | ||
8 | public class PrimitiveBaseShapeRowMapper : RowMapper<PrimitiveBaseShape> | ||
9 | { | ||
10 | public Guid SceneObjectPartId; | ||
11 | |||
12 | public PrimitiveBaseShapeRowMapper(Schema schema, PrimitiveBaseShape obj) : base(schema, obj) | ||
13 | { | ||
14 | } | ||
15 | } | ||
16 | |||
17 | public class PrimitiveBaseShapeTableMapper : ObjectTableMapper<PrimitiveBaseShapeRowMapper, Guid> | ||
18 | { | ||
19 | public PrimitiveBaseShapeTableMapper(DatabaseMapper connection, string tableName) | ||
20 | : base(connection, tableName) | ||
21 | { | ||
22 | RowMapperSchema<PrimitiveBaseShapeRowMapper> rowMapperSchema = new RowMapperSchema<PrimitiveBaseShapeRowMapper>(this); | ||
23 | m_schema = rowMapperSchema; | ||
24 | |||
25 | m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("SceneObjectPartId", | ||
26 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.SceneObjectPartId; }, | ||
27 | delegate(PrimitiveBaseShapeRowMapper shape, Guid value) { shape.SceneObjectPartId = value; }); | ||
28 | |||
29 | rowMapperSchema.AddMapping<byte>("PCode", | ||
30 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PCode; }, | ||
31 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PCode = value; }); | ||
32 | |||
33 | rowMapperSchema.AddMapping<ushort>("PathBegin", | ||
34 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathBegin; }, | ||
35 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathBegin = value; }); | ||
36 | |||
37 | rowMapperSchema.AddMapping<ushort>("PathEnd", | ||
38 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathEnd; }, | ||
39 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathEnd = value; }); | ||
40 | |||
41 | rowMapperSchema.AddMapping<byte>("PathScaleX", | ||
42 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleX; }, | ||
43 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleX = value; }); | ||
44 | |||
45 | rowMapperSchema.AddMapping<byte>("PathScaleY", | ||
46 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleY; }, | ||
47 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleY = value; }); | ||
48 | |||
49 | rowMapperSchema.AddMapping<byte>("PathShearX", | ||
50 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearX; }, | ||
51 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearX = value; }); | ||
52 | |||
53 | rowMapperSchema.AddMapping<byte>("PathShearY", | ||
54 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearY; }, | ||
55 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearY = value; }); | ||
56 | |||
57 | rowMapperSchema.AddMapping<ushort>("ProfileBegin", | ||
58 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileBegin; }, | ||
59 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileBegin = value; }); | ||
60 | |||
61 | rowMapperSchema.AddMapping<ushort>("ProfileEnd", | ||
62 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileEnd; }, | ||
63 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileEnd = value; }); | ||
64 | |||
65 | rowMapperSchema.AddMapping<LLVector3>("Scale", | ||
66 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.Scale; }, | ||
67 | delegate(PrimitiveBaseShapeRowMapper shape, LLVector3 value) { shape.Object.Scale = value; }); | ||
68 | |||
69 | rowMapperSchema.AddMapping<sbyte>("PathTaperX", | ||
70 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperX; }, | ||
71 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperX = value; }); | ||
72 | |||
73 | rowMapperSchema.AddMapping<sbyte>("PathTaperY", | ||
74 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperY; }, | ||
75 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperY = value; }); | ||
76 | |||
77 | rowMapperSchema.AddMapping<sbyte>("PathTwist", | ||
78 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwist; }, | ||
79 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwist = value; }); | ||
80 | |||
81 | rowMapperSchema.AddMapping<sbyte>("PathRadiusOffset", | ||
82 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRadiusOffset; }, | ||
83 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathRadiusOffset = value; }); | ||
84 | |||
85 | rowMapperSchema.AddMapping<byte>("PathRevolutions", | ||
86 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRevolutions; }, | ||
87 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathRevolutions = value; }); | ||
88 | |||
89 | rowMapperSchema.AddMapping<sbyte>("PathTwistBegin", | ||
90 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwistBegin; }, | ||
91 | delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwistBegin = value; }); | ||
92 | |||
93 | rowMapperSchema.AddMapping<byte>("PathCurve", | ||
94 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathCurve; }, | ||
95 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathCurve = value; }); | ||
96 | |||
97 | rowMapperSchema.AddMapping<byte>("ProfileCurve", | ||
98 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileCurve; }, | ||
99 | delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.ProfileCurve = value; }); | ||
100 | |||
101 | rowMapperSchema.AddMapping<ushort>("ProfileHollow", | ||
102 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileHollow; }, | ||
103 | delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileHollow = value; }); | ||
104 | |||
105 | rowMapperSchema.AddMapping<byte[]>("TextureEntry", | ||
106 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.TextureEntry; }, | ||
107 | delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.TextureEntry = value; }); | ||
108 | |||
109 | rowMapperSchema.AddMapping<byte[]>("ExtraParams", | ||
110 | delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ExtraParams; }, | ||
111 | delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.ExtraParams = value; }); | ||
112 | } | ||
113 | |||
114 | public override PrimitiveBaseShapeRowMapper FromReader(DataReader reader) | ||
115 | { | ||
116 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); | ||
117 | |||
118 | PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper(m_schema, shape); | ||
119 | mapper.FillObject( reader ); | ||
120 | |||
121 | return mapper; | ||
122 | } | ||
123 | |||
124 | public bool Update(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape) | ||
125 | { | ||
126 | PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape); | ||
127 | return Update(sceneObjectPartId, mapper); | ||
128 | } | ||
129 | |||
130 | public bool Add(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape) | ||
131 | { | ||
132 | PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape); | ||
133 | return Add(mapper); | ||
134 | } | ||
135 | |||
136 | private PrimitiveBaseShapeRowMapper CreateRowMapper(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape) | ||
137 | { | ||
138 | PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper( m_schema, primitiveBaseShape ); | ||
139 | mapper.SceneObjectPartId = sceneObjectPartId; | ||
140 | return mapper; | ||
141 | } | ||
142 | } | ||
143 | } \ No newline at end of file | ||
diff --git a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/DataReader.cs b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/DataReader.cs index 6f84d43..4792e9e 100644 --- a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/DataReader.cs +++ b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/DataReader.cs | |||
@@ -61,29 +61,6 @@ namespace TribalMedia.Framework.Data | |||
61 | return (sbyte) m_source.GetInt16(m_source.GetOrdinal(name)); | 61 | return (sbyte) m_source.GetInt16(m_source.GetOrdinal(name)); |
62 | } | 62 | } |
63 | 63 | ||
64 | //public Vector3 GetVector(string s) | ||
65 | //{ | ||
66 | // float x = GetFloat(s + "X"); | ||
67 | // float y = GetFloat(s + "Y"); | ||
68 | // float z = GetFloat(s + "Z"); | ||
69 | |||
70 | // Vector3 vector = new Vector3(x, y, z); | ||
71 | |||
72 | // return vector; | ||
73 | //} | ||
74 | |||
75 | //public Quaternion GetQuaternion(string s) | ||
76 | //{ | ||
77 | // float x = GetFloat(s + "X"); | ||
78 | // float y = GetFloat(s + "Y"); | ||
79 | // float z = GetFloat(s + "Z"); | ||
80 | // float w = GetFloat(s + "W"); | ||
81 | |||
82 | // Quaternion quaternion = new Quaternion(x, y, z, w); | ||
83 | |||
84 | // return quaternion; | ||
85 | //} | ||
86 | |||
87 | public float GetFloat(string name) | 64 | public float GetFloat(string name) |
88 | { | 65 | { |
89 | return m_source.GetFloat(m_source.GetOrdinal(name)); | 66 | return m_source.GetFloat(m_source.GetOrdinal(name)); |
@@ -134,7 +111,7 @@ namespace TribalMedia.Framework.Data | |||
134 | return m_source.Read(); | 111 | return m_source.Read(); |
135 | } | 112 | } |
136 | 113 | ||
137 | internal Guid GetGuid(string name) | 114 | public Guid GetGuid(string name) |
138 | { | 115 | { |
139 | string guidString = GetString(name); | 116 | string guidString = GetString(name); |
140 | if (String.IsNullOrEmpty(guidString)) | 117 | if (String.IsNullOrEmpty(guidString)) |
diff --git a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/DatabaseMapper.cs b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/DatabaseMapper.cs index 0b9d16d..63e59aa 100644 --- a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/DatabaseMapper.cs +++ b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/DatabaseMapper.cs | |||
@@ -41,7 +41,6 @@ namespace TribalMedia.Framework.Data | |||
41 | } | 41 | } |
42 | 42 | ||
43 | public abstract DbConnection GetNewConnection(); | 43 | public abstract DbConnection GetNewConnection(); |
44 | |||
45 | public abstract string CreateParamName(string fieldName); | 44 | public abstract string CreateParamName(string fieldName); |
46 | 45 | ||
47 | public DbCommand CreateSelectCommand(TableMapper mapper, DbConnection connection, string fieldName, object key) | 46 | public DbCommand CreateSelectCommand(TableMapper mapper, DbConnection connection, string fieldName, object key) |
@@ -67,7 +66,7 @@ namespace TribalMedia.Framework.Data | |||
67 | 66 | ||
68 | DbParameter param = command.CreateParameter(); | 67 | DbParameter param = command.CreateParameter(); |
69 | param.ParameterName = keyFieldParamName; | 68 | param.ParameterName = keyFieldParamName; |
70 | param.Value = FieldMapper.ConvertToDbType(key); | 69 | param.Value = ConvertToDbType(key); |
71 | command.Parameters.Add(param); | 70 | command.Parameters.Add(param); |
72 | 71 | ||
73 | return String.Format("{0}={1}", fieldName, keyFieldParamName); | 72 | return String.Format("{0}={1}", fieldName, keyFieldParamName); |
@@ -131,5 +130,10 @@ namespace TribalMedia.Framework.Data | |||
131 | 130 | ||
132 | return command; | 131 | return command; |
133 | } | 132 | } |
133 | |||
134 | public virtual object ConvertToDbType(object value) | ||
135 | { | ||
136 | return value; | ||
137 | } | ||
134 | } | 138 | } |
135 | } \ No newline at end of file | 139 | } \ No newline at end of file |
diff --git a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/FieldMapper.cs b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/FieldMapper.cs index a1fafbe..89bc0f0 100644 --- a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/FieldMapper.cs +++ b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/FieldMapper.cs | |||
@@ -78,52 +78,18 @@ namespace TribalMedia.Framework.Data | |||
78 | command.Parameters.Add(param); | 78 | command.Parameters.Add(param); |
79 | } | 79 | } |
80 | 80 | ||
81 | public void ExpandField<TObj>(TObj obj, DbCommand command, List<string> fieldNames) | 81 | public virtual void ExpandField<TObj>(TObj obj, DbCommand command, List<string> fieldNames) |
82 | { | 82 | { |
83 | string fieldName = FieldName; | 83 | string fieldName = FieldName; |
84 | object value = GetParamValue(obj); | 84 | object value = GetParamValue(obj); |
85 | 85 | ||
86 | //if (ValueType == typeof (Vector3)) | 86 | RawAddParam(command, fieldNames, fieldName, m_tableMapper.ConvertToDbType(value)); |
87 | //{ | ||
88 | // Vector3 vector = (Vector3) value; | ||
89 | |||
90 | // RawAddParam(command, fieldNames, fieldName + "X", vector.X); | ||
91 | // RawAddParam(command, fieldNames, fieldName + "Y", vector.Y); | ||
92 | // RawAddParam(command, fieldNames, fieldName + "Z", vector.Z); | ||
93 | //} | ||
94 | //else if (ValueType == typeof (Quaternion)) | ||
95 | //{ | ||
96 | // Quaternion quaternion = (Quaternion) value; | ||
97 | |||
98 | // RawAddParam(command, fieldNames, fieldName + "X", quaternion.X); | ||
99 | // RawAddParam(command, fieldNames, fieldName + "Y", quaternion.Y); | ||
100 | // RawAddParam(command, fieldNames, fieldName + "Z", quaternion.Z); | ||
101 | // RawAddParam(command, fieldNames, fieldName + "W", quaternion.W); | ||
102 | //} | ||
103 | //else | ||
104 | //{ | ||
105 | RawAddParam(command, fieldNames, fieldName, ConvertToDbType(value)); | ||
106 | //} | ||
107 | } | 87 | } |
108 | 88 | ||
109 | protected object GetValue(DataReader reader) | 89 | protected virtual object GetValue(DataReader reader) |
110 | { | 90 | { |
111 | object value; | 91 | object value; |
112 | //if (ValueType == typeof (Vector3)) | 92 | |
113 | //{ | ||
114 | // value = reader.GetVector(m_fieldName); | ||
115 | //} | ||
116 | //else if (ValueType == typeof (Quaternion)) | ||
117 | //{ | ||
118 | // value = reader.GetQuaternion(m_fieldName); | ||
119 | //} | ||
120 | //else | ||
121 | //if (ValueType == typeof(UID)) | ||
122 | //{ | ||
123 | // Guid guid = reader.GetGuid(m_fieldName); | ||
124 | // value = new UID(guid); | ||
125 | //} | ||
126 | //else | ||
127 | if (ValueType == typeof(Guid)) | 93 | if (ValueType == typeof(Guid)) |
128 | { | 94 | { |
129 | value = reader.GetGuid(m_fieldName); | 95 | value = reader.GetGuid(m_fieldName); |
@@ -162,16 +128,6 @@ namespace TribalMedia.Framework.Data | |||
162 | 128 | ||
163 | return value; | 129 | return value; |
164 | } | 130 | } |
165 | |||
166 | public static object ConvertToDbType(object value) | ||
167 | { | ||
168 | //if (value is UID) | ||
169 | //{ | ||
170 | // return (value as UID).UUID.ToString(); | ||
171 | //} | ||
172 | |||
173 | return value; | ||
174 | } | ||
175 | } | 131 | } |
176 | 132 | ||
177 | public class RowMapperField<TRowMapper, TField> : FieldMapper | 133 | public class RowMapperField<TRowMapper, TField> : FieldMapper |
diff --git a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/ObjectTableMapper.cs b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/ObjectTableMapper.cs index 44a6542..818c530 100644 --- a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/ObjectTableMapper.cs +++ b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/ObjectTableMapper.cs | |||
@@ -25,10 +25,8 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | using System; | 27 | using System; |
28 | using System.Collections.Generic; | ||
29 | using System.Data; | 28 | using System.Data; |
30 | using System.Data.Common; | 29 | using System.Data.Common; |
31 | using TribalMedia.Framework.Data; | ||
32 | 30 | ||
33 | namespace TribalMedia.Framework.Data | 31 | namespace TribalMedia.Framework.Data |
34 | { | 32 | { |
diff --git a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/TableMapper.cs b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/TableMapper.cs index 15005f8..480a015 100644 --- a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/TableMapper.cs +++ b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/TableMapper.cs | |||
@@ -62,13 +62,13 @@ namespace TribalMedia.Framework.Data | |||
62 | get { return m_tableName; } | 62 | get { return m_tableName; } |
63 | } | 63 | } |
64 | 64 | ||
65 | private Schema m_schema; | 65 | protected Schema m_schema; |
66 | public Schema Schema | 66 | public Schema Schema |
67 | { | 67 | { |
68 | get { return m_schema; } | 68 | get { return m_schema; } |
69 | } | 69 | } |
70 | 70 | ||
71 | private FieldMapper m_keyFieldMapper; | 71 | protected FieldMapper m_keyFieldMapper; |
72 | public FieldMapper KeyFieldMapper | 72 | public FieldMapper KeyFieldMapper |
73 | { | 73 | { |
74 | get { return m_keyFieldMapper; } | 74 | get { return m_keyFieldMapper; } |
@@ -104,5 +104,10 @@ namespace TribalMedia.Framework.Data | |||
104 | { | 104 | { |
105 | return m_connectionPool.CreateUpdateCommand(this, connection, rowMapper, primaryKey); | 105 | return m_connectionPool.CreateUpdateCommand(this, connection, rowMapper, primaryKey); |
106 | } | 106 | } |
107 | |||
108 | public object ConvertToDbType(object value) | ||
109 | { | ||
110 | return m_connectionPool.ConvertToDbType(value); | ||
111 | } | ||
107 | } | 112 | } |
108 | } \ No newline at end of file | 113 | } \ No newline at end of file |
diff --git a/prebuild.xml b/prebuild.xml index 86a2791..9050074 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -118,6 +118,7 @@ | |||
118 | <Reference name="XMLRPC.dll"/> | 118 | <Reference name="XMLRPC.dll"/> |
119 | <Reference name="libsecondlife.dll"/> | 119 | <Reference name="libsecondlife.dll"/> |
120 | <Reference name="OpenSim.Framework"/> | 120 | <Reference name="OpenSim.Framework"/> |
121 | <Reference name="TribalMedia.Framework.Data"/> | ||
121 | <Files> | 122 | <Files> |
122 | <Match pattern="*.cs" recurse="true"/> | 123 | <Match pattern="*.cs" recurse="true"/> |
123 | </Files> | 124 | </Files> |
@@ -903,6 +904,7 @@ | |||
903 | <Reference name="System.Data"/> | 904 | <Reference name="System.Data"/> |
904 | <Reference name="OpenSim.Framework"/> | 905 | <Reference name="OpenSim.Framework"/> |
905 | <Reference name="OpenSim.Framework.Data"/> | 906 | <Reference name="OpenSim.Framework.Data"/> |
907 | <Reference name="TribalMedia.Framework.Data"/> | ||
906 | <Reference name="libsecondlife.dll"/> | 908 | <Reference name="libsecondlife.dll"/> |
907 | <Reference name="MySql.Data.dll"/> | 909 | <Reference name="MySql.Data.dll"/> |
908 | <Reference name="OpenSim.Framework.Console"/> | 910 | <Reference name="OpenSim.Framework.Console"/> |