aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLDataStore.cs
diff options
context:
space:
mode:
authorJeff Ames2008-05-16 01:22:11 +0000
committerJeff Ames2008-05-16 01:22:11 +0000
commit65c5efe43b68700bad94076d4cd421160203c5de (patch)
tree589b56649ed02f4942671fd6e51c6dc43f682e0d /OpenSim/Data/MySQL/MySQLDataStore.cs
parentThank you very much, mjm for : (diff)
downloadopensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.zip
opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.gz
opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.bz2
opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLDataStore.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLDataStore.cs184
1 files changed, 92 insertions, 92 deletions
diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs
index ac0d382..3c39a5e 100644
--- a/OpenSim/Data/MySQL/MySQLDataStore.cs
+++ b/OpenSim/Data/MySQL/MySQLDataStore.cs
@@ -50,12 +50,12 @@ namespace OpenSim.Data.MySQL
50 private const string m_terrainSelect = "select * from terrain limit 1"; 50 private const string m_terrainSelect = "select * from terrain limit 1";
51 private const string m_landSelect = "select * from land"; 51 private const string m_landSelect = "select * from land";
52 private const string m_landAccessListSelect = "select * from landaccesslist"; 52 private const string m_landAccessListSelect = "select * from landaccesslist";
53 53
54 54
55 /// <summary> 55 /// <summary>
56 /// We're only using this to version the table! 56 /// We're only using this to version the table!
57 /// </summary> 57 /// </summary>
58 58
59 59
60 private DataSet m_dataSet; 60 private DataSet m_dataSet;
61 private MySqlDataAdapter m_primDataAdapter; 61 private MySqlDataAdapter m_primDataAdapter;
@@ -65,16 +65,16 @@ namespace OpenSim.Data.MySQL
65 private MySqlDataAdapter m_terrainDataAdapter; 65 private MySqlDataAdapter m_terrainDataAdapter;
66 private MySqlDataAdapter m_landDataAdapter; 66 private MySqlDataAdapter m_landDataAdapter;
67 private MySqlDataAdapter m_landAccessListDataAdapter; 67 private MySqlDataAdapter m_landAccessListDataAdapter;
68 68
69 private DataTable m_primTable; 69 private DataTable m_primTable;
70 private DataTable m_shapeTable; 70 private DataTable m_shapeTable;
71 private DataTable m_itemsTable; 71 private DataTable m_itemsTable;
72 private DataTable m_terrainTable; 72 private DataTable m_terrainTable;
73 private DataTable m_landTable; 73 private DataTable m_landTable;
74 private DataTable m_landAccessListTable; 74 private DataTable m_landAccessListTable;
75 75
76 // Temporary attribute while this is experimental 76 // Temporary attribute while this is experimental
77 private bool persistPrimInventories; 77 private bool persistPrimInventories;
78 78
79 /*********************************************************************** 79 /***********************************************************************
80 * 80 *
@@ -98,9 +98,9 @@ namespace OpenSim.Data.MySQL
98 98
99 MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, m_connection); 99 MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, m_connection);
100 m_shapeDataAdapter = new MySqlDataAdapter(shapeSelectCmd); 100 m_shapeDataAdapter = new MySqlDataAdapter(shapeSelectCmd);
101 101
102 MySqlCommand itemsSelectCmd = new MySqlCommand(m_itemsSelect, m_connection); 102 MySqlCommand itemsSelectCmd = new MySqlCommand(m_itemsSelect, m_connection);
103 m_itemsDataAdapter = new MySqlDataAdapter(itemsSelectCmd); 103 m_itemsDataAdapter = new MySqlDataAdapter(itemsSelectCmd);
104 104
105 MySqlCommand terrainSelectCmd = new MySqlCommand(m_terrainSelect, m_connection); 105 MySqlCommand terrainSelectCmd = new MySqlCommand(m_terrainSelect, m_connection);
106 m_terrainDataAdapter = new MySqlDataAdapter(terrainSelectCmd); 106 m_terrainDataAdapter = new MySqlDataAdapter(terrainSelectCmd);
@@ -111,7 +111,7 @@ namespace OpenSim.Data.MySQL
111 MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection); 111 MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection);
112 m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd); 112 m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd);
113 113
114 114
115 TestTables(m_connection); 115 TestTables(m_connection);
116 116
117 lock (m_dataSet) 117 lock (m_dataSet)
@@ -125,13 +125,13 @@ namespace OpenSim.Data.MySQL
125 m_dataSet.Tables.Add(m_shapeTable); 125 m_dataSet.Tables.Add(m_shapeTable);
126 SetupShapeCommands(m_shapeDataAdapter, m_connection); 126 SetupShapeCommands(m_shapeDataAdapter, m_connection);
127 m_shapeDataAdapter.Fill(m_shapeTable); 127 m_shapeDataAdapter.Fill(m_shapeTable);
128 128
129 if (persistPrimInventories) 129 if (persistPrimInventories)
130 { 130 {
131 m_itemsTable = createItemsTable(); 131 m_itemsTable = createItemsTable();
132 m_dataSet.Tables.Add(m_itemsTable); 132 m_dataSet.Tables.Add(m_itemsTable);
133 SetupItemsCommands(m_itemsDataAdapter, m_connection); 133 SetupItemsCommands(m_itemsDataAdapter, m_connection);
134 m_itemsDataAdapter.Fill(m_itemsTable); 134 m_itemsDataAdapter.Fill(m_itemsTable);
135 } 135 }
136 136
137 m_terrainTable = createTerrainTable(); 137 m_terrainTable = createTerrainTable();
@@ -195,7 +195,7 @@ namespace OpenSim.Data.MySQL
195 195
196 UpgradeLandTable(tableList["land"], dbconn); 196 UpgradeLandTable(tableList["land"], dbconn);
197 //database.Close(); 197 //database.Close();
198 198
199 } 199 }
200 200
201 /// <summary> 201 /// <summary>
@@ -290,12 +290,12 @@ namespace OpenSim.Data.MySQL
290 { 290 {
291 shapeRow.Delete(); 291 shapeRow.Delete();
292 } 292 }
293 293
294 if (persistPrimInventories) 294 if (persistPrimInventories)
295 { 295 {
296 RemoveItems(uuid); 296 RemoveItems(uuid);
297 } 297 }
298 298
299 // Remove prim row 299 // Remove prim row
300 row.Delete(); 300 row.Delete();
301 } 301 }
@@ -309,18 +309,18 @@ namespace OpenSim.Data.MySQL
309 /// </summary> 309 /// </summary>
310 private void RemoveItems(LLUUID uuid) 310 private void RemoveItems(LLUUID uuid)
311 { 311 {
312 String sql = String.Format("primID = '{0}'", uuid); 312 String sql = String.Format("primID = '{0}'", uuid);
313 DataRow[] itemRows = m_itemsTable.Select(sql); 313 DataRow[] itemRows = m_itemsTable.Select(sql);
314 314
315 foreach (DataRow itemRow in itemRows) 315 foreach (DataRow itemRow in itemRows)
316 { 316 {
317 itemRow.Delete(); 317 itemRow.Delete();
318 } 318 }
319 } 319 }
320 320
321 /// <summary> 321 /// <summary>
322 /// Load persisted objects from region storage. 322 /// Load persisted objects from region storage.
323 /// </summary> 323 /// </summary>
324 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) 324 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
325 { 325 {
326 Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>(); 326 Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>();
@@ -341,17 +341,17 @@ namespace OpenSim.Data.MySQL
341 341
342 foreach (DataRow primRow in primsForRegion) 342 foreach (DataRow primRow in primsForRegion)
343 { 343 {
344 try 344 try
345 { 345 {
346 string uuid = (string) primRow["UUID"]; 346 string uuid = (string) primRow["UUID"];
347 string objID = (string) primRow["SceneGroupID"]; 347 string objID = (string) primRow["SceneGroupID"];
348 348
349 SceneObjectPart prim = buildPrim(primRow); 349 SceneObjectPart prim = buildPrim(primRow);
350 350
351 if (uuid == objID) //is new SceneObjectGroup ? 351 if (uuid == objID) //is new SceneObjectGroup ?
352 { 352 {
353 SceneObjectGroup group = new SceneObjectGroup(); 353 SceneObjectGroup group = new SceneObjectGroup();
354 354
355 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); 355 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
356 if (shapeRow != null) 356 if (shapeRow != null)
357 { 357 {
@@ -384,11 +384,11 @@ namespace OpenSim.Data.MySQL
384 } 384 }
385 createdObjects[new LLUUID(objID)].AddPart(prim); 385 createdObjects[new LLUUID(objID)].AddPart(prim);
386 } 386 }
387 387
388 if (persistPrimInventories) 388 if (persistPrimInventories)
389 { 389 {
390 LoadItems(prim); 390 LoadItems(prim);
391 } 391 }
392 } 392 }
393 catch (Exception e) 393 catch (Exception e)
394 { 394 {
@@ -403,7 +403,7 @@ namespace OpenSim.Data.MySQL
403 } 403 }
404 return retvals; 404 return retvals;
405 } 405 }
406 406
407 /// <summary> 407 /// <summary>
408 /// Load in a prim's persisted inventory. 408 /// Load in a prim's persisted inventory.
409 /// </summary> 409 /// </summary>
@@ -411,31 +411,31 @@ namespace OpenSim.Data.MySQL
411 private void LoadItems(SceneObjectPart prim) 411 private void LoadItems(SceneObjectPart prim)
412 { 412 {
413 //m_log.InfoFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); 413 //m_log.InfoFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
414 414
415 DataTable dbItems = m_itemsTable; 415 DataTable dbItems = m_itemsTable;
416 416
417 String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); 417 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
418 DataRow[] dbItemRows = dbItems.Select(sql); 418 DataRow[] dbItemRows = dbItems.Select(sql);
419 419
420 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 420 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
421 421
422 foreach (DataRow row in dbItemRows) 422 foreach (DataRow row in dbItemRows)
423 { 423 {
424 TaskInventoryItem item = buildItem(row); 424 TaskInventoryItem item = buildItem(row);
425 inventory.Add(item); 425 inventory.Add(item);
426 426
427 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); 427 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
428 } 428 }
429 429
430 prim.RestoreInventoryItems(inventory); 430 prim.RestoreInventoryItems(inventory);
431 431
432 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in 432 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in
433 // every item). This data should really be stored in the prim table itself. 433 // every item). This data should really be stored in the prim table itself.
434 if (dbItemRows.Length > 0) 434 if (dbItemRows.Length > 0)
435 { 435 {
436 prim.FolderID = inventory[0].ParentID; 436 prim.FolderID = inventory[0].ParentID;
437 } 437 }
438 } 438 }
439 439
440 public void StoreTerrain(double[,] ter, LLUUID regionID) 440 public void StoreTerrain(double[,] ter, LLUUID regionID)
441 { 441 {
@@ -474,8 +474,8 @@ namespace OpenSim.Data.MySQL
474 { 474 {
475 m_connection.Open(); 475 m_connection.Open();
476 } 476 }
477 477
478 lock (m_dataSet) 478 lock (m_dataSet)
479 { 479 {
480 using (MySqlDataReader row = cmd.ExecuteReader()) 480 using (MySqlDataReader row = cmd.ExecuteReader())
481 { 481 {
@@ -498,7 +498,7 @@ namespace OpenSim.Data.MySQL
498 m_log.Info("[REGION DB]: No terrain found for region"); 498 m_log.Info("[REGION DB]: No terrain found for region");
499 return null; 499 return null;
500 } 500 }
501 501
502 m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); 502 m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString());
503 } 503 }
504 } 504 }
@@ -558,7 +558,7 @@ namespace OpenSim.Data.MySQL
558 fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID); 558 fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID);
559 landaccesslist.Rows.Add(newAccessRow); 559 landaccesslist.Rows.Add(newAccessRow);
560 } 560 }
561 561
562 Commit(); 562 Commit();
563 } 563 }
564 } 564 }
@@ -624,7 +624,7 @@ namespace OpenSim.Data.MySQL
624 /*********************************************************************** 624 /***********************************************************************
625 * 625 *
626 * Database Definition Functions 626 * Database Definition Functions
627 * 627 *
628 * This should be db agnostic as we define them in ADO.NET terms 628 * This should be db agnostic as we define them in ADO.NET terms
629 * 629 *
630 **********************************************************************/ 630 **********************************************************************/
@@ -803,7 +803,7 @@ namespace OpenSim.Data.MySQL
803 803
804 return shapes; 804 return shapes;
805 } 805 }
806 806
807 private static DataTable createItemsTable() 807 private static DataTable createItemsTable()
808 { 808 {
809 DataTable items = new DataTable("primitems"); 809 DataTable items = new DataTable("primitems");
@@ -812,8 +812,8 @@ namespace OpenSim.Data.MySQL
812 createCol(items, "primID", typeof (String)); 812 createCol(items, "primID", typeof (String));
813 createCol(items, "assetID", typeof (String)); 813 createCol(items, "assetID", typeof (String));
814 createCol(items, "parentFolderID", typeof (String)); 814 createCol(items, "parentFolderID", typeof (String));
815 815
816 createCol(items, "invType", typeof (Int32)); 816 createCol(items, "invType", typeof (Int32));
817 createCol(items, "assetType", typeof (Int32)); 817 createCol(items, "assetType", typeof (Int32));
818 818
819 createCol(items, "name", typeof (String)); 819 createCol(items, "name", typeof (String));
@@ -834,10 +834,10 @@ namespace OpenSim.Data.MySQL
834 items.PrimaryKey = new DataColumn[] {items.Columns["itemID"]}; 834 items.PrimaryKey = new DataColumn[] {items.Columns["itemID"]};
835 835
836 return items; 836 return items;
837 } 837 }
838 838
839 /*********************************************************************** 839 /***********************************************************************
840 * 840 *
841 * Convert between ADO.NET <=> OpenSim Objects 841 * Convert between ADO.NET <=> OpenSim Objects
842 * 842 *
843 * These should be database independant 843 * These should be database independant
@@ -932,8 +932,8 @@ namespace OpenSim.Data.MySQL
932 } 932 }
933 return prim; 933 return prim;
934 } 934 }
935 935
936 936
937 /// <summary> 937 /// <summary>
938 /// Build a prim inventory item from the persisted data. 938 /// Build a prim inventory item from the persisted data.
939 /// </summary> 939 /// </summary>
@@ -942,15 +942,15 @@ namespace OpenSim.Data.MySQL
942 private static TaskInventoryItem buildItem(DataRow row) 942 private static TaskInventoryItem buildItem(DataRow row)
943 { 943 {
944 TaskInventoryItem taskItem = new TaskInventoryItem(); 944 TaskInventoryItem taskItem = new TaskInventoryItem();
945 945
946 taskItem.ItemID = new LLUUID((String)row["itemID"]); 946 taskItem.ItemID = new LLUUID((String)row["itemID"]);
947 taskItem.ParentPartID = new LLUUID((String)row["primID"]); 947 taskItem.ParentPartID = new LLUUID((String)row["primID"]);
948 taskItem.AssetID = new LLUUID((String)row["assetID"]); 948 taskItem.AssetID = new LLUUID((String)row["assetID"]);
949 taskItem.ParentID = new LLUUID((String)row["parentFolderID"]); 949 taskItem.ParentID = new LLUUID((String)row["parentFolderID"]);
950 950
951 taskItem.InvType = Convert.ToInt32(row["invType"]); 951 taskItem.InvType = Convert.ToInt32(row["invType"]);
952 taskItem.Type = Convert.ToInt32(row["assetType"]); 952 taskItem.Type = Convert.ToInt32(row["assetType"]);
953 953
954 taskItem.Name = (String)row["name"]; 954 taskItem.Name = (String)row["name"];
955 taskItem.Description = (String)row["description"]; 955 taskItem.Description = (String)row["description"];
956 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); 956 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
@@ -958,15 +958,15 @@ namespace OpenSim.Data.MySQL
958 taskItem.OwnerID = new LLUUID((String)row["ownerID"]); 958 taskItem.OwnerID = new LLUUID((String)row["ownerID"]);
959 taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]); 959 taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]);
960 taskItem.GroupID = new LLUUID((String)row["groupID"]); 960 taskItem.GroupID = new LLUUID((String)row["groupID"]);
961 961
962 taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]); 962 taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]);
963 taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]); 963 taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]);
964 taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]); 964 taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]);
965 taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]); 965 taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]);
966 taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]); 966 taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]);
967 967
968 return taskItem; 968 return taskItem;
969 } 969 }
970 970
971 private static LandData buildLandData(DataRow row) 971 private static LandData buildLandData(DataRow row)
972 { 972 {
@@ -1117,17 +1117,17 @@ namespace OpenSim.Data.MySQL
1117 } 1117 }
1118 } 1118 }
1119 } 1119 }
1120 1120
1121 private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) 1121 private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
1122 { 1122 {
1123 row["itemID"] = taskItem.ItemID; 1123 row["itemID"] = taskItem.ItemID;
1124 row["primID"] = taskItem.ParentPartID; 1124 row["primID"] = taskItem.ParentPartID;
1125 row["assetID"] = taskItem.AssetID; 1125 row["assetID"] = taskItem.AssetID;
1126 row["parentFolderID"] = taskItem.ParentID; 1126 row["parentFolderID"] = taskItem.ParentID;
1127 1127
1128 row["invType"] = taskItem.InvType; 1128 row["invType"] = taskItem.InvType;
1129 row["assetType"] = taskItem.Type; 1129 row["assetType"] = taskItem.Type;
1130 1130
1131 row["name"] = taskItem.Name; 1131 row["name"] = taskItem.Name;
1132 row["description"] = taskItem.Description; 1132 row["description"] = taskItem.Description;
1133 row["creationDate"] = taskItem.CreationDate; 1133 row["creationDate"] = taskItem.CreationDate;
@@ -1140,7 +1140,7 @@ namespace OpenSim.Data.MySQL
1140 row["basePermissions"] = taskItem.BaseMask; 1140 row["basePermissions"] = taskItem.BaseMask;
1141 row["everyonePermissions"] = taskItem.EveryoneMask; 1141 row["everyonePermissions"] = taskItem.EveryoneMask;
1142 row["groupPermissions"] = taskItem.GroupMask; 1142 row["groupPermissions"] = taskItem.GroupMask;
1143 } 1143 }
1144 1144
1145 private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) 1145 private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
1146 { 1146 {
@@ -1322,39 +1322,39 @@ namespace OpenSim.Data.MySQL
1322 else 1322 else
1323 { 1323 {
1324 fillShapeRow(shapeRow, prim); 1324 fillShapeRow(shapeRow, prim);
1325 } 1325 }
1326 } 1326 }
1327 1327
1328 // see IRegionDatastore 1328 // see IRegionDatastore
1329 public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) 1329 public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
1330 { 1330 {
1331 if (!persistPrimInventories) 1331 if (!persistPrimInventories)
1332 return; 1332 return;
1333 1333
1334 m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID); 1334 m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID);
1335 1335
1336 // For now, we're just going to crudely remove all the previous inventory items 1336 // For now, we're just going to crudely remove all the previous inventory items
1337 // no matter whether they have changed or not, and replace them with the current set. 1337 // no matter whether they have changed or not, and replace them with the current set.
1338 lock (m_dataSet) 1338 lock (m_dataSet)
1339 { 1339 {
1340 RemoveItems(primID); 1340 RemoveItems(primID);
1341 1341
1342 // repalce with current inventory details 1342 // repalce with current inventory details
1343 foreach (TaskInventoryItem newItem in items) 1343 foreach (TaskInventoryItem newItem in items)
1344 { 1344 {
1345// m_log.InfoFormat( 1345// m_log.InfoFormat(
1346// "[REGION DB]: " + 1346// "[REGION DB]: " +
1347// "Adding item {0}, {1} to prim ID {2}", 1347// "Adding item {0}, {1} to prim ID {2}",
1348// newItem.Name, newItem.ItemID, newItem.ParentPartID); 1348// newItem.Name, newItem.ItemID, newItem.ParentPartID);
1349 1349
1350 DataRow newItemRow = m_itemsTable.NewRow(); 1350 DataRow newItemRow = m_itemsTable.NewRow();
1351 fillItemRow(newItemRow, newItem); 1351 fillItemRow(newItemRow, newItem);
1352 m_itemsTable.Rows.Add(newItemRow); 1352 m_itemsTable.Rows.Add(newItemRow);
1353 } 1353 }
1354 } 1354 }
1355 1355
1356 Commit(); 1356 Commit();
1357 } 1357 }
1358 1358
1359 /*********************************************************************** 1359 /***********************************************************************
1360 * 1360 *
@@ -1447,9 +1447,9 @@ namespace OpenSim.Data.MySQL
1447 } 1447 }
1448 sql += subsql; 1448 sql += subsql;
1449 sql += ")"; 1449 sql += ")";
1450 1450
1451 //m_log.InfoFormat("[DATASTORE]: defineTable() sql {0}", sql); 1451 //m_log.InfoFormat("[DATASTORE]: defineTable() sql {0}", sql);
1452 1452
1453 return sql; 1453 return sql;
1454 } 1454 }
1455 1455
@@ -1466,7 +1466,7 @@ namespace OpenSim.Data.MySQL
1466 /// This is a convenience function that collapses 5 repetitive 1466 /// This is a convenience function that collapses 5 repetitive
1467 /// lines for defining MySqlParameters to 2 parameters: 1467 /// lines for defining MySqlParameters to 2 parameters:
1468 /// column name and database type. 1468 /// column name and database type.
1469 /// 1469 ///
1470 /// It assumes certain conventions like ?param as the param 1470 /// It assumes certain conventions like ?param as the param
1471 /// name to replace in parametrized queries, and that source 1471 /// name to replace in parametrized queries, and that source
1472 /// version is always current version, both of which are fine 1472 /// version is always current version, both of which are fine
@@ -1498,7 +1498,7 @@ namespace OpenSim.Data.MySQL
1498 delete.Connection = conn; 1498 delete.Connection = conn;
1499 da.DeleteCommand = delete; 1499 da.DeleteCommand = delete;
1500 } 1500 }
1501 1501
1502 private void SetupItemsCommands(MySqlDataAdapter da, MySqlConnection conn) 1502 private void SetupItemsCommands(MySqlDataAdapter da, MySqlConnection conn)
1503 { 1503 {
1504 da.InsertCommand = createInsertCommand("primitems", m_itemsTable); 1504 da.InsertCommand = createInsertCommand("primitems", m_itemsTable);
@@ -1511,7 +1511,7 @@ namespace OpenSim.Data.MySQL
1511 delete.Parameters.Add(createMySqlParameter("itemID", typeof (String))); 1511 delete.Parameters.Add(createMySqlParameter("itemID", typeof (String)));
1512 delete.Connection = conn; 1512 delete.Connection = conn;
1513 da.DeleteCommand = delete; 1513 da.DeleteCommand = delete;
1514 } 1514 }
1515 1515
1516 private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn) 1516 private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn)
1517 { 1517 {
@@ -1597,7 +1597,7 @@ namespace OpenSim.Data.MySQL
1597 { 1597 {
1598 m_log.WarnFormat("[REGION DB]: Shapes Table Already Exists: {0}", e); 1598 m_log.WarnFormat("[REGION DB]: Shapes Table Already Exists: {0}", e);
1599 } 1599 }
1600 1600
1601 try 1601 try
1602 { 1602 {
1603 icmd.ExecuteNonQuery(); 1603 icmd.ExecuteNonQuery();
@@ -1605,7 +1605,7 @@ namespace OpenSim.Data.MySQL
1605 catch (MySqlException e) 1605 catch (MySqlException e)
1606 { 1606 {
1607 m_log.WarnFormat("[REGION DB]: Items Table Already Exists: {0}", e); 1607 m_log.WarnFormat("[REGION DB]: Items Table Already Exists: {0}", e);
1608 } 1608 }
1609 1609
1610 try 1610 try
1611 { 1611 {
@@ -1643,7 +1643,7 @@ namespace OpenSim.Data.MySQL
1643 MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, conn); 1643 MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, conn);
1644 MySqlDataAdapter sDa = new MySqlDataAdapter(shapeSelectCmd); 1644 MySqlDataAdapter sDa = new MySqlDataAdapter(shapeSelectCmd);
1645 MySqlCommand itemsSelectCmd = new MySqlCommand(m_itemsSelect, conn); 1645 MySqlCommand itemsSelectCmd = new MySqlCommand(m_itemsSelect, conn);
1646 MySqlDataAdapter iDa = new MySqlDataAdapter(itemsSelectCmd); 1646 MySqlDataAdapter iDa = new MySqlDataAdapter(itemsSelectCmd);
1647 MySqlCommand terrainSelectCmd = new MySqlCommand(m_terrainSelect, conn); 1647 MySqlCommand terrainSelectCmd = new MySqlCommand(m_terrainSelect, conn);
1648 MySqlDataAdapter tDa = new MySqlDataAdapter(terrainSelectCmd); 1648 MySqlDataAdapter tDa = new MySqlDataAdapter(terrainSelectCmd);
1649 MySqlCommand landSelectCmd = new MySqlCommand(m_landSelect, conn); 1649 MySqlCommand landSelectCmd = new MySqlCommand(m_landSelect, conn);
@@ -1656,10 +1656,10 @@ namespace OpenSim.Data.MySQL
1656 { 1656 {
1657 pDa.Fill(tmpDS, "prims"); 1657 pDa.Fill(tmpDS, "prims");
1658 sDa.Fill(tmpDS, "primshapes"); 1658 sDa.Fill(tmpDS, "primshapes");
1659 1659
1660 if (persistPrimInventories) 1660 if (persistPrimInventories)
1661 iDa.Fill(tmpDS, "primitems"); 1661 iDa.Fill(tmpDS, "primitems");
1662 1662
1663 tDa.Fill(tmpDS, "terrain"); 1663 tDa.Fill(tmpDS, "terrain");
1664 lDa.Fill(tmpDS, "land"); 1664 lDa.Fill(tmpDS, "land");
1665 lalDa.Fill(tmpDS, "landaccesslist"); 1665 lalDa.Fill(tmpDS, "landaccesslist");
@@ -1672,10 +1672,10 @@ namespace OpenSim.Data.MySQL
1672 1672
1673 pDa.Fill(tmpDS, "prims"); 1673 pDa.Fill(tmpDS, "prims");
1674 sDa.Fill(tmpDS, "primshapes"); 1674 sDa.Fill(tmpDS, "primshapes");
1675 1675
1676 if (persistPrimInventories) 1676 if (persistPrimInventories)
1677 iDa.Fill(tmpDS, "primitems"); 1677 iDa.Fill(tmpDS, "primitems");
1678 1678
1679 tDa.Fill(tmpDS, "terrain"); 1679 tDa.Fill(tmpDS, "terrain");
1680 lDa.Fill(tmpDS, "land"); 1680 lDa.Fill(tmpDS, "land");
1681 lalDa.Fill(tmpDS, "landaccesslist"); 1681 lalDa.Fill(tmpDS, "landaccesslist");
@@ -1688,7 +1688,7 @@ namespace OpenSim.Data.MySQL
1688 return false; 1688 return false;
1689 } 1689 }
1690 } 1690 }
1691 1691
1692 foreach (DataColumn col in createShapeTable().Columns) 1692 foreach (DataColumn col in createShapeTable().Columns)
1693 { 1693 {
1694 if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) 1694 if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName))
@@ -1697,9 +1697,9 @@ namespace OpenSim.Data.MySQL
1697 return false; 1697 return false;
1698 } 1698 }
1699 } 1699 }
1700 1700
1701 // XXX primitems should probably go here eventually 1701 // XXX primitems should probably go here eventually
1702 1702
1703 foreach (DataColumn col in createTerrainTable().Columns) 1703 foreach (DataColumn col in createTerrainTable().Columns)
1704 { 1704 {
1705 if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) 1705 if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName))
@@ -1708,7 +1708,7 @@ namespace OpenSim.Data.MySQL
1708 return false; 1708 return false;
1709 } 1709 }
1710 } 1710 }
1711 1711
1712 foreach (DataColumn col in createLandTable().Columns) 1712 foreach (DataColumn col in createLandTable().Columns)
1713 { 1713 {
1714 if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) 1714 if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName))
@@ -1717,7 +1717,7 @@ namespace OpenSim.Data.MySQL
1717 return false; 1717 return false;
1718 } 1718 }
1719 } 1719 }
1720 1720
1721 foreach (DataColumn col in createLandAccessListTable().Columns) 1721 foreach (DataColumn col in createLandAccessListTable().Columns)
1722 { 1722 {
1723 if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) 1723 if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName))
@@ -1726,7 +1726,7 @@ namespace OpenSim.Data.MySQL
1726 return false; 1726 return false;
1727 } 1727 }
1728 } 1728 }
1729 1729
1730 return true; 1730 return true;
1731 } 1731 }
1732 1732
@@ -1783,7 +1783,7 @@ namespace OpenSim.Data.MySQL
1783 else if (type == typeof (Int64)) 1783 else if (type == typeof (Int64))
1784 { 1784 {
1785 return "bigint"; 1785 return "bigint";
1786 } 1786 }
1787 else if (type == typeof (Double)) 1787 else if (type == typeof (Double))
1788 { 1788 {
1789 return "float"; 1789 return "float";