Fixed the problem of prims not being loaded from the database (that my last commit created).

afrisby
MW 2007-08-29 16:35:22 +00:00
parent 36fba5e7e2
commit 334dce42e7
2 changed files with 113 additions and 77 deletions

View File

@ -362,8 +362,11 @@ namespace OpenSim.Region.Environment.Scenes
/// ///
/// </summary> /// </summary>
public void ScheduleFullUpdate() public void ScheduleFullUpdate()
{
if (m_parentGroup != null)
{ {
m_parentGroup.HasChanged = true; m_parentGroup.HasChanged = true;
}
m_updateFlag = 2; m_updateFlag = 2;
} }
@ -373,8 +376,11 @@ namespace OpenSim.Region.Environment.Scenes
public void ScheduleTerseUpdate() public void ScheduleTerseUpdate()
{ {
if (m_updateFlag < 1) if (m_updateFlag < 1)
{
if (m_parentGroup != null)
{ {
m_parentGroup.HasChanged = true; m_parentGroup.HasChanged = true;
}
m_updateFlag = 1; m_updateFlag = 1;
} }
} }

View File

@ -135,7 +135,8 @@ namespace OpenSim.DataStore.MonoSqliteStorage
foreach (DataRow primRow in primsForRegion) foreach (DataRow primRow in primsForRegion)
{ {
try { try
{
string uuid = (string)primRow["UUID"]; string uuid = (string)primRow["UUID"];
string objID = (string)primRow["SceneGroupID"]; string objID = (string)primRow["SceneGroupID"];
if (uuid == objID) //is new SceneObjectGroup ? if (uuid == objID) //is new SceneObjectGroup ?
@ -173,14 +174,17 @@ namespace OpenSim.DataStore.MonoSqliteStorage
} }
createdObjects[new LLUUID(objID)].AddPart(prim); createdObjects[new LLUUID(objID)].AddPart(prim);
} }
} catch(Exception) { }
foreach (DataColumn col in prims.Columns) { catch (Exception)
{
foreach (DataColumn col in prims.Columns)
{
MainLog.Instance.Verbose("Col: " + col.ColumnName + " => " + primRow[col]); MainLog.Instance.Verbose("Col: " + col.ColumnName + " => " + primRow[col]);
} }
} }
} }
MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + prims.Rows.Count + " primitives"); MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + prims.Rows.Count + " primitives");
MainLog.Instance.Verbose("DATASTORE", "Sqlite - Number of sceneObjects" + retvals.Count);
return retvals; return retvals;
} }
@ -214,42 +218,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;
// } // }
// } // }
/*********************************************************************** /***********************************************************************
* *
@ -633,7 +637,8 @@ namespace OpenSim.DataStore.MonoSqliteStorage
* generate these strings instead of typing them out. * generate these strings instead of typing them out.
*/ */
string[] cols = new string[dt.Columns.Count]; string[] cols = new string[dt.Columns.Count];
for (int i = 0; i < dt.Columns.Count; i++) { for (int i = 0; i < dt.Columns.Count; i++)
{
DataColumn col = dt.Columns[i]; DataColumn col = dt.Columns[i];
cols[i] = col.ColumnName; cols[i] = col.ColumnName;
} }
@ -693,7 +698,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
subsql += ",\n"; subsql += ",\n";
} }
subsql += col.ColumnName + " " + sqliteType(col.DataType); subsql += col.ColumnName + " " + sqliteType(col.DataType);
if(col == dt.PrimaryKey[0]) if (col == dt.PrimaryKey[0])
{ {
subsql += " primary key"; subsql += " primary key";
} }
@ -782,10 +787,13 @@ namespace OpenSim.DataStore.MonoSqliteStorage
SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd); SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd);
DataSet tmpDS = new DataSet(); DataSet tmpDS = new DataSet();
try { try
{
pDa.Fill(tmpDS, "prims"); pDa.Fill(tmpDS, "prims");
sDa.Fill(tmpDS, "primshapes"); sDa.Fill(tmpDS, "primshapes");
} catch (Mono.Data.SqliteClient.SqliteSyntaxException) { }
catch (Mono.Data.SqliteClient.SqliteSyntaxException)
{
MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
InitDB(conn); InitDB(conn);
} }
@ -793,14 +801,18 @@ namespace OpenSim.DataStore.MonoSqliteStorage
pDa.Fill(tmpDS, "prims"); pDa.Fill(tmpDS, "prims");
sDa.Fill(tmpDS, "primshapes"); sDa.Fill(tmpDS, "primshapes");
foreach (DataColumn col in createPrimTable().Columns) { foreach (DataColumn col in createPrimTable().Columns)
if (! tmpDS.Tables["prims"].Columns.Contains(col.ColumnName) ) { {
if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName))
{
MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
return false; return false;
} }
} }
foreach (DataColumn col in createShapeTable().Columns) { foreach (DataColumn col in createShapeTable().Columns)
if (! tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName) ) { {
if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName))
{
MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
return false; return false;
} }
@ -816,15 +828,24 @@ namespace OpenSim.DataStore.MonoSqliteStorage
private DbType dbtypeFromType(Type type) private DbType dbtypeFromType(Type type)
{ {
if (type == typeof(System.String)) { if (type == typeof(System.String))
{
return DbType.String; return DbType.String;
} else if (type == typeof(System.Int32)) { }
else if (type == typeof(System.Int32))
{
return DbType.Int32; return DbType.Int32;
} else if (type == typeof(System.Double)) { }
else if (type == typeof(System.Double))
{
return DbType.Double; return DbType.Double;
} else if (type == typeof(System.Byte[])) { }
else if (type == typeof(System.Byte[]))
{
return DbType.Binary; return DbType.Binary;
} else { }
else
{
return DbType.String; return DbType.String;
} }
} }
@ -833,15 +854,24 @@ namespace OpenSim.DataStore.MonoSqliteStorage
// slightly differently. // slightly differently.
private string sqliteType(Type type) private string sqliteType(Type type)
{ {
if (type == typeof(System.String)) { if (type == typeof(System.String))
{
return "varchar(255)"; return "varchar(255)";
} else if (type == typeof(System.Int32)) { }
else if (type == typeof(System.Int32))
{
return "integer"; return "integer";
} else if (type == typeof(System.Double)) { }
else if (type == typeof(System.Double))
{
return "float"; return "float";
} else if (type == typeof(System.Byte[])) { }
else if (type == typeof(System.Byte[]))
{
return "blob"; return "blob";
} else { }
else
{
return "string"; return "string";
} }
} }