aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Data.Base/BaseDataReader.cs33
-rw-r--r--OpenSim/Framework/Data.Base/BaseFieldMapper.cs4
-rw-r--r--OpenSim/Framework/Data.MSSQLMapper/MSSQLDatabaseMapper.cs13
-rw-r--r--OpenSim/Framework/Data.MySQLMapper/MySQLDataReader.cs15
-rw-r--r--OpenSim/Framework/Data.MySQLMapper/MySQLDatabaseMapper.cs7
-rw-r--r--OpenSim/Framework/Data/OpenSimDataReader.cs3
6 files changed, 61 insertions, 14 deletions
diff --git a/OpenSim/Framework/Data.Base/BaseDataReader.cs b/OpenSim/Framework/Data.Base/BaseDataReader.cs
index cbaac55..3baefcd 100644
--- a/OpenSim/Framework/Data.Base/BaseDataReader.cs
+++ b/OpenSim/Framework/Data.Base/BaseDataReader.cs
@@ -31,7 +31,7 @@ using System.IO;
31 31
32namespace OpenSim.Framework.Data.Base 32namespace OpenSim.Framework.Data.Base
33{ 33{
34 public class BaseDataReader 34 public abstract class BaseDataReader
35 { 35 {
36 private readonly IDataReader m_source; 36 private readonly IDataReader m_source;
37 37
@@ -112,17 +112,28 @@ namespace OpenSim.Framework.Data.Base
112 return m_source.Read(); 112 return m_source.Read();
113 } 113 }
114 114
115 public Guid GetGuid(string name) 115 public virtual Guid GetGuid(string name)
116 { 116 {
117 string guidString = GetString(name); 117 return m_source.GetGuid(m_source.GetOrdinal(name));
118 if (String.IsNullOrEmpty(guidString)) 118 }
119 { 119
120 return Guid.Empty; 120 public UInt32 GetUInt32(string name )
121 } 121 {
122 else 122 return (UInt32)GetInt32(name);
123 { 123 }
124 return new Guid(guidString); 124
125 } 125 private Int32 GetInt32(string name)
126 {
127 int ordinal = m_source.GetOrdinal(name);
128 int int32 = m_source.GetInt32(ordinal);
129 return int32;
130 }
131
132 public Int64 GetInt64(string name)
133 {
134 int ordinal = m_source.GetOrdinal( name );
135 long int64 = m_source.GetInt64(ordinal);
136 return int64;
126 } 137 }
127 } 138 }
128} 139}
diff --git a/OpenSim/Framework/Data.Base/BaseFieldMapper.cs b/OpenSim/Framework/Data.Base/BaseFieldMapper.cs
index ade9266..03c7bfb 100644
--- a/OpenSim/Framework/Data.Base/BaseFieldMapper.cs
+++ b/OpenSim/Framework/Data.Base/BaseFieldMapper.cs
@@ -108,6 +108,10 @@ namespace OpenSim.Framework.Data.Base
108 { 108 {
109 value = reader.GetUShort(m_fieldName); 109 value = reader.GetUShort(m_fieldName);
110 } 110 }
111 else if (ValueType == typeof(uint))
112 {
113 value = reader.GetUInt32(m_fieldName);
114 }
111 else if (ValueType == typeof(byte[])) 115 else if (ValueType == typeof(byte[]))
112 { 116 {
113 value = reader.GetBytes(m_fieldName); 117 value = reader.GetBytes(m_fieldName);
diff --git a/OpenSim/Framework/Data.MSSQLMapper/MSSQLDatabaseMapper.cs b/OpenSim/Framework/Data.MSSQLMapper/MSSQLDatabaseMapper.cs
index c56b5a6..81f9631 100644
--- a/OpenSim/Framework/Data.MSSQLMapper/MSSQLDatabaseMapper.cs
+++ b/OpenSim/Framework/Data.MSSQLMapper/MSSQLDatabaseMapper.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Data.Common; 29using System.Data.Common;
29using System.Data.SqlClient; 30using System.Data.SqlClient;
30using OpenSim.Framework.Data; 31using OpenSim.Framework.Data;
@@ -44,6 +45,18 @@ namespace OpenSim.Framework.Data.MSSQLMapper
44 return connection; 45 return connection;
45 } 46 }
46 47
48 public override object ConvertToDbType(object value)
49 {
50 if( value is UInt32 )
51 {
52 UInt32 tmpVal = (UInt32) value;
53 Int64 result = Convert.ToInt64(tmpVal);
54 return result;
55 }
56
57 return base.ConvertToDbType(value);
58 }
59
47 public override string CreateParamName(string fieldName) 60 public override string CreateParamName(string fieldName)
48 { 61 {
49 return "@" + fieldName; 62 return "@" + fieldName;
diff --git a/OpenSim/Framework/Data.MySQLMapper/MySQLDataReader.cs b/OpenSim/Framework/Data.MySQLMapper/MySQLDataReader.cs
new file mode 100644
index 0000000..9fd50f6
--- /dev/null
+++ b/OpenSim/Framework/Data.MySQLMapper/MySQLDataReader.cs
@@ -0,0 +1,15 @@
1using System;
2using System.Collections.Generic;
3using System.Data;
4using System.Text;
5using OpenSim.Framework.Data.Base;
6
7namespace OpenSim.Framework.Data.MySQLMapper
8{
9 public class MySQLDataReader : OpenSimDataReader
10 {
11 public MySQLDataReader(IDataReader source) : base(source)
12 {
13 }
14 }
15}
diff --git a/OpenSim/Framework/Data.MySQLMapper/MySQLDatabaseMapper.cs b/OpenSim/Framework/Data.MySQLMapper/MySQLDatabaseMapper.cs
index ae58f00..3f5b18f 100644
--- a/OpenSim/Framework/Data.MySQLMapper/MySQLDatabaseMapper.cs
+++ b/OpenSim/Framework/Data.MySQLMapper/MySQLDatabaseMapper.cs
@@ -25,9 +25,11 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Data;
28using System.Data.Common; 29using System.Data.Common;
29using MySql.Data.MySqlClient; 30using MySql.Data.MySqlClient;
30using OpenSim.Framework.Data; 31using OpenSim.Framework.Data;
32using OpenSim.Framework.Data.Base;
31 33
32namespace OpenSim.Framework.Data.MySQLMapper 34namespace OpenSim.Framework.Data.MySQLMapper
33{ 35{
@@ -48,5 +50,10 @@ namespace OpenSim.Framework.Data.MySQLMapper
48 { 50 {
49 return "?" + fieldName; 51 return "?" + fieldName;
50 } 52 }
53
54 public override BaseDataReader CreateReader(IDataReader reader)
55 {
56 return new MySQLDataReader( reader );
57 }
51 } 58 }
52} \ No newline at end of file 59} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/OpenSimDataReader.cs b/OpenSim/Framework/Data/OpenSimDataReader.cs
index 08a1405..538af8f 100644
--- a/OpenSim/Framework/Data/OpenSimDataReader.cs
+++ b/OpenSim/Framework/Data/OpenSimDataReader.cs
@@ -26,11 +26,8 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
30using System.Data; 29using System.Data;
31using System.Text;
32using libsecondlife; 30using libsecondlife;
33
34using OpenSim.Framework.Data.Base; 31using OpenSim.Framework.Data.Base;
35 32
36namespace OpenSim.Framework.Data 33namespace OpenSim.Framework.Data