This chunk of code actually properly saves out some parameters of

current objects to disk, and does updates on those objects usefully.
It is now functional enough to mean that moving to new objects is 
just lots of plug and chug.
afrisby
Sean Dague 2007-08-08 19:35:16 +00:00
parent be483bc697
commit a5f8d012b7
1 changed files with 9 additions and 6 deletions

View File

@ -44,13 +44,15 @@ namespace OpenSim.DataStore.SqliteStorage
// We fill the data set, now we've got copies in memory for the information // We fill the data set, now we've got copies in memory for the information
// TODO: see if the linkage actually holds. // TODO: see if the linkage actually holds.
primDa.FillSchema(ds, SchemaType.Source, "PrimSchema"); // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema");
primDa.Fill(ds, "prims"); primDa.Fill(ds, "prims");
ds.AcceptChanges();
DataTable prims = ds.Tables["prims"]; DataTable prims = ds.Tables["prims"];
prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
setupPrimCommands(primDa, conn); setupPrimCommands(primDa, conn);
shapeDa.FillSchema(ds, SchemaType.Source, "ShapeSchema"); // shapeDa.FillSchema(ds, SchemaType.Source, "ShapeSchema");
shapeDa.Fill(ds, "primshapes"); shapeDa.Fill(ds, "primshapes");
return; return;
@ -76,7 +78,7 @@ namespace OpenSim.DataStore.SqliteStorage
SqliteParameter PositionZ = createSqliteParameter("PositionZ", DbType.Double); SqliteParameter PositionZ = createSqliteParameter("PositionZ", DbType.Double);
SqliteCommand delete = new SqliteCommand("delete from prims where UUID=:UUID"); SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID");
delete.Connection = conn; delete.Connection = conn;
SqliteCommand insert = SqliteCommand insert =
@ -86,9 +88,9 @@ namespace OpenSim.DataStore.SqliteStorage
insert.Connection = conn; insert.Connection = conn;
SqliteCommand update = SqliteCommand update =
new SqliteCommand("update prims" + new SqliteCommand("update prims set " +
"set CreationDate=:CreationDate, Name=:Name, PositionX=:PositionX, " + "UUID = :UUID, CreationDate = :CreationDate, Name = :Name, PositionX = :PositionX, " +
"PositionY=:PositionY, PositionZ=:PositionZ where UUID=:UUID"); "PositionY = :PositionY, PositionZ = :PositionZ where UUID = :UUID");
update.Connection = conn; update.Connection = conn;
delete.Parameters.Add(UUID); delete.Parameters.Add(UUID);
@ -159,6 +161,7 @@ namespace OpenSim.DataStore.SqliteStorage
addPrim(prim); addPrim(prim);
} }
MainLog.Instance.Verbose("Attempting to do update....");
primDa.Update(ds, "prims"); primDa.Update(ds, "prims");
MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); MainLog.Instance.Verbose("Dump of prims:", ds.GetXml());
} }