Add a field asset_flags and a corresponding enum to the asset database. This
CHANGES THE ASSET SERVER PROTOCOL and means you CAN NOT MIX PRIOR VERSIONS WITH LATER ONES. It may also eat your babies, yada, yada, yada. The usual cautions for migrations to the assets table apply. Coding: Can not guarantee nut free.slimupdates2
parent
c1fe07b022
commit
9b22393cf3
|
@ -161,8 +161,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
MySqlCommand cmd =
|
MySqlCommand cmd =
|
||||||
new MySqlCommand(
|
new MySqlCommand(
|
||||||
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, data)" +
|
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, data)" +
|
||||||
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)",
|
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?data)",
|
||||||
dbcon);
|
dbcon);
|
||||||
|
|
||||||
string assetName = asset.Name;
|
string assetName = asset.Name;
|
||||||
|
@ -194,6 +194,7 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||||
cmd.Parameters.AddWithValue("?create_time", now);
|
cmd.Parameters.AddWithValue("?create_time", now);
|
||||||
cmd.Parameters.AddWithValue("?access_time", now);
|
cmd.Parameters.AddWithValue("?access_time", now);
|
||||||
|
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Dispose();
|
cmd.Dispose();
|
||||||
|
@ -302,7 +303,7 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id FROM assets LIMIT ?start, ?count", dbcon);
|
MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags FROM assets LIMIT ?start, ?count", dbcon);
|
||||||
cmd.Parameters.AddWithValue("?start", start);
|
cmd.Parameters.AddWithValue("?start", start);
|
||||||
cmd.Parameters.AddWithValue("?count", count);
|
cmd.Parameters.AddWithValue("?count", count);
|
||||||
|
|
||||||
|
@ -317,6 +318,7 @@ namespace OpenSim.Data.MySQL
|
||||||
metadata.Description = (string)dbReader["description"];
|
metadata.Description = (string)dbReader["description"];
|
||||||
metadata.Type = (sbyte)dbReader["assetType"];
|
metadata.Type = (sbyte)dbReader["assetType"];
|
||||||
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
||||||
|
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||||
metadata.FullID = new UUID((string)dbReader["id"]);
|
metadata.FullID = new UUID((string)dbReader["id"]);
|
||||||
|
|
||||||
// Current SHA1s are not stored/computed.
|
// Current SHA1s are not stored/computed.
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -33,6 +33,15 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
|
[Flags]
|
||||||
|
public enum AssetFlags : int
|
||||||
|
{
|
||||||
|
Normal = 0,
|
||||||
|
Maptile = 1,
|
||||||
|
Rewritable = 2,
|
||||||
|
Collectable = 4
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asset class. All Assets are reference by this class or a class derived from this class
|
/// Asset class. All Assets are reference by this class or a class derived from this class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -206,6 +215,12 @@ namespace OpenSim.Framework
|
||||||
set { m_metadata.Temporary = value; }
|
set { m_metadata.Temporary = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AssetFlags Flags
|
||||||
|
{
|
||||||
|
get { return m_metadata.Flags; }
|
||||||
|
set { m_metadata.Flags = value; }
|
||||||
|
}
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public AssetMetadata Metadata
|
public AssetMetadata Metadata
|
||||||
{
|
{
|
||||||
|
@ -233,6 +248,7 @@ namespace OpenSim.Framework
|
||||||
private bool m_local;
|
private bool m_local;
|
||||||
private bool m_temporary;
|
private bool m_temporary;
|
||||||
private string m_creatorid;
|
private string m_creatorid;
|
||||||
|
private AssetFlags m_flags;
|
||||||
|
|
||||||
public UUID FullID
|
public UUID FullID
|
||||||
{
|
{
|
||||||
|
@ -330,5 +346,11 @@ namespace OpenSim.Framework
|
||||||
get { return m_creatorid; }
|
get { return m_creatorid; }
|
||||||
set { m_creatorid = value; }
|
set { m_creatorid = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AssetFlags Flags
|
||||||
|
{
|
||||||
|
get { return m_flags; }
|
||||||
|
set { m_flags = value; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,6 +181,7 @@ namespace OpenSim.Services.AssetService
|
||||||
MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description));
|
MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description));
|
||||||
MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type));
|
MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type));
|
||||||
MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType));
|
MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType));
|
||||||
|
MainConsole.Instance.Output(String.Format("Flags: {0}", asset.Metadata.Flags.ToString()));
|
||||||
|
|
||||||
for (i = 0 ; i < 5 ; i++)
|
for (i = 0 ; i < 5 ; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue