diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 23 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 35 |
3 files changed, 42 insertions, 22 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index 8d82f61..664ce84 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |||
@@ -79,14 +79,7 @@ namespace OpenSim.Data.MySQL | |||
79 | { | 79 | { |
80 | ret.PrincipalID = principalID; | 80 | ret.PrincipalID = principalID; |
81 | 81 | ||
82 | if (m_ColumnNames == null) | 82 | CheckColumnNames(result); |
83 | { | ||
84 | m_ColumnNames = new List<string>(); | ||
85 | |||
86 | DataTable schemaTable = result.GetSchemaTable(); | ||
87 | foreach (DataRow row in schemaTable.Rows) | ||
88 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
89 | } | ||
90 | 83 | ||
91 | foreach (string s in m_ColumnNames) | 84 | foreach (string s in m_ColumnNames) |
92 | { | 85 | { |
@@ -105,6 +98,20 @@ namespace OpenSim.Data.MySQL | |||
105 | } | 98 | } |
106 | } | 99 | } |
107 | 100 | ||
101 | private void CheckColumnNames(IDataReader result) | ||
102 | { | ||
103 | if (m_ColumnNames != null) | ||
104 | return; | ||
105 | |||
106 | List<string> columnNames = new List<string>(); | ||
107 | |||
108 | DataTable schemaTable = result.GetSchemaTable(); | ||
109 | foreach (DataRow row in schemaTable.Rows) | ||
110 | columnNames.Add(row["ColumnName"].ToString()); | ||
111 | |||
112 | m_ColumnNames = columnNames; | ||
113 | } | ||
114 | |||
108 | public bool Store(AuthenticationData data) | 115 | public bool Store(AuthenticationData data) |
109 | { | 116 | { |
110 | if (data.Data.ContainsKey("UUID")) | 117 | if (data.Data.ContainsKey("UUID")) |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 786b955..86367a1 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -91,15 +91,17 @@ namespace OpenSim.Data.MySQL | |||
91 | if (m_ColumnNames != null) | 91 | if (m_ColumnNames != null) |
92 | return; | 92 | return; |
93 | 93 | ||
94 | m_ColumnNames = new List<string>(); | 94 | List<string> columnNames = new List<string>(); |
95 | 95 | ||
96 | DataTable schemaTable = reader.GetSchemaTable(); | 96 | DataTable schemaTable = reader.GetSchemaTable(); |
97 | foreach (DataRow row in schemaTable.Rows) | 97 | foreach (DataRow row in schemaTable.Rows) |
98 | { | 98 | { |
99 | if (row["ColumnName"] != null && | 99 | if (row["ColumnName"] != null && |
100 | (!m_Fields.ContainsKey(row["ColumnName"].ToString()))) | 100 | (!m_Fields.ContainsKey(row["ColumnName"].ToString()))) |
101 | m_ColumnNames.Add(row["ColumnName"].ToString()); | 101 | columnNames.Add(row["ColumnName"].ToString()); |
102 | } | 102 | } |
103 | |||
104 | m_ColumnNames = columnNames; | ||
103 | } | 105 | } |
104 | 106 | ||
105 | public virtual T[] Get(string field, string key) | 107 | public virtual T[] Get(string field, string key) |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index c20c392..d1f1932 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -162,17 +162,7 @@ namespace OpenSim.Data.MySQL | |||
162 | ret.sizeX = Convert.ToInt32(result["sizeX"]); | 162 | ret.sizeX = Convert.ToInt32(result["sizeX"]); |
163 | ret.sizeY = Convert.ToInt32(result["sizeY"]); | 163 | ret.sizeY = Convert.ToInt32(result["sizeY"]); |
164 | 164 | ||
165 | if (m_ColumnNames == null) | 165 | CheckColumnNames(result); |
166 | { | ||
167 | m_ColumnNames = new List<string>(); | ||
168 | |||
169 | DataTable schemaTable = result.GetSchemaTable(); | ||
170 | foreach (DataRow row in schemaTable.Rows) | ||
171 | { | ||
172 | if (row["ColumnName"] != null) | ||
173 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
174 | } | ||
175 | } | ||
176 | 166 | ||
177 | foreach (string s in m_ColumnNames) | 167 | foreach (string s in m_ColumnNames) |
178 | { | 168 | { |
@@ -187,7 +177,11 @@ namespace OpenSim.Data.MySQL | |||
187 | if (s == "locY") | 177 | if (s == "locY") |
188 | continue; | 178 | continue; |
189 | 179 | ||
190 | ret.Data[s] = result[s].ToString(); | 180 | object value = result[s]; |
181 | if (value is DBNull) | ||
182 | ret.Data[s] = null; | ||
183 | else | ||
184 | ret.Data[s] = result[s].ToString(); | ||
191 | } | 185 | } |
192 | 186 | ||
193 | retList.Add(ret); | 187 | retList.Add(ret); |
@@ -198,6 +192,23 @@ namespace OpenSim.Data.MySQL | |||
198 | return retList; | 192 | return retList; |
199 | } | 193 | } |
200 | 194 | ||
195 | private void CheckColumnNames(IDataReader result) | ||
196 | { | ||
197 | if (m_ColumnNames != null) | ||
198 | return; | ||
199 | |||
200 | List<string> columnNames = new List<string>(); | ||
201 | |||
202 | DataTable schemaTable = result.GetSchemaTable(); | ||
203 | foreach (DataRow row in schemaTable.Rows) | ||
204 | { | ||
205 | if (row["ColumnName"] != null) | ||
206 | columnNames.Add(row["ColumnName"].ToString()); | ||
207 | } | ||
208 | |||
209 | m_ColumnNames = columnNames; | ||
210 | } | ||
211 | |||
201 | public bool Store(RegionData data) | 212 | public bool Store(RegionData data) |
202 | { | 213 | { |
203 | if (data.Data.ContainsKey("uuid")) | 214 | if (data.Data.ContainsKey("uuid")) |