mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
* Fixed spamming the assets table with map tiles. The tile image ID is now stored in regionsettings. Upon generation of a new tile image, the old one is deleted. Tested for SQLite and MySql standalone.
* Fixed small bug with map search where the local sim regions weren't found.
This commit is contained in:
@@ -111,7 +111,7 @@ namespace OpenSim.Data.MySQL
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(
|
||||
"SELECT name, description, assetType, local, temporary, data FROM assets WHERE id=?id",
|
||||
"SELECT name, description, assetType, local, temporary, asset_flags, data FROM assets WHERE id=?id",
|
||||
dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", assetID.ToString());
|
||||
@@ -133,6 +133,7 @@ namespace OpenSim.Data.MySQL
|
||||
asset.Local = false;
|
||||
|
||||
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
||||
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,7 +346,7 @@ namespace OpenSim.Data.MySQL
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id");
|
||||
MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon);
|
||||
cmd.Parameters.AddWithValue("?id", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
|
||||
@@ -989,7 +989,8 @@ namespace OpenSim.Data.MySQL
|
||||
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
|
||||
"?SunPosition, ?Covenant, ?Sandbox, " +
|
||||
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
|
||||
"?LoadedCreationDateTime, ?LoadedCreationID)";
|
||||
"?LoadedCreationDateTime, ?LoadedCreationID)" +
|
||||
"?map_tile_ID, ?TerrainImageID";
|
||||
|
||||
FillRegionSettingsCommand(cmd, rs);
|
||||
|
||||
@@ -1276,6 +1277,8 @@ namespace OpenSim.Data.MySQL
|
||||
else
|
||||
newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
|
||||
|
||||
newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
@@ -1596,6 +1599,7 @@ namespace OpenSim.Data.MySQL
|
||||
cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
|
||||
cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
|
||||
cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
|
||||
cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
|
||||
|
||||
}
|
||||
|
||||
|
||||
3
OpenSim/Data/MySQL/Resources/033_RegionStore.sql
Normal file
3
OpenSim/Data/MySQL/Resources/033_RegionStore.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
BEGIN;
|
||||
ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
COMMIT;
|
||||
@@ -40,7 +40,7 @@ namespace OpenSim.Data.Null
|
||||
{
|
||||
private static NullRegionData Instance = null;
|
||||
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>();
|
||||
|
||||
@@ -62,12 +62,14 @@ namespace OpenSim.Data.Null
|
||||
{
|
||||
if (regionName.Contains("%"))
|
||||
{
|
||||
if (r.RegionName.Contains(regionName.Replace("%", "")))
|
||||
string cleanname = regionName.Replace("%", "");
|
||||
m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanname.ToLower(), r.RegionName.ToLower());
|
||||
if (r.RegionName.ToLower().Contains(cleanname.ToLower()))
|
||||
ret.Add(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (r.RegionName == regionName)
|
||||
if (r.RegionName.ToLower() == regionName.ToLower())
|
||||
ret.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
5
OpenSim/Data/SQLite/Resources/005_AssetStore.sql
Normal file
5
OpenSim/Data/SQLite/Resources/005_AssetStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT;
|
||||
5
OpenSim/Data/SQLite/Resources/019_RegionStore.sql
Normal file
5
OpenSim/Data/SQLite/Resources/019_RegionStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT;
|
||||
@@ -46,8 +46,8 @@ namespace OpenSim.Data.SQLite
|
||||
private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
|
||||
private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, UUID from assets limit :start, :count";
|
||||
private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
|
||||
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)";
|
||||
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
|
||||
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, asset_flags, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Flags, :Data)";
|
||||
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, asset_flags=:Flags, Data=:Data where UUID=:UUID";
|
||||
private const string assetSelect = "select * from assets";
|
||||
|
||||
private SqliteConnection m_conn;
|
||||
@@ -136,6 +136,7 @@ namespace OpenSim.Data.SQLite
|
||||
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Flags", asset.Flags));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
@@ -154,6 +155,7 @@ namespace OpenSim.Data.SQLite
|
||||
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Flags", asset.Flags));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
@@ -227,7 +229,8 @@ namespace OpenSim.Data.SQLite
|
||||
asset.Description = (String) row["Description"];
|
||||
asset.Local = Convert.ToBoolean(row["Local"]);
|
||||
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
|
||||
asset.Data = (byte[]) row["Data"];
|
||||
asset.Flags = (AssetFlags)Convert.ToInt32(row["asset_flags"]);
|
||||
asset.Data = (byte[])row["Data"];
|
||||
return asset;
|
||||
}
|
||||
|
||||
@@ -240,6 +243,7 @@ namespace OpenSim.Data.SQLite
|
||||
metadata.Description = (string) row["Description"];
|
||||
metadata.Type = Convert.ToSByte(row["Type"]);
|
||||
metadata.Temporary = Convert.ToBoolean(row["Temporary"]); // Not sure if this is correct.
|
||||
metadata.Flags = (AssetFlags)Convert.ToInt32(row["asset_flags"]);
|
||||
|
||||
// Current SHA1s are not stored/computed.
|
||||
metadata.SHA1 = new byte[] {};
|
||||
|
||||
@@ -1156,6 +1156,7 @@ namespace OpenSim.Data.SQLite
|
||||
createCol(regionsettings, "fixed_sun", typeof (Int32));
|
||||
createCol(regionsettings, "sun_position", typeof (Double));
|
||||
createCol(regionsettings, "covenant", typeof(String));
|
||||
createCol(regionsettings, "map_tile_ID", typeof(String));
|
||||
regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
|
||||
return regionsettings;
|
||||
}
|
||||
@@ -1474,6 +1475,7 @@ namespace OpenSim.Data.SQLite
|
||||
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
|
||||
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
|
||||
newSettings.Covenant = new UUID((String) row["covenant"]);
|
||||
newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
@@ -1792,6 +1794,7 @@ namespace OpenSim.Data.SQLite
|
||||
row["fixed_sun"] = settings.FixedSun;
|
||||
row["sun_position"] = settings.SunPosition;
|
||||
row["covenant"] = settings.Covenant.ToString();
|
||||
row["map_tile_ID"] = settings.TerrainImageID.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user