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

View File

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