Browse Source

a few issues with mysql dbs

UbitUmarov 6 months ago
parent
commit
d35b33b279

+ 1 - 5
OpenSim/Data/MySQL/MySQLAvatarData.cs

@@ -26,13 +26,9 @@
  */
 
 using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Reflection;
-using System.Threading;
+
 using log4net;
 using OpenMetaverse;
-using OpenSim.Framework;
 using MySql.Data.MySqlClient;
 
 namespace OpenSim.Data.MySQL

+ 4 - 5
OpenSim/Data/MySQL/MySQLEstateData.cs

@@ -46,8 +46,7 @@ namespace OpenSim.Data.MySQL
         private string m_connectionString;
 
         private FieldInfo[] m_Fields;
-        private Dictionary<string, FieldInfo> m_FieldMap =
-                new Dictionary<string, FieldInfo>();
+        private Dictionary<string, FieldInfo> m_FieldMap = new();
 
         protected virtual Assembly Assembly
         {
@@ -498,7 +497,7 @@ namespace OpenSim.Data.MySQL
                 using (MySqlCommand cmd = dbcon.CreateCommand())
                 {
                     cmd.CommandText = "select estateID from estate_settings where EstateOwner = ?EstateOwner";
-                    cmd.Parameters.AddWithValue("?EstateOwner", ownerID);
+                    cmd.Parameters.AddWithValue("?EstateOwner", ownerID.ToString());
 
                     using (IDataReader reader = cmd.ExecuteReader())
                     {
@@ -530,7 +529,7 @@ namespace OpenSim.Data.MySQL
                      {
                         cmd.Transaction = transaction;
                         cmd.CommandText = "delete from estate_map where RegionID = ?RegionID";
-                        cmd.Parameters.AddWithValue("?RegionID", regionID);
+                        cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
 
                         cmd.ExecuteNonQuery();
                     }
@@ -539,7 +538,7 @@ namespace OpenSim.Data.MySQL
                     {
                         cmd.Transaction = transaction;
                         cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)";
-                        cmd.Parameters.AddWithValue("?RegionID", regionID);
+                        cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
                         cmd.Parameters.AddWithValue("?EstateID", estateID);
 
                         int ret = cmd.ExecuteNonQuery();

+ 1 - 3
OpenSim/Data/MySQL/MySQLFramework.cs

@@ -40,9 +40,7 @@ namespace OpenSim.Data.MySQL
     /// </summary>
     public class MySqlFramework
     {
-        private static readonly log4net.ILog m_log =
-                log4net.LogManager.GetLogger(
-                System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+        private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 
         protected string m_connectionString = String.Empty;
         protected MySqlTransaction m_trans = null;

+ 0 - 4
OpenSim/Data/MySQL/MySQLFriendsData.cs

@@ -26,11 +26,7 @@
  */
 
 using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Data;
 using OpenMetaverse;
-using OpenSim.Framework;
 using MySql.Data.MySqlClient;
 
 namespace OpenSim.Data.MySQL

+ 1 - 1
OpenSim/Data/MySQL/MySQLInventoryData.cs

@@ -494,7 +494,7 @@ namespace OpenSim.Data.MySQL
                         result.Parameters.AddWithValue("?salePrice", item.SalePrice);
                         result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
                         result.Parameters.AddWithValue("?creationDate", item.CreationDate);
-                        result.Parameters.AddWithValue("?groupID", item.GroupID);
+                        result.Parameters.AddWithValue("?groupID", item.GroupID.ToString());
                         result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
                         result.Parameters.AddWithValue("?flags", item.Flags);
 

+ 22 - 22
OpenSim/Data/MySQL/MySQLSimulationData.cs

@@ -775,7 +775,7 @@ namespace OpenSim.Data.MySQL
                     using (MySqlCommand cmd = dbcon.CreateCommand())
                     {
                         cmd.CommandText = "select * from regionsettings where regionUUID = ?RegionUUID";
-                        cmd.Parameters.AddWithValue("regionUUID", regionUUID);
+                        cmd.Parameters.AddWithValue("regionUUID", regionUUID.ToString());
 
                         using (IDataReader reader = ExecuteReader(cmd))
                         {
@@ -849,7 +849,7 @@ namespace OpenSim.Data.MySQL
                 {
                     cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
 
-                    cmd.Parameters.AddWithValue("region_id", regionUUID);
+                    cmd.Parameters.AddWithValue("region_id", regionUUID.ToString());
                     cmd.Parameters.AddWithValue("llsd_settings", settings);
 
                     ExecuteNonQuery(cmd);
@@ -914,11 +914,11 @@ namespace OpenSim.Data.MySQL
                          "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
                          "?WaterHeight, ?TerrainRaiseLimit, " +
                          "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
-                         "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
+                         "?SunPosition, ?Covenant, ?covenant_datetime, ?Sandbox, " +
                          "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
-                         "?LoadedCreationDateTime, ?LoadedCreationID, " +
-                         "?TerrainImageID, ?block_search, ?casino, " +
-                         "?TelehubObject, ?ParcelImageID, ?cacheID)";
+                         "?loaded_creation_datetime, ?loaded_creation_id, " +
+                         "?map_tile_ID, ?block_search, ?casino, " +
+                         "?TelehubObject, ?parcel_tile_ID, ?cacheID)";
 
                     FillRegionSettingsCommand(cmd, rs);
                     ExecuteNonQuery(cmd);
@@ -1517,7 +1517,7 @@ namespace OpenSim.Data.MySQL
             }
             else
             {
-                cmd.Parameters.AddWithValue("LoopedSound", UUID.Zero);
+                cmd.Parameters.AddWithValue("LoopedSound", UUID.ZeroString);
                 cmd.Parameters.AddWithValue("LoopedSoundGain", 0.0f);
             }
 
@@ -1625,10 +1625,10 @@ namespace OpenSim.Data.MySQL
         /// <param name="taskItem"></param>
         private static void FillItemCommand(MySqlCommand cmd, TaskInventoryItem taskItem)
         {
-            cmd.Parameters.AddWithValue("itemID", taskItem.ItemID);
-            cmd.Parameters.AddWithValue("primID", taskItem.ParentPartID);
-            cmd.Parameters.AddWithValue("assetID", taskItem.AssetID);
-            cmd.Parameters.AddWithValue("parentFolderID", taskItem.ParentID);
+            cmd.Parameters.AddWithValue("itemID", taskItem.ItemID.ToString());
+            cmd.Parameters.AddWithValue("primID", taskItem.ParentPartID.ToString());
+            cmd.Parameters.AddWithValue("assetID", taskItem.AssetID.ToString());
+            cmd.Parameters.AddWithValue("parentFolderID", taskItem.ParentID.ToString());
 
             cmd.Parameters.AddWithValue("invType", taskItem.InvType);
             cmd.Parameters.AddWithValue("assetType", taskItem.Type);
@@ -1637,9 +1637,9 @@ namespace OpenSim.Data.MySQL
             cmd.Parameters.AddWithValue("description", taskItem.Description);
             cmd.Parameters.AddWithValue("creationDate", taskItem.CreationDate);
             cmd.Parameters.AddWithValue("creatorID", taskItem.CreatorIdentification);
-            cmd.Parameters.AddWithValue("ownerID", taskItem.OwnerID);
-            cmd.Parameters.AddWithValue("lastOwnerID", taskItem.LastOwnerID);
-            cmd.Parameters.AddWithValue("groupID", taskItem.GroupID);
+            cmd.Parameters.AddWithValue("ownerID", taskItem.OwnerID.ToString());
+            cmd.Parameters.AddWithValue("lastOwnerID", taskItem.LastOwnerID.ToString());
+            cmd.Parameters.AddWithValue("groupID", taskItem.GroupID.ToString());
             cmd.Parameters.AddWithValue("nextPermissions", taskItem.NextPermissions);
             cmd.Parameters.AddWithValue("currentPermissions", taskItem.CurrentPermissions);
             cmd.Parameters.AddWithValue("basePermissions", taskItem.BasePermissions);
@@ -1690,16 +1690,16 @@ namespace OpenSim.Data.MySQL
             cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun);
             cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition);
             cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
-            cmd.Parameters.AddWithValue("CovenantChangedDateTime", settings.CovenantChangedDateTime);
-            cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
-            cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
-            cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
+            cmd.Parameters.AddWithValue("covenant_datetime", settings.CovenantChangedDateTime);
+            cmd.Parameters.AddWithValue("loaded_creation_datetime", settings.LoadedCreationDateTime);
+            cmd.Parameters.AddWithValue("loaded_creation_id", settings.LoadedCreationID);
+            cmd.Parameters.AddWithValue("map_tile_ID", settings.TerrainImageID.ToString());
             cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch);
             cmd.Parameters.AddWithValue("casino", settings.Casino);
 
-            cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
-            cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
-            cmd.Parameters.AddWithValue("cacheID", settings.CacheID);
+            cmd.Parameters.AddWithValue("parcel_tile_ID", settings.ParcelImageID.ToString());
+            cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject.ToString());
+            cmd.Parameters.AddWithValue("cacheID", settings.CacheID.ToString());
         }
 
         /// <summary>
@@ -1744,7 +1744,7 @@ namespace OpenSim.Data.MySQL
             cmd.Parameters.AddWithValue("UserLookAtX", land.UserLookAt.X);
             cmd.Parameters.AddWithValue("UserLookAtY", land.UserLookAt.Y);
             cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z);
-            cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
+            cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID.ToString());
             cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
             cmd.Parameters.AddWithValue("Dwell", land.Dwell);
             cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);

