aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs61
-rw-r--r--OpenSim/Data/MySQL/MySQLDataStore.cs259
-rw-r--r--OpenSim/Data/MySQL/MySQLGridData.cs16
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs57
4 files changed, 315 insertions, 78 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index a29e11b..a64a256 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -36,6 +36,9 @@ using OpenSim.Framework;
36 36
37namespace OpenSim.Data.MySQL 37namespace OpenSim.Data.MySQL
38{ 38{
39 /// <summary>
40 /// A MySQL Interface for the Asset Server
41 /// </summary>
39 internal class MySQLAssetData : AssetDataBase, IPlugin 42 internal class MySQLAssetData : AssetDataBase, IPlugin
40 { 43 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -45,12 +48,16 @@ namespace OpenSim.Data.MySQL
45 #region IPlugin Members 48 #region IPlugin Members
46 49
47 /// <summary> 50 /// <summary>
48 /// Initialises Asset interface 51 /// <para>Initialises Asset interface</para>
49 /// Loads and initialises the MySQL storage plugin 52 /// <para>
50 /// Warns and uses the obsolete mysql_connection.ini if connect string is empty. 53 /// <list type="bullet">
51 /// Check for migration 54 /// <item>Loads and initialises the MySQL storage plugin.</item>
55 /// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
56 /// <item>Check for migration</item>
57 /// </list>
58 /// </para>
52 /// </summary> 59 /// </summary>
53 /// <param name="connect">connect string.</param> 60 /// <param name="connect">connect string</param>
54 override public void Initialise(string connect) 61 override public void Initialise(string connect)
55 { 62 {
56 // TODO: This will let you pass in the connect string in 63 // TODO: This will let you pass in the connect string in
@@ -78,10 +85,16 @@ namespace OpenSim.Data.MySQL
78 } 85 }
79 86
80 /// <summary> 87 /// <summary>
81 /// uses the obsolete mysql_connection.ini 88 /// <para>Initialises Asset interface</para>
89 /// <para>
90 /// <list type="bullet">
91 /// <item>Loads and initialises the MySQL storage plugin</item>
92 /// <item>uses the obsolete mysql_connection.ini</item>
93 /// </list>
94 /// </para>
82 /// </summary> 95 /// </summary>
83 /// <param name="connect">connect string.</param> 96 /// <param name="connect">connect string</param>
84 /// <remarks>Probably deprecated and shouldn't be used</remarks> 97 /// <remarks>Probably DEPRECATED and shouldn't be used</remarks>
85 override public void Initialise() 98 override public void Initialise()
86 { 99 {
87 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 100 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
@@ -98,6 +111,13 @@ namespace OpenSim.Data.MySQL
98 111
99 #region IAssetProvider Members 112 #region IAssetProvider Members
100 113
114 /// <summary>
115 /// <list type="bullet">
116 /// <item>Execute CreateAssetsTable.sql if oldVersion == null</item>
117 /// <item>do nothing if oldVersion != null</item>
118 /// </list>
119 /// </summary>
120 /// <param name="oldVersion"></param>
101 private void UpgradeAssetsTable(string oldVersion) 121 private void UpgradeAssetsTable(string oldVersion)
102 { 122 {
103 // null as the version, indicates that the table didn't exist 123 // null as the version, indicates that the table didn't exist
@@ -112,6 +132,7 @@ namespace OpenSim.Data.MySQL
112 /// <summary> 132 /// <summary>
113 /// Ensure that the assets related tables exists and are at the latest version 133 /// Ensure that the assets related tables exists and are at the latest version
114 /// </summary> 134 /// </summary>
135 /// <param name="m"></param>
115 private void TestTables(Migration m) 136 private void TestTables(Migration m)
116 { 137 {
117 Dictionary<string, string> tableList = new Dictionary<string, string>(); 138 Dictionary<string, string> tableList = new Dictionary<string, string>();
@@ -129,10 +150,11 @@ namespace OpenSim.Data.MySQL
129 } 150 }
130 151
131 /// <summary> 152 /// <summary>
132 /// 153 /// Fetch Asset <paramref name="assetID"/> from database
133 /// </summary> 154 /// </summary>
134 /// <param name="assetID"></param> 155 /// <param name="assetID">Asset UUID to fetch</param>
135 /// <returns></returns> 156 /// <returns>Return the asset</returns>
157 /// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks>
136 override public AssetBase FetchAsset(LLUUID assetID) 158 override public AssetBase FetchAsset(LLUUID assetID)
137 { 159 {
138 AssetBase asset = null; 160 AssetBase asset = null;
@@ -175,9 +197,10 @@ namespace OpenSim.Data.MySQL
175 } 197 }
176 198
177 /// <summary> 199 /// <summary>
178 /// 200 /// Create an asset in database, or update it if existing.
179 /// </summary> 201 /// </summary>
180 /// <param name="asset"></param> 202 /// <param name="asset">Asset UUID to create</param>
203 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
181 override public void CreateAsset(AssetBase asset) 204 override public void CreateAsset(AssetBase asset)
182 { 205 {
183 lock (_dbConnection) 206 lock (_dbConnection)
@@ -224,19 +247,19 @@ namespace OpenSim.Data.MySQL
224 } 247 }
225 248
226 /// <summary> 249 /// <summary>
227 /// 250 /// Update a asset in database, see <see cref="CreateAsset"/>
228 /// </summary> 251 /// </summary>
229 /// <param name="asset"></param> 252 /// <param name="asset">Asset UUID to update</param>
230 override public void UpdateAsset(AssetBase asset) 253 override public void UpdateAsset(AssetBase asset)
231 { 254 {
232 CreateAsset(asset); 255 CreateAsset(asset);
233 } 256 }
234 257
235 /// <summary> 258 /// <summary>
236 /// 259 /// check if the asset UUID exist in database
237 /// </summary> 260 /// </summary>
238 /// <param name="uuid"></param> 261 /// <param name="uuid">The asset UUID</param>
239 /// <returns></returns> 262 /// <returns>true if exist.</returns>
240 override public bool ExistsAsset(LLUUID uuid) 263 override public bool ExistsAsset(LLUUID uuid)
241 { 264 {
242 bool assetExists = false; 265 bool assetExists = false;
@@ -285,7 +308,7 @@ namespace OpenSim.Data.MySQL
285 #endregion 308 #endregion
286 309
287 /// <summary> 310 /// <summary>
288 /// database provider version 311 /// Database provider version
289 /// </summary> 312 /// </summary>
290 override public string Version 313 override public string Version
291 { 314 {
diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs
index 2b4702b..aa4c111 100644
--- a/OpenSim/Data/MySQL/MySQLDataStore.cs
+++ b/OpenSim/Data/MySQL/MySQLDataStore.cs
@@ -40,6 +40,9 @@ using OpenSim.Region.Environment.Scenes;
40 40
41namespace OpenSim.Data.MySQL 41namespace OpenSim.Data.MySQL
42{ 42{
43 /// <summary>
44 /// A MySQL Interface for the Region Server
45 /// </summary>
43 public class MySQLDataStore : IRegionDataStore 46 public class MySQLDataStore : IRegionDataStore
44 { 47 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -76,7 +79,7 @@ namespace OpenSim.Data.MySQL
76 private DataTable m_landAccessListTable; 79 private DataTable m_landAccessListTable;
77 private DataTable m_regionBanListTable; 80 private DataTable m_regionBanListTable;
78 81
79 // Temporary attribute while this is experimental 82 /// <value>Temporary attribute while this is experimental</value>
80 private bool persistPrimInventories; 83 private bool persistPrimInventories;
81 84
82 /*********************************************************************** 85 /***********************************************************************
@@ -177,7 +180,8 @@ namespace OpenSim.Data.MySQL
177 /// <summary> 180 /// <summary>
178 /// Given a list of tables, return the version of the tables, as seen in the database 181 /// Given a list of tables, return the version of the tables, as seen in the database
179 /// </summary> 182 /// </summary>
180 /// <param name="tableList"></param> 183 /// <param name="tableList">The list of table</param>
184 /// <param name="dbcon">The database connection handler</param>
181 public void GetTableVersion(Dictionary<string, string> tableList, MySqlConnection dbcon) 185 public void GetTableVersion(Dictionary<string, string> tableList, MySqlConnection dbcon)
182 { 186 {
183 lock (dbcon) 187 lock (dbcon)
@@ -226,6 +230,7 @@ namespace OpenSim.Data.MySQL
226 /// Execute a SQL statement stored in a resource, as a string 230 /// Execute a SQL statement stored in a resource, as a string
227 /// </summary> 231 /// </summary>
228 /// <param name="name">the ressource name</param> 232 /// <param name="name">the ressource name</param>
233 /// <param name="dbcon">The database connection handler</param>
229 public void ExecuteResourceSql(string name, MySqlConnection dbcon) 234 public void ExecuteResourceSql(string name, MySqlConnection dbcon)
230 { 235 {
231 MySqlCommand cmd = new MySqlCommand(getResourceString(name), dbcon); 236 MySqlCommand cmd = new MySqlCommand(getResourceString(name), dbcon);
@@ -260,9 +265,13 @@ namespace OpenSim.Data.MySQL
260 } 265 }
261 266
262 /// <summary> 267 /// <summary>
268 /// <list type="bullet">
269 /// <item>Execute CreateLandTable.sql if oldVersion == null</item>
270 /// <item>Execute UpgradeLandTable.sqm if oldVersion contain "Rev."</item>
271 /// </list>
263 /// </summary> 272 /// </summary>
264 /// <param name="oldVersion"></param> 273 /// <param name="oldVersion"></param>
265 /// <param name="dbconn"></param> 274 /// <param name="dbconn">The database connection handler</param>
266 private void UpgradeLandTable(string oldVersion, MySqlConnection dbconn) 275 private void UpgradeLandTable(string oldVersion, MySqlConnection dbconn)
267 { 276 {
268 // null as the version, indicates that the table didn't exist 277 // null as the version, indicates that the table didn't exist
@@ -280,8 +289,8 @@ namespace OpenSim.Data.MySQL
280 /// <summary> 289 /// <summary>
281 /// Adds an object into region storage 290 /// Adds an object into region storage
282 /// </summary> 291 /// </summary>
283 /// <param name="obj"></param> 292 /// <param name="obj">The object</param>
284 /// <param name="regionUUID"></param> 293 /// <param name="regionUUID">The region UUID</param>
285 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) 294 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
286 { 295 {
287 lock (m_dataSet) 296 lock (m_dataSet)
@@ -307,8 +316,8 @@ namespace OpenSim.Data.MySQL
307 /// <summary> 316 /// <summary>
308 /// removes an object from region storage 317 /// removes an object from region storage
309 /// </summary> 318 /// </summary>
310 /// <param name="obj"></param> 319 /// <param name="obj">The object</param>
311 /// <param name="regionUUID"></param> 320 /// <param name="regionUUID">The Region UUID</param>
312 public void RemoveObject(LLUUID obj, LLUUID regionUUID) 321 public void RemoveObject(LLUUID obj, LLUUID regionUUID)
313 { 322 {
314 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID); 323 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
@@ -362,6 +371,7 @@ namespace OpenSim.Data.MySQL
362 /// Load persisted objects from region storage. 371 /// Load persisted objects from region storage.
363 /// </summary> 372 /// </summary>
364 /// <param name="regionUUID">the Region UUID</param> 373 /// <param name="regionUUID">the Region UUID</param>
374 /// <returns>List of loaded groups</returns>
365 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) 375 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
366 { 376 {
367 Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>(); 377 Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>();
@@ -448,7 +458,7 @@ namespace OpenSim.Data.MySQL
448 /// <summary> 458 /// <summary>
449 /// Load in a prim's persisted inventory. 459 /// Load in a prim's persisted inventory.
450 /// </summary> 460 /// </summary>
451 /// <param name="prim"></param> 461 /// <param name="prim">The prim</param>
452 private void LoadItems(SceneObjectPart prim) 462 private void LoadItems(SceneObjectPart prim)
453 { 463 {
454 lock (m_dataSet) 464 lock (m_dataSet)
@@ -484,7 +494,7 @@ namespace OpenSim.Data.MySQL
484 /// <summary> 494 /// <summary>
485 /// Store a terrain revision in region storage 495 /// Store a terrain revision in region storage
486 /// </summary> 496 /// </summary>
487 /// <param name="ter">terrain data</param> 497 /// <param name="ter">HeightField data</param>
488 /// <param name="regionID">region UUID</param> 498 /// <param name="regionID">region UUID</param>
489 public void StoreTerrain(double[,] ter, LLUUID regionID) 499 public void StoreTerrain(double[,] ter, LLUUID regionID)
490 { 500 {
@@ -513,7 +523,7 @@ namespace OpenSim.Data.MySQL
513 /// Load the latest terrain revision from region storage 523 /// Load the latest terrain revision from region storage
514 /// </summary> 524 /// </summary>
515 /// <param name="regionID">the region UUID</param> 525 /// <param name="regionID">the region UUID</param>
516 /// <returns></returns> 526 /// <returns>Heightfield data</returns>
517 public double[,] LoadTerrain(LLUUID regionID) 527 public double[,] LoadTerrain(LLUUID regionID)
518 { 528 {
519 double[,] terret = new double[256,256]; 529 double[,] terret = new double[256,256];
@@ -563,8 +573,10 @@ namespace OpenSim.Data.MySQL
563 } 573 }
564 574
565 /// <summary> 575 /// <summary>
566 /// delete from land where UUID=globalID 576 /// <list type="bullet">
567 /// delete from landaccesslist where LandUUID=globalID 577 /// <item>delete from land where UUID=globalID</item>
578 /// <item>delete from landaccesslist where LandUUID=globalID</item>
579 /// </list>
568 /// </summary> 580 /// </summary>
569 /// <param name="globalID"></param> 581 /// <param name="globalID"></param>
570 public void RemoveLandObject(LLUUID globalID) 582 public void RemoveLandObject(LLUUID globalID)
@@ -629,10 +641,10 @@ namespace OpenSim.Data.MySQL
629 } 641 }
630 642
631 /// <summary> 643 /// <summary>
632 /// 644 /// Load (fetch?) a region banlist
633 /// </summary> 645 /// </summary>
634 /// <param name="regionUUID"></param> 646 /// <param name="regionUUID">The region UUID</param>
635 /// <returns></returns> 647 /// <returns>The Region banlist</returns>
636 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) 648 public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
637 { 649 {
638 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); 650 List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
@@ -660,9 +672,9 @@ namespace OpenSim.Data.MySQL
660 } 672 }
661 673
662 /// <summary> 674 /// <summary>
663 /// 675 /// Add an item to region banlist
664 /// </summary> 676 /// </summary>
665 /// <param name="item"></param> 677 /// <param name="item">The item</param>
666 public void AddToRegionBanlist(RegionBanListItem item) 678 public void AddToRegionBanlist(RegionBanListItem item)
667 { 679 {
668 lock (m_dataSet) 680 lock (m_dataSet)
@@ -684,9 +696,9 @@ namespace OpenSim.Data.MySQL
684 } 696 }
685 697
686 /// <summary> 698 /// <summary>
687 /// 699 /// Remove an item from region banlist
688 /// </summary> 700 /// </summary>
689 /// <param name="item"></param> 701 /// <param name="item">The item</param>
690 public void RemoveFromRegionBanlist(RegionBanListItem item) 702 public void RemoveFromRegionBanlist(RegionBanListItem item)
691 { 703 {
692 lock (m_dataSet) 704 lock (m_dataSet)
@@ -783,7 +795,7 @@ namespace OpenSim.Data.MySQL
783 } 795 }
784 796
785 /// <summary> 797 /// <summary>
786 /// 798 /// See <see cref="Commit"/>
787 /// </summary> 799 /// </summary>
788 public void Shutdown() 800 public void Shutdown()
789 { 801 {
@@ -798,6 +810,13 @@ namespace OpenSim.Data.MySQL
798 * 810 *
799 **********************************************************************/ 811 **********************************************************************/
800 812
813 /// <summary>
814 ///
815 /// </summary>
816 /// <param name="dt"></param>
817 /// <param name="name"></param>
818 /// <param name="type"></param>
819 /// <returns></returns>
801 private static DataColumn createCol(DataTable dt, string name, Type type) 820 private static DataColumn createCol(DataTable dt, string name, Type type)
802 { 821 {
803 DataColumn col = new DataColumn(name, type); 822 DataColumn col = new DataColumn(name, type);
@@ -805,6 +824,10 @@ namespace OpenSim.Data.MySQL
805 return col; 824 return col;
806 } 825 }
807 826
827 /// <summary>
828 /// Create the "terrain" table
829 /// </summary>
830 /// <returns></returns>
808 private static DataTable createTerrainTable() 831 private static DataTable createTerrainTable()
809 { 832 {
810 DataTable terrain = new DataTable("terrain"); 833 DataTable terrain = new DataTable("terrain");
@@ -815,6 +838,10 @@ namespace OpenSim.Data.MySQL
815 return terrain; 838 return terrain;
816 } 839 }
817 840
841 /// <summary>
842 /// Create the "regionban" table
843 /// </summary>
844 /// <returns></returns>
818 private static DataTable createRegionBanTable() 845 private static DataTable createRegionBanTable()
819 { 846 {
820 DataTable regionban = new DataTable("regionban"); 847 DataTable regionban = new DataTable("regionban");
@@ -826,6 +853,10 @@ namespace OpenSim.Data.MySQL
826 853
827 } 854 }
828 855
856 /// <summary>
857 /// Create the "prims" table
858 /// </summary>
859 /// <returns></returns>
829 private static DataTable createPrimTable() 860 private static DataTable createPrimTable()
830 { 861 {
831 DataTable prims = new DataTable("prims"); 862 DataTable prims = new DataTable("prims");
@@ -890,6 +921,10 @@ namespace OpenSim.Data.MySQL
890 return prims; 921 return prims;
891 } 922 }
892 923
924 /// <summary>
925 /// Create the "land" table
926 /// </summary>
927 /// <returns></returns>
893 private static DataTable createLandTable() 928 private static DataTable createLandTable()
894 { 929 {
895 DataTable land = new DataTable("land"); 930 DataTable land = new DataTable("land");
@@ -934,6 +969,10 @@ namespace OpenSim.Data.MySQL
934 return land; 969 return land;
935 } 970 }
936 971
972 /// <summary>
973 /// Create the "landaccesslist" table
974 /// </summary>
975 /// <returns></returns>
937 private static DataTable createLandAccessListTable() 976 private static DataTable createLandAccessListTable()
938 { 977 {
939 DataTable landaccess = new DataTable("landaccesslist"); 978 DataTable landaccess = new DataTable("landaccesslist");
@@ -944,6 +983,10 @@ namespace OpenSim.Data.MySQL
944 return landaccess; 983 return landaccess;
945 } 984 }
946 985
986 /// <summary>
987 /// Create the "primshapes" table
988 /// </summary>
989 /// <returns></returns>
947 private static DataTable createShapeTable() 990 private static DataTable createShapeTable()
948 { 991 {
949 DataTable shapes = new DataTable("primshapes"); 992 DataTable shapes = new DataTable("primshapes");
@@ -984,6 +1027,10 @@ namespace OpenSim.Data.MySQL
984 return shapes; 1027 return shapes;
985 } 1028 }
986 1029
1030 /// <summary>
1031 /// Create the "primitems" table
1032 /// </summary>
1033 /// <returns></returns>
987 private static DataTable createItemsTable() 1034 private static DataTable createItemsTable()
988 { 1035 {
989 DataTable items = new DataTable("primitems"); 1036 DataTable items = new DataTable("primitems");
@@ -1025,6 +1072,11 @@ namespace OpenSim.Data.MySQL
1025 * 1072 *
1026 **********************************************************************/ 1073 **********************************************************************/
1027 1074
1075 /// <summary>
1076 ///
1077 /// </summary>
1078 /// <param name="row"></param>
1079 /// <returns></returns>
1028 private SceneObjectPart buildPrim(DataRow row) 1080 private SceneObjectPart buildPrim(DataRow row)
1029 { 1081 {
1030 SceneObjectPart prim = new SceneObjectPart(); 1082 SceneObjectPart prim = new SceneObjectPart();
@@ -1153,6 +1205,11 @@ namespace OpenSim.Data.MySQL
1153 return taskItem; 1205 return taskItem;
1154 } 1206 }
1155 1207
1208 /// <summary>
1209 ///
1210 /// </summary>
1211 /// <param name="row"></param>
1212 /// <returns></returns>
1156 private static LandData buildLandData(DataRow row) 1213 private static LandData buildLandData(DataRow row)
1157 { 1214 {
1158 LandData newData = new LandData(); 1215 LandData newData = new LandData();
@@ -1214,6 +1271,11 @@ namespace OpenSim.Data.MySQL
1214 return newData; 1271 return newData;
1215 } 1272 }
1216 1273
1274 /// <summary>
1275 ///
1276 /// </summary>
1277 /// <param name="row"></param>
1278 /// <returns></returns>
1217 private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) 1279 private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
1218 { 1280 {
1219 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 1281 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
@@ -1223,6 +1285,11 @@ namespace OpenSim.Data.MySQL
1223 return entry; 1285 return entry;
1224 } 1286 }
1225 1287
1288 /// <summary>
1289 ///
1290 /// </summary>
1291 /// <param name="val"></param>
1292 /// <returns></returns>
1226 private static Array serializeTerrain(double[,] val) 1293 private static Array serializeTerrain(double[,] val)
1227 { 1294 {
1228 MemoryStream str = new MemoryStream(65536*sizeof (double)); 1295 MemoryStream str = new MemoryStream(65536*sizeof (double));
@@ -1242,6 +1309,13 @@ namespace OpenSim.Data.MySQL
1242 return str.ToArray(); 1309 return str.ToArray();
1243 } 1310 }
1244 1311
1312 /// <summary>
1313 ///
1314 /// </summary>
1315 /// <param name="row"></param>
1316 /// <param name="prim"></param>
1317 /// <param name="sceneGroupID"></param>
1318 /// <param name="regionUUID"></param>
1245 private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) 1319 private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
1246 { 1320 {
1247 row["UUID"] = Util.ToRawUuidString(prim.UUID); 1321 row["UUID"] = Util.ToRawUuidString(prim.UUID);
@@ -1318,6 +1392,11 @@ namespace OpenSim.Data.MySQL
1318 } 1392 }
1319 } 1393 }
1320 1394
1395 /// <summary>
1396 ///
1397 /// </summary>
1398 /// <param name="row"></param>
1399 /// <param name="taskItem"></param>
1321 private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) 1400 private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
1322 { 1401 {
1323 row["itemID"] = taskItem.ItemID; 1402 row["itemID"] = taskItem.ItemID;
@@ -1343,6 +1422,12 @@ namespace OpenSim.Data.MySQL
1343 row["flags"] = taskItem.Flags; 1422 row["flags"] = taskItem.Flags;
1344 } 1423 }
1345 1424
1425 /// <summary>
1426 ///
1427 /// </summary>
1428 /// <param name="row"></param>
1429 /// <param name="land"></param>
1430 /// <param name="regionUUID"></param>
1346 private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) 1431 private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
1347 { 1432 {
1348 row["UUID"] = Util.ToRawUuidString(land.globalID); 1433 row["UUID"] = Util.ToRawUuidString(land.globalID);
@@ -1382,6 +1467,12 @@ namespace OpenSim.Data.MySQL
1382 row["AuthBuyerID"] = land.authBuyerID; 1467 row["AuthBuyerID"] = land.authBuyerID;
1383 } 1468 }
1384 1469
1470 /// <summary>
1471 ///
1472 /// </summary>
1473 /// <param name="row"></param>
1474 /// <param name="entry"></param>
1475 /// <param name="parcelID"></param>
1385 private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID) 1476 private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID)
1386 { 1477 {
1387 row["LandUUID"] = Util.ToRawUuidString(parcelID); 1478 row["LandUUID"] = Util.ToRawUuidString(parcelID);
@@ -1389,6 +1480,11 @@ namespace OpenSim.Data.MySQL
1389 row["Flags"] = entry.Flags; 1480 row["Flags"] = entry.Flags;
1390 } 1481 }
1391 1482
1483 /// <summary>
1484 ///
1485 /// </summary>
1486 /// <param name="row"></param>
1487 /// <returns></returns>
1392 private PrimitiveBaseShape buildShape(DataRow row) 1488 private PrimitiveBaseShape buildShape(DataRow row)
1393 { 1489 {
1394 PrimitiveBaseShape s = new PrimitiveBaseShape(); 1490 PrimitiveBaseShape s = new PrimitiveBaseShape();
@@ -1447,6 +1543,11 @@ namespace OpenSim.Data.MySQL
1447 return s; 1543 return s;
1448 } 1544 }
1449 1545
1546 /// <summary>
1547 ///
1548 /// </summary>
1549 /// <param name="row"></param>
1550 /// <param name="prim"></param>
1450 private void fillShapeRow(DataRow row, SceneObjectPart prim) 1551 private void fillShapeRow(DataRow row, SceneObjectPart prim)
1451 { 1552 {
1452 PrimitiveBaseShape s = prim.Shape; 1553 PrimitiveBaseShape s = prim.Shape;
@@ -1502,6 +1603,12 @@ namespace OpenSim.Data.MySQL
1502 } 1603 }
1503 } 1604 }
1504 1605
1606 /// <summary>
1607 ///
1608 /// </summary>
1609 /// <param name="prim"></param>
1610 /// <param name="sceneGroupID"></param>
1611 /// <param name="regionUUID"></param>
1505 private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) 1612 private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
1506 { 1613 {
1507 lock (m_dataSet) 1614 lock (m_dataSet)
@@ -1535,7 +1642,11 @@ namespace OpenSim.Data.MySQL
1535 } 1642 }
1536 } 1643 }
1537 1644
1538 // see IRegionDatastore 1645 /// <summary>
1646 /// see IRegionDatastore
1647 /// </summary>
1648 /// <param name="primID"></param>
1649 /// <param name="items"></param>
1539 public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) 1650 public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
1540 { 1651 {
1541 if (!persistPrimInventories) 1652 if (!persistPrimInventories)
@@ -1576,17 +1687,24 @@ namespace OpenSim.Data.MySQL
1576 * 1687 *
1577 **********************************************************************/ 1688 **********************************************************************/
1578 1689
1690 /// <summary>
1691 /// Create a MySQL insert command
1692 /// </summary>
1693 /// <param name="table"></param>
1694 /// <param name="dt"></param>
1695 /// <returns></returns>
1696 /// <remarks>
1697 /// This is subtle enough to deserve some commentary.
1698 /// Instead of doing *lots* and *lots of hardcoded strings
1699 /// for database definitions we'll use the fact that
1700 /// realistically all insert statements look like "insert
1701 /// into A(b, c) values(:b, :c) on the parameterized query
1702 /// front. If we just have a list of b, c, etc... we can
1703 /// generate these strings instead of typing them out.
1704 /// </remarks>
1579 private static MySqlCommand createInsertCommand(string table, DataTable dt) 1705 private static MySqlCommand createInsertCommand(string table, DataTable dt)
1580 { 1706 {
1581 /** 1707
1582 * This is subtle enough to deserve some commentary.
1583 * Instead of doing *lots* and *lots of hardcoded strings
1584 * for database definitions we'll use the fact that
1585 * realistically all insert statements look like "insert
1586 * into A(b, c) values(:b, :c) on the parameterized query
1587 * front. If we just have a list of b, c, etc... we can
1588 * generate these strings instead of typing them out.
1589 */
1590 string[] cols = new string[dt.Columns.Count]; 1708 string[] cols = new string[dt.Columns.Count];
1591 for (int i = 0; i < dt.Columns.Count; i++) 1709 for (int i = 0; i < dt.Columns.Count; i++)
1592 { 1710 {
@@ -1611,6 +1729,13 @@ namespace OpenSim.Data.MySQL
1611 return cmd; 1729 return cmd;
1612 } 1730 }
1613 1731
1732 /// <summary>
1733 /// Create a MySQL update command
1734 /// </summary>
1735 /// <param name="table"></param>
1736 /// <param name="pk"></param>
1737 /// <param name="dt"></param>
1738 /// <returns></returns>
1614 private static MySqlCommand createUpdateCommand(string table, string pk, DataTable dt) 1739 private static MySqlCommand createUpdateCommand(string table, string pk, DataTable dt)
1615 { 1740 {
1616 string sql = "update " + table + " set "; 1741 string sql = "update " + table + " set ";
@@ -1638,6 +1763,11 @@ namespace OpenSim.Data.MySQL
1638 return cmd; 1763 return cmd;
1639 } 1764 }
1640 1765
1766 /// <summary>
1767 ///
1768 /// </summary>
1769 /// <param name="dt"></param>
1770 /// <returns></returns>
1641 private static string defineTable(DataTable dt) 1771 private static string defineTable(DataTable dt)
1642 { 1772 {
1643 string sql = "create table " + dt.TableName + "("; 1773 string sql = "create table " + dt.TableName + "(";
@@ -1673,16 +1803,18 @@ namespace OpenSim.Data.MySQL
1673 **********************************************************************/ 1803 **********************************************************************/
1674 1804
1675 ///<summary> 1805 ///<summary>
1676 /// This is a convenience function that collapses 5 repetitive 1806 /// <para>This is a convenience function that collapses 5 repetitive
1677 /// lines for defining MySqlParameters to 2 parameters: 1807 /// lines for defining MySqlParameters to 2 parameters:
1678 /// column name and database type. 1808 /// column name and database type.
1679 /// 1809 /// </para>
1810 /// <para>
1680 /// It assumes certain conventions like ?param as the param 1811 /// It assumes certain conventions like ?param as the param
1681 /// name to replace in parametrized queries, and that source 1812 /// name to replace in parametrized queries, and that source
1682 /// version is always current version, both of which are fine 1813 /// version is always current version, both of which are fine
1683 /// for us. 1814 /// for us.
1684 ///</summary> 1815 /// </para>
1685 ///<returns>a built MySql parameter</returns> 1816 /// </summary>
1817 /// <returns>a built MySql parameter</returns>
1686 private static MySqlParameter createMySqlParameter(string name, Type type) 1818 private static MySqlParameter createMySqlParameter(string name, Type type)
1687 { 1819 {
1688 MySqlParameter param = new MySqlParameter(); 1820 MySqlParameter param = new MySqlParameter();
@@ -1693,6 +1825,11 @@ namespace OpenSim.Data.MySQL
1693 return param; 1825 return param;
1694 } 1826 }
1695 1827
1828 /// <summary>
1829 ///
1830 /// </summary>
1831 /// <param name="da"></param>
1832 /// <param name="conn"></param>
1696 private void SetupPrimCommands(MySqlDataAdapter da, MySqlConnection conn) 1833 private void SetupPrimCommands(MySqlDataAdapter da, MySqlConnection conn)
1697 { 1834 {
1698 MySqlCommand insertCommand = createInsertCommand("prims", m_primTable); 1835 MySqlCommand insertCommand = createInsertCommand("prims", m_primTable);
@@ -1709,6 +1846,11 @@ namespace OpenSim.Data.MySQL
1709 da.DeleteCommand = delete; 1846 da.DeleteCommand = delete;
1710 } 1847 }
1711 1848
1849 /// <summary>
1850 ///
1851 /// </summary>
1852 /// <param name="da"></param>
1853 /// <param name="conn"></param>
1712 private void SetupItemsCommands(MySqlDataAdapter da, MySqlConnection conn) 1854 private void SetupItemsCommands(MySqlDataAdapter da, MySqlConnection conn)
1713 { 1855 {
1714 da.InsertCommand = createInsertCommand("primitems", m_itemsTable); 1856 da.InsertCommand = createInsertCommand("primitems", m_itemsTable);
@@ -1722,6 +1864,12 @@ namespace OpenSim.Data.MySQL
1722 delete.Connection = conn; 1864 delete.Connection = conn;
1723 da.DeleteCommand = delete; 1865 da.DeleteCommand = delete;
1724 } 1866 }
1867
1868 /// <summary>
1869 ///
1870 /// </summary>
1871 /// <param name="da"></param>
1872 /// <param name="conn"></param>
1725 private void SetupRegionBanCommands(MySqlDataAdapter da, MySqlConnection conn) 1873 private void SetupRegionBanCommands(MySqlDataAdapter da, MySqlConnection conn)
1726 { 1874 {
1727 da.InsertCommand = createInsertCommand("regionban", m_regionBanListTable); 1875 da.InsertCommand = createInsertCommand("regionban", m_regionBanListTable);
@@ -1736,12 +1884,23 @@ namespace OpenSim.Data.MySQL
1736 delete.Connection = conn; 1884 delete.Connection = conn;
1737 da.DeleteCommand = delete; 1885 da.DeleteCommand = delete;
1738 } 1886 }
1887
1888 /// <summary>
1889 ///
1890 /// </summary>
1891 /// <param name="da"></param>
1892 /// <param name="conn"></param>
1739 private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn) 1893 private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn)
1740 { 1894 {
1741 da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]); 1895 da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]);
1742 da.InsertCommand.Connection = conn; 1896 da.InsertCommand.Connection = conn;
1743 } 1897 }
1744 1898
1899 /// <summary>
1900 ///
1901 /// </summary>
1902 /// <param name="da"></param>
1903 /// <param name="conn"></param>
1745 private void setupLandCommands(MySqlDataAdapter da, MySqlConnection conn) 1904 private void setupLandCommands(MySqlDataAdapter da, MySqlConnection conn)
1746 { 1905 {
1747 da.InsertCommand = createInsertCommand("land", m_dataSet.Tables["land"]); 1906 da.InsertCommand = createInsertCommand("land", m_dataSet.Tables["land"]);
@@ -1751,12 +1910,22 @@ namespace OpenSim.Data.MySQL
1751 da.UpdateCommand.Connection = conn; 1910 da.UpdateCommand.Connection = conn;
1752 } 1911 }
1753 1912
1913 /// <summary>
1914 ///
1915 /// </summary>
1916 /// <param name="da"></param>
1917 /// <param name="conn"></param>
1754 private void setupLandAccessCommands(MySqlDataAdapter da, MySqlConnection conn) 1918 private void setupLandAccessCommands(MySqlDataAdapter da, MySqlConnection conn)
1755 { 1919 {
1756 da.InsertCommand = createInsertCommand("landaccesslist", m_dataSet.Tables["landaccesslist"]); 1920 da.InsertCommand = createInsertCommand("landaccesslist", m_dataSet.Tables["landaccesslist"]);
1757 da.InsertCommand.Connection = conn; 1921 da.InsertCommand.Connection = conn;
1758 } 1922 }
1759 1923
1924 /// <summary>
1925 ///
1926 /// </summary>
1927 /// <param name="da"></param>
1928 /// <param name="conn"></param>
1760 private void SetupShapeCommands(MySqlDataAdapter da, MySqlConnection conn) 1929 private void SetupShapeCommands(MySqlDataAdapter da, MySqlConnection conn)
1761 { 1930 {
1762 da.InsertCommand = createInsertCommand("primshapes", m_dataSet.Tables["primshapes"]); 1931 da.InsertCommand = createInsertCommand("primshapes", m_dataSet.Tables["primshapes"]);
@@ -1771,6 +1940,10 @@ namespace OpenSim.Data.MySQL
1771 da.DeleteCommand = delete; 1940 da.DeleteCommand = delete;
1772 } 1941 }
1773 1942
1943 /// <summary>
1944 ///
1945 /// </summary>
1946 /// <param name="conn">MySQL connection handler</param>
1774 private static void InitDB(MySqlConnection conn) 1947 private static void InitDB(MySqlConnection conn)
1775 { 1948 {
1776 string createPrims = defineTable(createPrimTable()); 1949 string createPrims = defineTable(createPrimTable());
@@ -1859,6 +2032,12 @@ namespace OpenSim.Data.MySQL
1859 conn.Close(); 2032 conn.Close();
1860 } 2033 }
1861 2034
2035 /// <summary>
2036 ///
2037 /// </summary>
2038 /// <param name="conn"></param>
2039 /// <param name="m"></param>
2040 /// <returns></returns>
1862 private bool TestTables(MySqlConnection conn, Migration m) 2041 private bool TestTables(MySqlConnection conn, Migration m)
1863 { 2042 {
1864 // we already have migrations, get out of here 2043 // we already have migrations, get out of here
@@ -1968,6 +2147,11 @@ namespace OpenSim.Data.MySQL
1968 * 2147 *
1969 **********************************************************************/ 2148 **********************************************************************/
1970 2149
2150 /// <summary>
2151 /// Type conversion functions
2152 /// </summary>
2153 /// <param name="type"></param>
2154 /// <returns></returns>
1971 private static DbType dbtypeFromType(Type type) 2155 private static DbType dbtypeFromType(Type type)
1972 { 2156 {
1973 if (type == typeof (String)) 2157 if (type == typeof (String))
@@ -2000,8 +2184,11 @@ namespace OpenSim.Data.MySQL
2000 } 2184 }
2001 } 2185 }
2002 2186
2003 // this is something we'll need to implement for each db 2187 /// <summary>
2004 // slightly differently. 2188 /// </summary>
2189 /// <param name="type"></param>
2190 /// <returns></returns>
2191 /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
2005 private static string MySqlType(Type type) 2192 private static string MySqlType(Type type)
2006 { 2193 {
2007 if (type == typeof (String)) 2194 if (type == typeof (String))
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs
index 394dbbd..7abc85a 100644
--- a/OpenSim/Data/MySQL/MySQLGridData.cs
+++ b/OpenSim/Data/MySQL/MySQLGridData.cs
@@ -49,10 +49,14 @@ namespace OpenSim.Data.MySQL
49 private MySQLManager database; 49 private MySQLManager database;
50 50
51 /// <summary> 51 /// <summary>
52 /// Initialises Grid interface 52 /// <para>Initialises Grid interface</para>
53 /// Loads and initialises the MySQL storage plugin 53 /// <para>
54 /// Warns and uses the obsolete mysql_connection.ini if connect string is empty. 54 /// <list type="bullet">
55 /// Check for migration 55 /// <item>Loads and initialises the MySQL storage plugin</item>
56 /// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
57 /// <item>Check for migration</item>
58 /// </list>
59 /// </para>
56 /// </summary> 60 /// </summary>
57 /// <param name="connect">connect string.</param> 61 /// <param name="connect">connect string.</param>
58 override public void Initialise(string connect) 62 override public void Initialise(string connect)
@@ -410,8 +414,8 @@ namespace OpenSim.Data.MySQL
410 /// <summary> 414 /// <summary>
411 /// Adds a location reservation 415 /// Adds a location reservation
412 /// </summary> 416 /// </summary>
413 /// <param name="x"></param> 417 /// <param name="x">x coordinate</param>
414 /// <param name="y"></param> 418 /// <param name="y">y coordinate</param>
415 /// <returns></returns> 419 /// <returns></returns>
416 override public ReservationData GetReservationAtPoint(uint x, uint y) 420 override public ReservationData GetReservationAtPoint(uint x, uint y)
417 { 421 {
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 2d93df3..911958c 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -49,12 +49,16 @@ namespace OpenSim.Data.MySQL
49 private MySQLManager database; 49 private MySQLManager database;
50 50
51 /// <summary> 51 /// <summary>
52 /// Initialises User interface 52 /// <para>Initialises Inventory interface</para>
53 /// Loads and initialises the MySQL storage plugin 53 /// <para>
54 /// warns and uses the obsolete mysql_connection.ini if connect string is empty. 54 /// <list type="bullet">
55 /// Check for migration 55 /// <item>Loads and initialises the MySQL storage plugin</item>
56 /// <item>warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
57 /// <item>Check for migration</item>
58 /// </list>
59 /// </para>
56 /// </summary> 60 /// </summary>
57 /// <param name="connect">connect string.</param> 61 /// <param name="connect">connect string</param>
58 public void Initialise(string connect) 62 public void Initialise(string connect)
59 { 63 {
60 if (connect != String.Empty) 64 if (connect != String.Empty)
@@ -90,6 +94,13 @@ namespace OpenSim.Data.MySQL
90 94
91 #region Test and initialization code 95 #region Test and initialization code
92 96
97 /// <summary>
98 /// <list type="bullet">
99 /// <item>Execute CreateFoldersTable.sql if oldVersion == null</item>
100 /// <item>do nothing if oldVersion != null</item>
101 /// </list>
102 /// </summary>
103 /// <param name="oldVersion"></param>
93 private void UpgradeFoldersTable(string oldVersion) 104 private void UpgradeFoldersTable(string oldVersion)
94 { 105 {
95 // null as the version, indicates that the table didn't exist 106 // null as the version, indicates that the table didn't exist
@@ -99,13 +110,19 @@ namespace OpenSim.Data.MySQL
99 return; 110 return;
100 } 111 }
101 112
102 // if the table is already at the current version, then we can exit immediately 113 //// if the table is already at the current version, then we can exit immediately
103// if (oldVersion == "Rev. 2") 114 // if (oldVersion == "Rev. 2")
104// return; 115 // return;
105 116 // database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
106// database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
107 } 117 }
108 118
119 /// <summary>
120 /// <list type="bullet">
121 /// <item>Execute CreateItemsTable.sql if oldVersion == null</item>
122 /// <item>Execute "UpgradeItemsTableToVersion3.sql" if oldVersion start with "Rev. 2;"</item>
123 /// </list>
124 /// </summary>
125 /// <param name="oldVersion"></param>
109 private void UpgradeItemsTable(string oldVersion) 126 private void UpgradeItemsTable(string oldVersion)
110 { 127 {
111 // null as the version, indicates that the table didn't exist 128 // null as the version, indicates that the table didn't exist
@@ -123,6 +140,11 @@ namespace OpenSim.Data.MySQL
123 } 140 }
124 } 141 }
125 142
143 /// <summary>
144 ///
145 /// </summary>
146 /// <param name="conn">MySQL connection handler</param>
147 /// <param name="m"></param>
126 private void TestTables(MySqlConnection conn, Migration m) 148 private void TestTables(MySqlConnection conn, Migration m)
127 { 149 {
128 Dictionary<string, string> tableList = new Dictionary<string, string>(); 150 Dictionary<string, string> tableList = new Dictionary<string, string>();
@@ -178,7 +200,7 @@ namespace OpenSim.Data.MySQL
178 /// <summary> 200 /// <summary>
179 /// Returns the version of this DB provider 201 /// Returns the version of this DB provider
180 /// </summary> 202 /// </summary>
181 /// <returns>A string containing the DB provider</returns> 203 /// <returns>A string containing the DB provider version</returns>
182 public string getVersion() 204 public string getVersion()
183 { 205 {
184 return database.getVersion(); 206 return database.getVersion();
@@ -260,9 +282,9 @@ namespace OpenSim.Data.MySQL
260 282
261 283
262 /// <summary> 284 /// <summary>
263 /// see InventoryItemBase.getUserRootFolder 285 /// see <see cref="InventoryItemBase.getUserRootFolder"/>
264 /// </summary> 286 /// </summary>
265 /// <param name="user"></param> 287 /// <param name="user">The user UUID</param>
266 /// <returns></returns> 288 /// <returns></returns>
267 public InventoryFolderBase getUserRootFolder(LLUUID user) 289 public InventoryFolderBase getUserRootFolder(LLUUID user)
268 { 290 {
@@ -545,9 +567,9 @@ namespace OpenSim.Data.MySQL
545 } 567 }
546 568
547 /// <summary> 569 /// <summary>
548 /// 570 /// Detele the specified inventory item
549 /// </summary> 571 /// </summary>
550 /// <param name="item"></param> 572 /// <param name="item">The inventory item UUID to delete</param>
551 public void deleteInventoryItem(LLUUID itemID) 573 public void deleteInventoryItem(LLUUID itemID)
552 { 574 {
553 try 575 try
@@ -609,9 +631,10 @@ namespace OpenSim.Data.MySQL
609 } 631 }
610 632
611 /// <summary> 633 /// <summary>
612 /// Creates a new inventory folder 634 /// Move an inventory folder
613 /// </summary> 635 /// </summary>
614 /// <param name="folder">Folder to create</param> 636 /// <param name="folder">Folder to move</param>
637 /// <remarks>UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID</remarks>
615 public void moveInventoryFolder(InventoryFolderBase folder) 638 public void moveInventoryFolder(InventoryFolderBase folder)
616 { 639 {
617 string sql = 640 string sql =