diff options
Diffstat (limited to 'OpenSim/Framework/Data.SQLite')
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs index 96dd5ac..dfd4535 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs | |||
@@ -61,6 +61,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
61 | 61 | ||
62 | private String m_connectionString; | 62 | private String m_connectionString; |
63 | 63 | ||
64 | // Temporary attribute while this is experimental | ||
64 | private bool persistPrimInventories; | 65 | private bool persistPrimInventories; |
65 | 66 | ||
66 | /*********************************************************************** | 67 | /*********************************************************************** |
@@ -208,6 +209,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
208 | { | 209 | { |
209 | DataTable prims = ds.Tables["prims"]; | 210 | DataTable prims = ds.Tables["prims"]; |
210 | DataTable shapes = ds.Tables["primshapes"]; | 211 | DataTable shapes = ds.Tables["primshapes"]; |
212 | DataTable items = ds.Tables["primitems"]; | ||
211 | 213 | ||
212 | string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "'"; | 214 | string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "'"; |
213 | lock (ds) | 215 | lock (ds) |
@@ -215,13 +217,28 @@ namespace OpenSim.Framework.Data.SQLite | |||
215 | DataRow[] primRows = prims.Select(selectExp); | 217 | DataRow[] primRows = prims.Select(selectExp); |
216 | foreach (DataRow row in primRows) | 218 | foreach (DataRow row in primRows) |
217 | { | 219 | { |
220 | // Remove shape rows | ||
218 | LLUUID uuid = new LLUUID((string) row["UUID"]); | 221 | LLUUID uuid = new LLUUID((string) row["UUID"]); |
219 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid)); | 222 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid)); |
220 | if (shapeRow != null) | 223 | if (shapeRow != null) |
221 | { | 224 | { |
222 | shapeRow.Delete(); | 225 | shapeRow.Delete(); |
223 | } | 226 | } |
224 | row.Delete(); | 227 | |
228 | if (persistPrimInventories) | ||
229 | { | ||
230 | // Remove items rows | ||
231 | String sql = String.Format("primID = '{0}'", uuid); | ||
232 | DataRow[] itemRows = items.Select(sql); | ||
233 | |||
234 | foreach (DataRow itemsRow in itemRows) | ||
235 | { | ||
236 | itemsRow.Delete(); | ||
237 | } | ||
238 | } | ||
239 | |||
240 | // Remove prim row | ||
241 | row.Delete(); | ||
225 | } | 242 | } |
226 | } | 243 | } |
227 | 244 | ||
@@ -1444,6 +1461,20 @@ namespace OpenSim.Framework.Data.SQLite | |||
1444 | param.SourceColumn = name; | 1461 | param.SourceColumn = name; |
1445 | param.SourceVersion = DataRowVersion.Current; | 1462 | param.SourceVersion = DataRowVersion.Current; |
1446 | return param; | 1463 | return param; |
1464 | } | ||
1465 | |||
1466 | private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
1467 | { | ||
1468 | da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); | ||
1469 | da.InsertCommand.Connection = conn; | ||
1470 | |||
1471 | da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]); | ||
1472 | da.UpdateCommand.Connection = conn; | ||
1473 | |||
1474 | SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); | ||
1475 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); | ||
1476 | delete.Connection = conn; | ||
1477 | da.DeleteCommand = delete; | ||
1447 | } | 1478 | } |
1448 | 1479 | ||
1449 | private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) | 1480 | private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) |
@@ -1460,20 +1491,6 @@ namespace OpenSim.Framework.Data.SQLite | |||
1460 | da.DeleteCommand = delete; | 1491 | da.DeleteCommand = delete; |
1461 | } | 1492 | } |
1462 | 1493 | ||
1463 | private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
1464 | { | ||
1465 | da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); | ||
1466 | da.InsertCommand.Connection = conn; | ||
1467 | |||
1468 | da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]); | ||
1469 | da.UpdateCommand.Connection = conn; | ||
1470 | |||
1471 | SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); | ||
1472 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); | ||
1473 | delete.Connection = conn; | ||
1474 | da.DeleteCommand = delete; | ||
1475 | } | ||
1476 | |||
1477 | private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) | 1494 | private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) |
1478 | { | 1495 | { |
1479 | da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]); | 1496 | da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]); |
@@ -1656,8 +1673,8 @@ namespace OpenSim.Framework.Data.SQLite | |||
1656 | return false; | 1673 | return false; |
1657 | } | 1674 | } |
1658 | } | 1675 | } |
1659 | 1676 | ||
1660 | // TODO Not restoring prim inventories quite yet | 1677 | // XXX primitems should probably go here eventually |
1661 | 1678 | ||
1662 | foreach (DataColumn col in createTerrainTable().Columns) | 1679 | foreach (DataColumn col in createTerrainTable().Columns) |
1663 | { | 1680 | { |