+ 10 - 11
OpenSim/Data/MySQL/MySQLUserProfilesData.cs

@@ -28,7 +28,6 @@
 using System;
 using System.Data;
 using System.Reflection;
-using OpenSim.Data;
 using OpenSim.Framework;
 using MySql.Data.MySqlClient;
 using OpenMetaverse;
@@ -94,7 +93,7 @@ namespace OpenSim.Data.MySQL
                 dbcon.Open();
                 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
                 {
-                    cmd.Parameters.AddWithValue("?Id", creatorId);
+                    cmd.Parameters.AddWithValue("?Id", creatorId.ToString());
                     using( MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
                     {
                         if(reader.HasRows)
@@ -143,8 +142,8 @@ namespace OpenSim.Data.MySQL
                 +  "`simname`,"
                 +  "`posglobal`,"
                 +  "`parcelname`,"
-                + "`classifiedflags`,"
-                + "`priceforlisting`) "
+                +  "`classifiedflags`,"
+                +  "`priceforlisting`) "
                 + "VALUES ("
                 + "?ClassifiedId,"
                 + "?CreatorId,"
@@ -282,14 +281,14 @@ namespace OpenSim.Data.MySQL
                         {
                             if(reader.Read ())
                             {
-                                ad.CreatorId = new UUID(reader.GetGuid("creatoruuid"));
-                                ad.ParcelId = new UUID(reader.GetGuid("parceluuid"));
-                                ad.SnapshotId = new UUID(reader.GetGuid("snapshotuuid"));
+                                ad.CreatorId = DBGuid.FromDB(reader["creatoruuid"]);
+                                ad.ParcelId = DBGuid.FromDB(reader["parceluuid"]);
+                                ad.SnapshotId = DBGuid.FromDB(reader["snapshotuuid"]);
                                 ad.CreationDate = Convert.ToInt32(reader["creationdate"]);
                                 ad.ExpirationDate = Convert.ToInt32(reader["expirationdate"]);
                                 ad.ParentEstate = Convert.ToInt32(reader["parentestate"]);
                                 ad.Flags = (byte)reader.GetUInt32("classifiedflags");
-                                ad.Category = reader.GetInt32("category");
+                                ad.Category = Convert.ToInt32(reader["category"]);
                                 ad.Price = reader.GetInt16("priceforlisting");
                                 ad.Name = reader.GetString("name");
                                 ad.Description = reader.GetString("description");
@@ -823,7 +822,7 @@ namespace OpenSim.Data.MySQL
                             {
                                 while (reader.Read())
                                 {
-                                    data.Add(new OSDString((string)reader["snapshotuuid"].ToString ()));
+                                    data.Add(new OSDString(reader["snapshotuuid"].ToString ()));
                                 }
                             }
                         }
@@ -844,8 +843,8 @@ namespace OpenSim.Data.MySQL
                             {
                                 while (reader.Read())
                                 {
-                                    data.Add(new OSDString((string)reader["profileImage"].ToString ()));
-                                    data.Add(new OSDString((string)reader["profileFirstImage"].ToString ()));
+                                    data.Add(new OSDString(reader["profileImage"].ToString ()));
+                                    data.Add(new OSDString(reader["profileFirstImage"].ToString ()));
                                 }
                             }
                         }