diff options
Diffstat (limited to 'OpenSim/Region/Storage')
3 files changed, 85 insertions, 10 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs index 00b8924..c6210f7 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs | |||
@@ -52,12 +52,8 @@ namespace OpenSim.DataStore.MSSQL | |||
52 | private SqlDataAdapter shapeDa; | 52 | private SqlDataAdapter shapeDa; |
53 | private SqlDataAdapter terrainDa; | 53 | private SqlDataAdapter terrainDa; |
54 | 54 | ||
55 | /// <summary> | 55 | // see IRegionDataStore |
56 | /// | 56 | public void Initialise(string dbfile, bool persistPrimInventories) |
57 | /// </summary> | ||
58 | /// <param name="dbfile"></param> | ||
59 | /// <param name="dbname"></param> | ||
60 | public void Initialise(string dbfile) | ||
61 | { | 57 | { |
62 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); | 58 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); |
63 | string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); | 59 | string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index af2fb85..6750e4d 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -44,6 +44,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
44 | { | 44 | { |
45 | private const string primSelect = "select * from prims"; | 45 | private const string primSelect = "select * from prims"; |
46 | private const string shapeSelect = "select * from primshapes"; | 46 | private const string shapeSelect = "select * from primshapes"; |
47 | private const string itemsSelect = "select * from primitems"; | ||
47 | private const string terrainSelect = "select * from terrain limit 1"; | 48 | private const string terrainSelect = "select * from terrain limit 1"; |
48 | private const string landSelect = "select * from land"; | 49 | private const string landSelect = "select * from land"; |
49 | private const string landAccessListSelect = "select * from landaccesslist"; | 50 | private const string landAccessListSelect = "select * from landaccesslist"; |
@@ -56,6 +57,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
56 | private SqliteDataAdapter landAccessListDa; | 57 | private SqliteDataAdapter landAccessListDa; |
57 | 58 | ||
58 | private String m_connectionString; | 59 | private String m_connectionString; |
60 | |||
61 | private bool persistPrimInventories; | ||
59 | 62 | ||
60 | /*********************************************************************** | 63 | /*********************************************************************** |
61 | * | 64 | * |
@@ -63,9 +66,11 @@ namespace OpenSim.DataStore.MonoSqlite | |||
63 | * | 66 | * |
64 | **********************************************************************/ | 67 | **********************************************************************/ |
65 | 68 | ||
66 | public void Initialise(string connectionString) | 69 | // see IRegionDataStore |
70 | public void Initialise(string connectionString, bool persistPrimInventories) | ||
67 | { | 71 | { |
68 | m_connectionString = connectionString; | 72 | m_connectionString = connectionString; |
73 | this.persistPrimInventories = persistPrimInventories; | ||
69 | 74 | ||
70 | ds = new DataSet(); | 75 | ds = new DataSet(); |
71 | 76 | ||
@@ -601,10 +606,40 @@ namespace OpenSim.DataStore.MonoSqlite | |||
601 | createCol(shapes, "Texture", typeof (Byte[])); | 606 | createCol(shapes, "Texture", typeof (Byte[])); |
602 | createCol(shapes, "ExtraParams", typeof (Byte[])); | 607 | createCol(shapes, "ExtraParams", typeof (Byte[])); |
603 | 608 | ||
604 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; | 609 | shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; |
605 | 610 | ||
606 | return shapes; | 611 | return shapes; |
607 | } | 612 | } |
613 | |||
614 | private DataTable createItemsTable() | ||
615 | { | ||
616 | DataTable items = new DataTable("primitems"); | ||
617 | |||
618 | createCol(items, "UUID", typeof (String)); | ||
619 | createCol(items, "invType", typeof (Int32)); | ||
620 | createCol(items, "assetID", typeof (String)); | ||
621 | createCol(items, "assetType", typeof (Int32)); | ||
622 | createCol(items, "parentFolderID", typeof (String)); | ||
623 | |||
624 | createCol(items, "name", typeof (String)); | ||
625 | createCol(items, "description", typeof (String)); | ||
626 | |||
627 | createCol(items, "creationDate", typeof (Int64)); | ||
628 | createCol(items, "creatorID", typeof (String)); | ||
629 | createCol(items, "ownerID", typeof (String)); | ||
630 | createCol(items, "lastOwnerID", typeof (String)); | ||
631 | createCol(items, "groupID", typeof (String)); | ||
632 | |||
633 | createCol(items, "nextPermissions", typeof (Int32)); | ||
634 | createCol(items, "currentPermissions", typeof (Int32)); | ||
635 | createCol(items, "basePermissions", typeof (Int32)); | ||
636 | createCol(items, "everyonePermissions", typeof (Int32)); | ||
637 | createCol(items, "groupPermissions", typeof (Int32)); | ||
638 | |||
639 | items.PrimaryKey = new DataColumn[] { items.Columns["UUID"] }; | ||
640 | |||
641 | return items; | ||
642 | } | ||
608 | 643 | ||
609 | private DataTable createLandTable() | 644 | private DataTable createLandTable() |
610 | { | 645 | { |
@@ -1192,16 +1227,22 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1192 | da.DeleteCommand = delete; | 1227 | da.DeleteCommand = delete; |
1193 | } | 1228 | } |
1194 | 1229 | ||
1230 | /// <summary> | ||
1231 | /// Create the necessary database tables. | ||
1232 | /// </summary> | ||
1233 | /// <param name="conn"></param> | ||
1195 | private void InitDB(SqliteConnection conn) | 1234 | private void InitDB(SqliteConnection conn) |
1196 | { | 1235 | { |
1197 | string createPrims = defineTable(createPrimTable()); | 1236 | string createPrims = defineTable(createPrimTable()); |
1198 | string createShapes = defineTable(createShapeTable()); | 1237 | string createShapes = defineTable(createShapeTable()); |
1238 | string createItems = defineTable(createItemsTable()); | ||
1199 | string createTerrain = defineTable(createTerrainTable()); | 1239 | string createTerrain = defineTable(createTerrainTable()); |
1200 | string createLand = defineTable(createLandTable()); | 1240 | string createLand = defineTable(createLandTable()); |
1201 | string createLandAccessList = defineTable(createLandAccessListTable()); | 1241 | string createLandAccessList = defineTable(createLandAccessListTable()); |
1202 | 1242 | ||
1203 | SqliteCommand pcmd = new SqliteCommand(createPrims, conn); | 1243 | SqliteCommand pcmd = new SqliteCommand(createPrims, conn); |
1204 | SqliteCommand scmd = new SqliteCommand(createShapes, conn); | 1244 | SqliteCommand scmd = new SqliteCommand(createShapes, conn); |
1245 | SqliteCommand icmd = new SqliteCommand(createItems, conn); | ||
1205 | SqliteCommand tcmd = new SqliteCommand(createTerrain, conn); | 1246 | SqliteCommand tcmd = new SqliteCommand(createTerrain, conn); |
1206 | SqliteCommand lcmd = new SqliteCommand(createLand, conn); | 1247 | SqliteCommand lcmd = new SqliteCommand(createLand, conn); |
1207 | SqliteCommand lalcmd = new SqliteCommand(createLandAccessList, conn); | 1248 | SqliteCommand lalcmd = new SqliteCommand(createLandAccessList, conn); |
@@ -1225,6 +1266,18 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1225 | { | 1266 | { |
1226 | MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists"); | 1267 | MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists"); |
1227 | } | 1268 | } |
1269 | |||
1270 | if (persistPrimInventories) | ||
1271 | { | ||
1272 | try | ||
1273 | { | ||
1274 | icmd.ExecuteNonQuery(); | ||
1275 | } | ||
1276 | catch (SqliteSyntaxException) | ||
1277 | { | ||
1278 | MainLog.Instance.Warn("SQLITE", "Primitives Inventory Table Already Exists"); | ||
1279 | } | ||
1280 | } | ||
1228 | 1281 | ||
1229 | try | 1282 | try |
1230 | { | 1283 | { |
@@ -1259,12 +1312,19 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1259 | { | 1312 | { |
1260 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); | 1313 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); |
1261 | SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd); | 1314 | SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd); |
1315 | |||
1262 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); | 1316 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); |
1263 | SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd); | 1317 | SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd); |
1318 | |||
1319 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, conn); | ||
1320 | SqliteDataAdapter iDa = new SqliteDataAdapter(itemsSelectCmd); | ||
1321 | |||
1264 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn); | 1322 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn); |
1265 | SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd); | 1323 | SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd); |
1324 | |||
1266 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn); | 1325 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn); |
1267 | SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd); | 1326 | SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd); |
1327 | |||
1268 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn); | 1328 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn); |
1269 | SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd); | 1329 | SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd); |
1270 | 1330 | ||
@@ -1273,6 +1333,10 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1273 | { | 1333 | { |
1274 | pDa.Fill(tmpDS, "prims"); | 1334 | pDa.Fill(tmpDS, "prims"); |
1275 | sDa.Fill(tmpDS, "primshapes"); | 1335 | sDa.Fill(tmpDS, "primshapes"); |
1336 | |||
1337 | if (persistPrimInventories) | ||
1338 | iDa.Fill(tmpDS, "primitems"); | ||
1339 | |||
1276 | tDa.Fill(tmpDS, "terrain"); | 1340 | tDa.Fill(tmpDS, "terrain"); |
1277 | lDa.Fill(tmpDS, "land"); | 1341 | lDa.Fill(tmpDS, "land"); |
1278 | lalDa.Fill(tmpDS, "landaccesslist"); | 1342 | lalDa.Fill(tmpDS, "landaccesslist"); |
@@ -1285,6 +1349,10 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1285 | 1349 | ||
1286 | pDa.Fill(tmpDS, "prims"); | 1350 | pDa.Fill(tmpDS, "prims"); |
1287 | sDa.Fill(tmpDS, "primshapes"); | 1351 | sDa.Fill(tmpDS, "primshapes"); |
1352 | |||
1353 | if (persistPrimInventories) | ||
1354 | iDa.Fill(tmpDS, "primitems"); | ||
1355 | |||
1288 | tDa.Fill(tmpDS, "terrain"); | 1356 | tDa.Fill(tmpDS, "terrain"); |
1289 | lDa.Fill(tmpDS, "land"); | 1357 | lDa.Fill(tmpDS, "land"); |
1290 | lalDa.Fill(tmpDS,"landaccesslist"); | 1358 | lalDa.Fill(tmpDS,"landaccesslist"); |
@@ -1297,6 +1365,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1297 | return false; | 1365 | return false; |
1298 | } | 1366 | } |
1299 | } | 1367 | } |
1368 | |||
1300 | foreach (DataColumn col in createShapeTable().Columns) | 1369 | foreach (DataColumn col in createShapeTable().Columns) |
1301 | { | 1370 | { |
1302 | if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) | 1371 | if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) |
@@ -1305,6 +1374,9 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1305 | return false; | 1374 | return false; |
1306 | } | 1375 | } |
1307 | } | 1376 | } |
1377 | |||
1378 | // TODO Not restoring prim inventories quite yet | ||
1379 | |||
1308 | foreach (DataColumn col in createTerrainTable().Columns) | 1380 | foreach (DataColumn col in createTerrainTable().Columns) |
1309 | { | 1381 | { |
1310 | if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) | 1382 | if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) |
@@ -1313,6 +1385,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1313 | return false; | 1385 | return false; |
1314 | } | 1386 | } |
1315 | } | 1387 | } |
1388 | |||
1316 | foreach (DataColumn col in createLandTable().Columns) | 1389 | foreach (DataColumn col in createLandTable().Columns) |
1317 | { | 1390 | { |
1318 | if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) | 1391 | if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) |
@@ -1321,6 +1394,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1321 | return false; | 1394 | return false; |
1322 | } | 1395 | } |
1323 | } | 1396 | } |
1397 | |||
1324 | foreach (DataColumn col in createLandAccessListTable().Columns) | 1398 | foreach (DataColumn col in createLandAccessListTable().Columns) |
1325 | { | 1399 | { |
1326 | if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) | 1400 | if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) |
@@ -1329,6 +1403,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1329 | return false; | 1403 | return false; |
1330 | } | 1404 | } |
1331 | } | 1405 | } |
1406 | |||
1332 | return true; | 1407 | return true; |
1333 | } | 1408 | } |
1334 | 1409 | ||
@@ -1382,6 +1457,10 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1382 | { | 1457 | { |
1383 | return "integer"; | 1458 | return "integer"; |
1384 | } | 1459 | } |
1460 | else if (type == typeof (Int64)) | ||
1461 | { | ||
1462 | return "integer"; | ||
1463 | } | ||
1385 | else if (type == typeof (Double)) | 1464 | else if (type == typeof (Double)) |
1386 | { | 1465 | { |
1387 | return "float"; | 1466 | return "float"; |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index 158912b..da05018 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.DataStore.NullStorage | |||
36 | { | 36 | { |
37 | public class NullDataStore : IRegionDataStore | 37 | public class NullDataStore : IRegionDataStore |
38 | { | 38 | { |
39 | public void Initialise(string dbfile) | 39 | public void Initialise(string dbfile, bool persistPrimInventories) |
40 | { | 40 | { |
41 | return; | 41 | return; |
42 | } | 42 | } |