From 930b2ec602488f1f05e80cb32d6168e071802d7b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 2 Sep 2008 13:43:49 +0000 Subject: Mantis #2102 Thank you, RuudL, for a patch that supplements the previous MSSQL patch. --- OpenSim/Data/MSSQL/MSSQLEstateData.cs | 15 ++++++++------- OpenSim/Data/MSSQL/MSSQLRegionData.cs | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim') 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 } else { - _FieldMap[name].SetValue(es, reader[name]); + es.EstateID = Convert.ToUInt32(reader["EstateID"].ToString()); + //Problems converting a Int32 to a UInt32 + //_FieldMap[name].SetValue(es, reader["EstateID"]); } } } @@ -188,7 +190,6 @@ namespace OpenSim.Data.MSSQL } } - SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int); idParameter.Direction = ParameterDirection.Output; insertCommand.Parameters.Add(idParameter); @@ -199,16 +200,16 @@ namespace OpenSim.Data.MSSQL } } - using (AutoClosingSqlCommand cmd = _Database.Query("insert into estate_map values (@RegionID, @EstateID)")) + using (AutoClosingSqlCommand cmd = _Database.Query("INSERT INTO [estate_map] ([RegionID] ,[EstateID]) VALUES (@RegionID, @EstateID)")) { - cmd.Parameters.AddWithValue("@RegionID", regionID.ToString()); - cmd.Parameters.AddWithValue("@EstateID", es.EstateID); + cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID.ToString())); + cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID)); // This will throw on dupe key try { cmd.ExecuteNonQuery(); } - catch (Exception) + catch (Exception Ex) { _Log.Debug("[ESTATE DB]: Error inserting regionID and EstateID in estate_map"); } @@ -220,7 +221,7 @@ namespace OpenSim.Data.MSSQL sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID); using (AutoClosingSqlCommand cmd = _Database.Query(sql)) { - cmd.Parameters.AddWithValue("@UUID", regionID); + cmd.Parameters.Add(_Database.CreateParameter("@UUID", regionID)); try { 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 RegionSettings regionSettings; using (AutoClosingSqlCommand cmd = _Database.Query(sql)) { - cmd.Parameters.AddWithValue("@regionUUID", regionUUID.ToString()); + cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID.ToString())); using(SqlDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) @@ -678,6 +678,7 @@ VALUES string regionUUID = null; using (AutoClosingSqlCommand cmd = _Database.Query("SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID")) { + cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID)); regionUUID = cmd.ExecuteScalar().ToString(); } -- cgit v1.1