Add region to db
parent
ff7164196d
commit
f6e0791e04
|
@ -21,7 +21,6 @@ using Mono.Data.SqliteClient;
|
||||||
|
|
||||||
namespace OpenSim.DataStore.MonoSqliteStorage
|
namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
{
|
{
|
||||||
|
|
||||||
public class MonoSqliteDataStore : IRegionDataStore
|
public class MonoSqliteDataStore : IRegionDataStore
|
||||||
{
|
{
|
||||||
private const string primSelect = "select * from prims";
|
private const string primSelect = "select * from prims";
|
||||||
|
@ -76,7 +75,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart prim in obj.Children.Values)
|
foreach (SceneObjectPart prim in obj.Children.Values)
|
||||||
{
|
{
|
||||||
addPrim(prim, obj.UUID);
|
addPrim(prim, obj.UUID, regionUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainLog.Instance.Verbose("Attempting to do database update....");
|
// MainLog.Instance.Verbose("Attempting to do database update....");
|
||||||
|
@ -115,7 +114,8 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
DataTable prims = ds.Tables["prims"];
|
DataTable prims = ds.Tables["prims"];
|
||||||
DataTable shapes = ds.Tables["primshapes"];
|
DataTable shapes = ds.Tables["primshapes"];
|
||||||
|
|
||||||
foreach (DataRow primRow in prims.Rows)
|
string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'";
|
||||||
|
foreach (DataRow primRow in prims.Select(byRegion))
|
||||||
{
|
{
|
||||||
string uuid = (string)primRow["UUID"];
|
string uuid = (string)primRow["UUID"];
|
||||||
string objID = (string)primRow["SceneGroupID"];
|
string objID = (string)primRow["SceneGroupID"];
|
||||||
|
@ -191,42 +191,42 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
// TODO: DataSet commit
|
// TODO: DataSet commit
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TextureBlock
|
// public class TextureBlock
|
||||||
{
|
// {
|
||||||
public byte[] TextureData;
|
// public byte[] TextureData;
|
||||||
public byte[] ExtraParams = new byte[1];
|
// public byte[] ExtraParams = new byte[1];
|
||||||
|
|
||||||
public TextureBlock(byte[] data)
|
// public TextureBlock(byte[] data)
|
||||||
{
|
// {
|
||||||
TextureData = data;
|
// TextureData = data;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public TextureBlock()
|
// public TextureBlock()
|
||||||
{
|
// {
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
public string ToXMLString()
|
// public string ToXMLString()
|
||||||
{
|
// {
|
||||||
StringWriter sw = new StringWriter();
|
// StringWriter sw = new StringWriter();
|
||||||
XmlTextWriter writer = new XmlTextWriter(sw);
|
// XmlTextWriter writer = new XmlTextWriter(sw);
|
||||||
XmlSerializer serializer = new XmlSerializer(typeof(TextureBlock));
|
// XmlSerializer serializer = new XmlSerializer(typeof(TextureBlock));
|
||||||
serializer.Serialize(writer, this);
|
// serializer.Serialize(writer, this);
|
||||||
return sw.ToString();
|
// return sw.ToString();
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static TextureBlock FromXmlString(string xmlData)
|
// public static TextureBlock FromXmlString(string xmlData)
|
||||||
{
|
// {
|
||||||
TextureBlock textureEntry = null;
|
// TextureBlock textureEntry = null;
|
||||||
StringReader sr = new StringReader(xmlData);
|
// StringReader sr = new StringReader(xmlData);
|
||||||
XmlTextReader reader = new XmlTextReader(sr);
|
// XmlTextReader reader = new XmlTextReader(sr);
|
||||||
XmlSerializer serializer = new XmlSerializer(typeof(TextureBlock));
|
// XmlSerializer serializer = new XmlSerializer(typeof(TextureBlock));
|
||||||
textureEntry = (TextureBlock)serializer.Deserialize(reader);
|
// textureEntry = (TextureBlock)serializer.Deserialize(reader);
|
||||||
reader.Close();
|
// reader.Close();
|
||||||
sr.Close();
|
// sr.Close();
|
||||||
return textureEntry;
|
// return textureEntry;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
|
@ -247,6 +247,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
DataTable prims = new DataTable("prims");
|
DataTable prims = new DataTable("prims");
|
||||||
|
|
||||||
createCol(prims, "UUID", typeof(System.String));
|
createCol(prims, "UUID", typeof(System.String));
|
||||||
|
createCol(prims, "RegionUUID", typeof(System.String));
|
||||||
createCol(prims, "ParentID", typeof(System.Int32));
|
createCol(prims, "ParentID", typeof(System.Int32));
|
||||||
createCol(prims, "CreationDate", typeof(System.Int32));
|
createCol(prims, "CreationDate", typeof(System.Int32));
|
||||||
createCol(prims, "Name", typeof(System.String));
|
createCol(prims, "Name", typeof(System.String));
|
||||||
|
@ -407,9 +408,10 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
return prim;
|
return prim;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID)
|
private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
row["UUID"] = prim.UUID;
|
row["UUID"] = prim.UUID;
|
||||||
|
row["RegionUUID"] = regionUUID;
|
||||||
row["ParentID"] = prim.ParentID;
|
row["ParentID"] = prim.ParentID;
|
||||||
row["CreationDate"] = prim.CreationDate;
|
row["CreationDate"] = prim.CreationDate;
|
||||||
row["Name"] = prim.Name;
|
row["Name"] = prim.Name;
|
||||||
|
@ -553,7 +555,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
// row["Texture"] = encoding.GetBytes(textureBlock.ToXMLString());
|
// row["Texture"] = encoding.GetBytes(textureBlock.ToXMLString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID)
|
private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
|
||||||
{
|
{
|
||||||
DataTable prims = ds.Tables["prims"];
|
DataTable prims = ds.Tables["prims"];
|
||||||
DataTable shapes = ds.Tables["primshapes"];
|
DataTable shapes = ds.Tables["primshapes"];
|
||||||
|
@ -562,12 +564,12 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
if (primRow == null)
|
if (primRow == null)
|
||||||
{
|
{
|
||||||
primRow = prims.NewRow();
|
primRow = prims.NewRow();
|
||||||
fillPrimRow(primRow, prim, sceneGroupID);
|
fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
|
||||||
prims.Rows.Add(primRow);
|
prims.Rows.Add(primRow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fillPrimRow(primRow, prim, sceneGroupID);
|
fillPrimRow(primRow, prim, sceneGroupID, regionUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataRow shapeRow = shapes.Rows.Find(prim.UUID);
|
DataRow shapeRow = shapes.Rows.Find(prim.UUID);
|
||||||
|
|
Loading…
Reference in New Issue