make MonoSqliteDataStore compile with new objects

now the fun begins of connecting all the dots
afrisby
Sean Dague 2007-08-09 18:06:26 +00:00
parent bf69aca961
commit 21685bf304
1 changed files with 24 additions and 24 deletions

View File

@ -117,8 +117,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
private Dictionary<string, DbType> createShapeDataDefs() private Dictionary<string, DbType> createShapeDataDefs()
{ {
Dictionary<string, DbType> data = new Dictionary<string, DbType>(); Dictionary<string, DbType> data = new Dictionary<string, DbType>();
data.Add("id", DbType.Int32); data.Add("UUID", DbType.String);
data.Add("prim_id", DbType.Int32);
// shape is an enum // shape is an enum
data.Add("Shape", DbType.Int32); data.Add("Shape", DbType.Int32);
// vectors // vectors
@ -215,32 +214,33 @@ namespace OpenSim.DataStore.MonoSqliteStorage
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
private void StoreSceneObject(SceneObject obj) private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
{ {
Dictionary<string, DbType> shapeDataDefs = createShapeDataDefs();
da.InsertCommand = createInsertCommand("primshapes", shapeDataDefs);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", shapeDataDefs);
da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID");
delete.Parameters.Add(createSqliteParameter("UUID", DbType.String));
delete.Connection = conn;
da.DeleteCommand = delete;
} }
public void StoreObject(AllNewSceneObjectPart2 obj) private void fillPrimRow(DataRow row, SceneObjectPart prim)
{
// TODO: Serializing code
DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["shapes"];
}
private void fillPrimRow(DataRow row, Primitive prim)
{ {
row["UUID"] = prim.UUID; row["UUID"] = prim.UUID;
row["CreationDate"] = prim.CreationDate; row["CreationDate"] = prim.CreationDate;
row["Name"] = prim.Name; row["Name"] = prim.PartName;
row["PositionX"] = prim.Pos.X; row["PositionX"] = prim.OffsetPosition.X;
row["PositionY"] = prim.Pos.Y; row["PositionY"] = prim.OffsetPosition.Y;
row["PositionZ"] = prim.Pos.Z; row["PositionZ"] = prim.OffsetPosition.Z;
} }
private void addPrim(Primitive prim) private void addPrim(SceneObjectPart prim)
{ {
DataTable prims = ds.Tables["prims"]; DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["shapes"]; DataTable shapes = ds.Tables["shapes"];
@ -248,16 +248,16 @@ namespace OpenSim.DataStore.MonoSqliteStorage
DataRow row = prims.Rows.Find(prim.UUID); DataRow row = prims.Rows.Find(prim.UUID);
if (row == null) { if (row == null) {
row = prims.NewRow(); row = prims.NewRow();
fillPrimRow(row, prim); // fillPrimRow(row, prim);
prims.Rows.Add(row); prims.Rows.Add(row);
} else { } else {
fillPrimRow(row, prim); fillPrimRow(row, prim);
} }
} }
public void StoreObject(SceneObject obj) public void StoreObject(SceneObjectGroup obj)
{ {
foreach (Primitive prim in obj.Children.Values) foreach (SceneObjectPart prim in obj.Children.Values)
{ {
addPrim(prim); addPrim(prim);
} }
@ -272,9 +272,9 @@ namespace OpenSim.DataStore.MonoSqliteStorage
// TODO: remove code // TODO: remove code
} }
public List<SceneObject> LoadObjects() public List<SceneObjectGroup> LoadObjects()
{ {
List<SceneObject> retvals = new List<SceneObject>(); List<SceneObjectGroup> retvals = new List<SceneObjectGroup>();
MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + " objects"); MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + " objects");