diff options
author | Melanie Thielker | 2008-09-02 13:43:49 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-02 13:43:49 +0000 |
commit | 930b2ec602488f1f05e80cb32d6168e071802d7b (patch) | |
tree | 7bdc5eaf4d02ce11dd1c613a598dbc4fc3202bb9 /OpenSim/Data/MSSQL | |
parent | Fix and reactivate the unit tests on the XEngine (diff) | |
download | opensim-SC-930b2ec602488f1f05e80cb32d6168e071802d7b.zip opensim-SC-930b2ec602488f1f05e80cb32d6168e071802d7b.tar.gz opensim-SC-930b2ec602488f1f05e80cb32d6168e071802d7b.tar.bz2 opensim-SC-930b2ec602488f1f05e80cb32d6168e071802d7b.tar.xz |
Mantis #2102
Thank you, RuudL, for a patch that supplements the previous MSSQL
patch.
Diffstat (limited to 'OpenSim/Data/MSSQL')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLEstateData.cs | 15 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLRegionData.cs | 3 |
2 files changed, 10 insertions, 8 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index ca4691c..324d3b3 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs | |||
@@ -137,7 +137,9 @@ namespace OpenSim.Data.MSSQL | |||
137 | } | 137 | } |
138 | else | 138 | else |
139 | { | 139 | { |
140 | _FieldMap[name].SetValue(es, reader[name]); | 140 | es.EstateID = Convert.ToUInt32(reader["EstateID"].ToString()); |
141 | //Problems converting a Int32 to a UInt32 | ||
142 | //_FieldMap[name].SetValue(es, reader["EstateID"]); | ||
141 | } | 143 | } |
142 | } | 144 | } |
143 | } | 145 | } |
@@ -188,7 +190,6 @@ namespace OpenSim.Data.MSSQL | |||
188 | } | 190 | } |
189 | } | 191 | } |
190 | 192 | ||
191 | |||
192 | SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int); | 193 | SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int); |
193 | idParameter.Direction = ParameterDirection.Output; | 194 | idParameter.Direction = ParameterDirection.Output; |
194 | insertCommand.Parameters.Add(idParameter); | 195 | insertCommand.Parameters.Add(idParameter); |
@@ -199,16 +200,16 @@ namespace OpenSim.Data.MSSQL | |||
199 | } | 200 | } |
200 | } | 201 | } |
201 | 202 | ||
202 | using (AutoClosingSqlCommand cmd = _Database.Query("insert into estate_map values (@RegionID, @EstateID)")) | 203 | using (AutoClosingSqlCommand cmd = _Database.Query("INSERT INTO [estate_map] ([RegionID] ,[EstateID]) VALUES (@RegionID, @EstateID)")) |
203 | { | 204 | { |
204 | cmd.Parameters.AddWithValue("@RegionID", regionID.ToString()); | 205 | cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID.ToString())); |
205 | cmd.Parameters.AddWithValue("@EstateID", es.EstateID); | 206 | cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID)); |
206 | // This will throw on dupe key | 207 | // This will throw on dupe key |
207 | try | 208 | try |
208 | { | 209 | { |
209 | cmd.ExecuteNonQuery(); | 210 | cmd.ExecuteNonQuery(); |
210 | } | 211 | } |
211 | catch (Exception) | 212 | catch (Exception Ex) |
212 | { | 213 | { |
213 | _Log.Debug("[ESTATE DB]: Error inserting regionID and EstateID in estate_map"); | 214 | _Log.Debug("[ESTATE DB]: Error inserting regionID and EstateID in estate_map"); |
214 | } | 215 | } |
@@ -220,7 +221,7 @@ namespace OpenSim.Data.MSSQL | |||
220 | sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID); | 221 | sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID); |
221 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 222 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) |
222 | { | 223 | { |
223 | cmd.Parameters.AddWithValue("@UUID", regionID); | 224 | cmd.Parameters.Add(_Database.CreateParameter("@UUID", regionID)); |
224 | try | 225 | try |
225 | { | 226 | { |
226 | 227 | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 7af3e7e..e26b03d 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs | |||
@@ -644,7 +644,7 @@ VALUES | |||
644 | RegionSettings regionSettings; | 644 | RegionSettings regionSettings; |
645 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 645 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) |
646 | { | 646 | { |
647 | cmd.Parameters.AddWithValue("@regionUUID", regionUUID.ToString()); | 647 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID.ToString())); |
648 | using(SqlDataReader reader = cmd.ExecuteReader()) | 648 | using(SqlDataReader reader = cmd.ExecuteReader()) |
649 | { | 649 | { |
650 | if (reader.Read()) | 650 | if (reader.Read()) |
@@ -678,6 +678,7 @@ VALUES | |||
678 | string regionUUID = null; | 678 | string regionUUID = null; |
679 | using (AutoClosingSqlCommand cmd = _Database.Query("SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID")) | 679 | using (AutoClosingSqlCommand cmd = _Database.Query("SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID")) |
680 | { | 680 | { |
681 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID)); | ||
681 | regionUUID = cmd.ExecuteScalar().ToString(); | 682 | regionUUID = cmd.ExecuteScalar().ToString(); |
682 | } | 683 | } |
683 | 684 | ||