diff options
author | Jeff Ames | 2008-06-26 20:25:57 +0000 |
---|---|---|
committer | Jeff Ames | 2008-06-26 20:25:57 +0000 |
commit | f8ccf00f1cd8b99a2012558ded7de01ffcff7e35 (patch) | |
tree | 0aa16acb4bd909a9c746557ae068180ba681bbf0 | |
parent | Apply patch from bug #1606 -- Documentation for Data/Null, Data/Base. Thanks... (diff) | |
download | opensim-SC_OLD-f8ccf00f1cd8b99a2012558ded7de01ffcff7e35.zip opensim-SC_OLD-f8ccf00f1cd8b99a2012558ded7de01ffcff7e35.tar.gz opensim-SC_OLD-f8ccf00f1cd8b99a2012558ded7de01ffcff7e35.tar.bz2 opensim-SC_OLD-f8ccf00f1cd8b99a2012558ded7de01ffcff7e35.tar.xz |
Apply patch from bug #1609 -- Documentation for Data/MSSQL. Thanks kerunix_Flan!
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 50 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLDataStore.cs | 230 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLGridData.cs | 31 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 38 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLManager.cs | 36 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLUserData.cs | 90 |
6 files changed, 446 insertions, 29 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 12a03eb..50e2e3a 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -36,6 +36,9 @@ using OpenSim.Framework; | |||
36 | 36 | ||
37 | namespace OpenSim.Data.MSSQL | 37 | namespace OpenSim.Data.MSSQL |
38 | { | 38 | { |
39 | /// <summary> | ||
40 | /// A MSSQL Interface for the Asset server | ||
41 | /// </summary> | ||
39 | internal class MSSQLAssetData : AssetDataBase | 42 | internal class MSSQLAssetData : AssetDataBase |
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); |
@@ -44,6 +47,13 @@ namespace OpenSim.Data.MSSQL | |||
44 | 47 | ||
45 | #region IAssetProvider Members | 48 | #region IAssetProvider Members |
46 | 49 | ||
50 | /// <summary> | ||
51 | /// Migration method | ||
52 | /// <list type="bullet"> | ||
53 | /// <item>Execute "CreateAssetsTable.sql" if tableName == null</item> | ||
54 | /// </list> | ||
55 | /// </summary> | ||
56 | /// <param name="tableName">Name of table</param> | ||
47 | private void UpgradeAssetsTable(string tableName) | 57 | private void UpgradeAssetsTable(string tableName) |
48 | { | 58 | { |
49 | // null as the version, indicates that the table didn't exist | 59 | // null as the version, indicates that the table didn't exist |
@@ -68,6 +78,11 @@ namespace OpenSim.Data.MSSQL | |||
68 | UpgradeAssetsTable(tableList["assets"]); | 78 | UpgradeAssetsTable(tableList["assets"]); |
69 | } | 79 | } |
70 | 80 | ||
81 | /// <summary> | ||
82 | /// Fetch Asset from database | ||
83 | /// </summary> | ||
84 | /// <param name="assetID">the asset UUID</param> | ||
85 | /// <returns></returns> | ||
71 | override public AssetBase FetchAsset(LLUUID assetID) | 86 | override public AssetBase FetchAsset(LLUUID assetID) |
72 | { | 87 | { |
73 | AssetBase asset = null; | 88 | AssetBase asset = null; |
@@ -85,6 +100,10 @@ namespace OpenSim.Data.MSSQL | |||
85 | return asset; | 100 | return asset; |
86 | } | 101 | } |
87 | 102 | ||
103 | /// <summary> | ||
104 | /// Create asset in database | ||
105 | /// </summary> | ||
106 | /// <param name="asset">the asset</param> | ||
88 | override public void CreateAsset(AssetBase asset) | 107 | override public void CreateAsset(AssetBase asset) |
89 | { | 108 | { |
90 | if (ExistsAsset((LLUUID) asset.FullID)) | 109 | if (ExistsAsset((LLUUID) asset.FullID)) |
@@ -130,7 +149,10 @@ namespace OpenSim.Data.MSSQL | |||
130 | } | 149 | } |
131 | } | 150 | } |
132 | 151 | ||
133 | 152 | /// <summary> | |
153 | /// Update asset in database | ||
154 | /// </summary> | ||
155 | /// <param name="asset">the asset</param> | ||
134 | override public void UpdateAsset(AssetBase asset) | 156 | override public void UpdateAsset(AssetBase asset) |
135 | { | 157 | { |
136 | SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + | 158 | SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + |
@@ -171,6 +193,11 @@ namespace OpenSim.Data.MSSQL | |||
171 | } | 193 | } |
172 | } | 194 | } |
173 | 195 | ||
196 | /// <summary> | ||
197 | /// Check if asset exist in database | ||
198 | /// </summary> | ||
199 | /// <param name="uuid"></param> | ||
200 | /// <returns>true if exist.</returns> | ||
174 | override public bool ExistsAsset(LLUUID uuid) | 201 | override public bool ExistsAsset(LLUUID uuid) |
175 | { | 202 | { |
176 | if (FetchAsset(uuid) != null) | 203 | if (FetchAsset(uuid) != null) |
@@ -191,13 +218,23 @@ namespace OpenSim.Data.MSSQL | |||
191 | 218 | ||
192 | #region IPlugin Members | 219 | #region IPlugin Members |
193 | 220 | ||
221 | /// <summary> | ||
222 | /// <para>Initialises asset interface</para> | ||
223 | /// <para> | ||
224 | /// TODO: this would allow you to pass in connnect info as | ||
225 | /// a string instead of file, if someone writes the support | ||
226 | /// </para> | ||
227 | /// </summary> | ||
228 | /// <param name="connect">connect string</param> | ||
194 | override public void Initialise(string connect) | 229 | override public void Initialise(string connect) |
195 | { | 230 | { |
196 | // TODO: this would allow you to pass in connnect info as | ||
197 | // a string instead of file, if someone writes the support | ||
198 | Initialise(); | 231 | Initialise(); |
199 | } | 232 | } |
200 | 233 | ||
234 | /// <summary> | ||
235 | /// Initialises asset interface | ||
236 | /// </summary> | ||
237 | /// <remarks>it use mssql_connection.ini</remarks> | ||
201 | override public void Initialise() | 238 | override public void Initialise() |
202 | { | 239 | { |
203 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); | 240 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); |
@@ -214,12 +251,17 @@ namespace OpenSim.Data.MSSQL | |||
214 | TestTables(); | 251 | TestTables(); |
215 | } | 252 | } |
216 | 253 | ||
254 | /// <summary> | ||
255 | /// Database provider version. | ||
256 | /// </summary> | ||
217 | override public string Version | 257 | override public string Version |
218 | { | 258 | { |
219 | // get { return database.getVersion(); } | ||
220 | get { return database.getVersion(); } | 259 | get { return database.getVersion(); } |
221 | } | 260 | } |
222 | 261 | ||
262 | /// <summary> | ||
263 | /// The name of this DB provider. | ||
264 | /// </summary> | ||
223 | override public string Name | 265 | override public string Name |
224 | { | 266 | { |
225 | get { return "MSSQL Asset storage engine"; } | 267 | get { return "MSSQL Asset storage engine"; } |
diff --git a/OpenSim/Data/MSSQL/MSSQLDataStore.cs b/OpenSim/Data/MSSQL/MSSQLDataStore.cs index b230d23..42eab8e 100644 --- a/OpenSim/Data/MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Data/MSSQL/MSSQLDataStore.cs | |||
@@ -39,6 +39,9 @@ using OpenSim.Region.Environment.Scenes; | |||
39 | 39 | ||
40 | namespace OpenSim.Data.MSSQL | 40 | namespace OpenSim.Data.MSSQL |
41 | { | 41 | { |
42 | /// <summary> | ||
43 | /// A MSSQL Interface for the Region Server. | ||
44 | /// </summary> | ||
42 | public class MSSQLDataStore : IRegionDataStore | 45 | public class MSSQLDataStore : IRegionDataStore |
43 | { | 46 | { |
44 | // private static FileSystemDataStore Instance = new FileSystemDataStore(); | 47 | // private static FileSystemDataStore Instance = new FileSystemDataStore(); |
@@ -67,7 +70,7 @@ namespace OpenSim.Data.MSSQL | |||
67 | private DataTable m_landTable; | 70 | private DataTable m_landTable; |
68 | private DataTable m_landAccessListTable; | 71 | private DataTable m_landAccessListTable; |
69 | 72 | ||
70 | // Temporary attribute while this is experimental | 73 | /// <summary>Temporary attribute while this is experimental</summary> |
71 | private bool persistPrimInventories; | 74 | private bool persistPrimInventories; |
72 | 75 | ||
73 | /*********************************************************************** | 76 | /*********************************************************************** |
@@ -76,7 +79,11 @@ namespace OpenSim.Data.MSSQL | |||
76 | * | 79 | * |
77 | **********************************************************************/ | 80 | **********************************************************************/ |
78 | 81 | ||
79 | // see IRegionDataStore | 82 | /// <summary> |
83 | /// see IRegionDataStore | ||
84 | /// </summary> | ||
85 | /// <param name="connectionString"></param> | ||
86 | /// <param name="persistPrimInventories"></param> | ||
80 | public void Initialise(string connectionString, bool persistPrimInventories) | 87 | public void Initialise(string connectionString, bool persistPrimInventories) |
81 | { | 88 | { |
82 | // Instance.Initialise("", true); | 89 | // Instance.Initialise("", true); |
@@ -144,6 +151,11 @@ namespace OpenSim.Data.MSSQL | |||
144 | } | 151 | } |
145 | } | 152 | } |
146 | 153 | ||
154 | /// <summary> | ||
155 | /// | ||
156 | /// </summary> | ||
157 | /// <param name="obj"></param> | ||
158 | /// <param name="regionUUID"></param> | ||
147 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) | 159 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) |
148 | { | 160 | { |
149 | // Instance.StoreObject(obj, regionUUID); | 161 | // Instance.StoreObject(obj, regionUUID); |
@@ -169,6 +181,11 @@ namespace OpenSim.Data.MSSQL | |||
169 | Commit(); | 181 | Commit(); |
170 | } | 182 | } |
171 | 183 | ||
184 | /// <summary> | ||
185 | /// | ||
186 | /// </summary> | ||
187 | /// <param name="obj"></param> | ||
188 | /// <param name="regionUUID"></param> | ||
172 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) | 189 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) |
173 | { | 190 | { |
174 | // Instance.RemoveObject(obj, regionUUID); | 191 | // Instance.RemoveObject(obj, regionUUID); |
@@ -209,6 +226,7 @@ namespace OpenSim.Data.MSSQL | |||
209 | /// Remove all persisted items of the given prim. | 226 | /// Remove all persisted items of the given prim. |
210 | /// The caller must acquire the necessrary synchronization locks and commit or rollback changes. | 227 | /// The caller must acquire the necessrary synchronization locks and commit or rollback changes. |
211 | /// </summary> | 228 | /// </summary> |
229 | /// <param name="uuid">The item UUID</param> | ||
212 | private void RemoveItems(LLUUID uuid) | 230 | private void RemoveItems(LLUUID uuid) |
213 | { | 231 | { |
214 | String sql = String.Format("primID = '{0}'", uuid); | 232 | String sql = String.Format("primID = '{0}'", uuid); |
@@ -223,6 +241,7 @@ namespace OpenSim.Data.MSSQL | |||
223 | /// <summary> | 241 | /// <summary> |
224 | /// Load persisted objects from region storage. | 242 | /// Load persisted objects from region storage. |
225 | /// </summary> | 243 | /// </summary> |
244 | /// <param name="regionUUID">The region UUID</param> | ||
226 | public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) | 245 | public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) |
227 | { | 246 | { |
228 | // return Instance.LoadObjects(regionUUID); | 247 | // return Instance.LoadObjects(regionUUID); |
@@ -341,6 +360,11 @@ namespace OpenSim.Data.MSSQL | |||
341 | } | 360 | } |
342 | } | 361 | } |
343 | 362 | ||
363 | /// <summary> | ||
364 | /// Store a terrain revision in region storage. | ||
365 | /// </summary> | ||
366 | /// <param name="ter">HeightField data</param> | ||
367 | /// <param name="regionID">Region UUID</param> | ||
344 | public void StoreTerrain(double[,] ter, LLUUID regionID) | 368 | public void StoreTerrain(double[,] ter, LLUUID regionID) |
345 | { | 369 | { |
346 | int revision = Util.UnixTimeSinceEpoch(); | 370 | int revision = Util.UnixTimeSinceEpoch(); |
@@ -361,6 +385,11 @@ namespace OpenSim.Data.MSSQL | |||
361 | } | 385 | } |
362 | } | 386 | } |
363 | 387 | ||
388 | /// <summary> | ||
389 | /// Load the latest terrain revision from region storage. | ||
390 | /// </summary> | ||
391 | /// <param name="regionID">The Region UUID</param> | ||
392 | /// <returns>HeightField Data</returns> | ||
364 | public double[,] LoadTerrain(LLUUID regionID) | 393 | public double[,] LoadTerrain(LLUUID regionID) |
365 | { | 394 | { |
366 | double[,] terret = new double[256, 256]; | 395 | double[,] terret = new double[256, 256]; |
@@ -407,6 +436,10 @@ namespace OpenSim.Data.MSSQL | |||
407 | return terret; | 436 | return terret; |
408 | } | 437 | } |
409 | 438 | ||
439 | /// <summary> | ||
440 | /// | ||
441 | /// </summary> | ||
442 | /// <param name="globalID"></param> | ||
410 | public void RemoveLandObject(LLUUID globalID) | 443 | public void RemoveLandObject(LLUUID globalID) |
411 | { | 444 | { |
412 | // Instance.RemoveLandObject(globalID); | 445 | // Instance.RemoveLandObject(globalID); |
@@ -429,6 +462,10 @@ namespace OpenSim.Data.MSSQL | |||
429 | } | 462 | } |
430 | } | 463 | } |
431 | 464 | ||
465 | /// <summary> | ||
466 | /// | ||
467 | /// </summary> | ||
468 | /// <param name="parcel"></param> | ||
432 | public void StoreLandObject(ILandObject parcel) | 469 | public void StoreLandObject(ILandObject parcel) |
433 | { | 470 | { |
434 | lock (m_dataSet) | 471 | lock (m_dataSet) |
@@ -467,6 +504,11 @@ namespace OpenSim.Data.MSSQL | |||
467 | Commit(); | 504 | Commit(); |
468 | } | 505 | } |
469 | 506 | ||
507 | /// <summary> | ||
508 | /// | ||
509 | /// </summary> | ||
510 | /// <param name="regionUUID">The region UUID</param> | ||
511 | /// <returns></returns> | ||
470 | public List<LandData> LoadLandObjects(LLUUID regionUUID) | 512 | public List<LandData> LoadLandObjects(LLUUID regionUUID) |
471 | { | 513 | { |
472 | List<LandData> landDataForRegion = new List<LandData>(); | 514 | List<LandData> landDataForRegion = new List<LandData>(); |
@@ -492,22 +534,38 @@ namespace OpenSim.Data.MSSQL | |||
492 | return landDataForRegion; | 534 | return landDataForRegion; |
493 | } | 535 | } |
494 | 536 | ||
537 | /// <summary> | ||
538 | /// Load (fetch?) the region banlist | ||
539 | /// </summary> | ||
540 | /// <param name="regionUUID">the region UUID</param> | ||
541 | /// <returns>the banlist list</returns> | ||
495 | public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) | 542 | public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) |
496 | { | 543 | { |
497 | List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); | 544 | List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); |
498 | return regionbanlist; | 545 | return regionbanlist; |
499 | } | 546 | } |
500 | 547 | ||
548 | /// <summary> | ||
549 | /// STUB, add an item into region banlist | ||
550 | /// </summary> | ||
551 | /// <param name="item">the item</param> | ||
501 | public void AddToRegionBanlist(RegionBanListItem item) | 552 | public void AddToRegionBanlist(RegionBanListItem item) |
502 | { | 553 | { |
503 | 554 | ||
504 | } | 555 | } |
505 | 556 | ||
557 | /// <summary> | ||
558 | /// STUB, remove an item from region banlist | ||
559 | /// </summary> | ||
560 | /// <param name="item"></param> | ||
506 | public void RemoveFromRegionBanlist(RegionBanListItem item) | 561 | public void RemoveFromRegionBanlist(RegionBanListItem item) |
507 | { | 562 | { |
508 | 563 | ||
509 | } | 564 | } |
510 | 565 | ||
566 | /// <summary> | ||
567 | /// Commit | ||
568 | /// </summary> | ||
511 | public void Commit() | 569 | public void Commit() |
512 | { | 570 | { |
513 | if (m_connection.State != ConnectionState.Open) | 571 | if (m_connection.State != ConnectionState.Open) |
@@ -535,6 +593,9 @@ namespace OpenSim.Data.MSSQL | |||
535 | } | 593 | } |
536 | } | 594 | } |
537 | 595 | ||
596 | /// <summary> | ||
597 | /// See <see cref="Commit"/> | ||
598 | /// </summary> | ||
538 | public void Shutdown() | 599 | public void Shutdown() |
539 | { | 600 | { |
540 | Commit(); | 601 | Commit(); |
@@ -548,6 +609,13 @@ namespace OpenSim.Data.MSSQL | |||
548 | * | 609 | * |
549 | **********************************************************************/ | 610 | **********************************************************************/ |
550 | 611 | ||
612 | /// <summary> | ||
613 | /// | ||
614 | /// </summary> | ||
615 | /// <param name="dt"></param> | ||
616 | /// <param name="name"></param> | ||
617 | /// <param name="type"></param> | ||
618 | /// <returns></returns> | ||
551 | private static DataColumn createCol(DataTable dt, string name, Type type) | 619 | private static DataColumn createCol(DataTable dt, string name, Type type) |
552 | { | 620 | { |
553 | DataColumn col = new DataColumn(name, type); | 621 | DataColumn col = new DataColumn(name, type); |
@@ -555,6 +623,10 @@ namespace OpenSim.Data.MSSQL | |||
555 | return col; | 623 | return col; |
556 | } | 624 | } |
557 | 625 | ||
626 | /// <summary> | ||
627 | /// Create the "terrain" table | ||
628 | /// </summary> | ||
629 | /// <returns>the datatable</returns> | ||
558 | private static DataTable createTerrainTable() | 630 | private static DataTable createTerrainTable() |
559 | { | 631 | { |
560 | DataTable terrain = new DataTable("terrain"); | 632 | DataTable terrain = new DataTable("terrain"); |
@@ -566,6 +638,10 @@ namespace OpenSim.Data.MSSQL | |||
566 | return terrain; | 638 | return terrain; |
567 | } | 639 | } |
568 | 640 | ||
641 | /// <summary> | ||
642 | /// Create the "prims" table | ||
643 | /// </summary> | ||
644 | /// <returns>the datatable</returns> | ||
569 | private static DataTable createPrimTable() | 645 | private static DataTable createPrimTable() |
570 | { | 646 | { |
571 | DataTable prims = new DataTable("prims"); | 647 | DataTable prims = new DataTable("prims"); |
@@ -630,6 +706,10 @@ namespace OpenSim.Data.MSSQL | |||
630 | return prims; | 706 | return prims; |
631 | } | 707 | } |
632 | 708 | ||
709 | /// <summary> | ||
710 | /// Create the "land" table | ||
711 | /// </summary> | ||
712 | /// <returns>the datatable</returns> | ||
633 | private static DataTable createLandTable() | 713 | private static DataTable createLandTable() |
634 | { | 714 | { |
635 | DataTable land = new DataTable("land"); | 715 | DataTable land = new DataTable("land"); |
@@ -673,6 +753,10 @@ namespace OpenSim.Data.MSSQL | |||
673 | return land; | 753 | return land; |
674 | } | 754 | } |
675 | 755 | ||
756 | /// <summary> | ||
757 | /// Create "landacceslist" table | ||
758 | /// </summary> | ||
759 | /// <returns>the datatable</returns> | ||
676 | private static DataTable createLandAccessListTable() | 760 | private static DataTable createLandAccessListTable() |
677 | { | 761 | { |
678 | DataTable landaccess = new DataTable("landaccesslist"); | 762 | DataTable landaccess = new DataTable("landaccesslist"); |
@@ -683,6 +767,10 @@ namespace OpenSim.Data.MSSQL | |||
683 | return landaccess; | 767 | return landaccess; |
684 | } | 768 | } |
685 | 769 | ||
770 | /// <summary> | ||
771 | /// Create "primsshapes" table | ||
772 | /// </summary> | ||
773 | /// <returns>the datatable</returns> | ||
686 | private static DataTable createShapeTable() | 774 | private static DataTable createShapeTable() |
687 | { | 775 | { |
688 | DataTable shapes = new DataTable("primshapes"); | 776 | DataTable shapes = new DataTable("primshapes"); |
@@ -725,6 +813,10 @@ namespace OpenSim.Data.MSSQL | |||
725 | return shapes; | 813 | return shapes; |
726 | } | 814 | } |
727 | 815 | ||
816 | /// <summary> | ||
817 | /// Create "primitems" table | ||
818 | /// </summary> | ||
819 | /// <returns>the datatable</returns> | ||
728 | private static DataTable createItemsTable() | 820 | private static DataTable createItemsTable() |
729 | { | 821 | { |
730 | DataTable items = new DataTable("primitems"); | 822 | DataTable items = new DataTable("primitems"); |
@@ -766,6 +858,11 @@ namespace OpenSim.Data.MSSQL | |||
766 | * | 858 | * |
767 | **********************************************************************/ | 859 | **********************************************************************/ |
768 | 860 | ||
861 | /// <summary> | ||
862 | /// | ||
863 | /// </summary> | ||
864 | /// <param name="row"></param> | ||
865 | /// <returns></returns> | ||
769 | private SceneObjectPart buildPrim(DataRow row) | 866 | private SceneObjectPart buildPrim(DataRow row) |
770 | { | 867 | { |
771 | SceneObjectPart prim = new SceneObjectPart(); | 868 | SceneObjectPart prim = new SceneObjectPart(); |
@@ -891,6 +988,11 @@ namespace OpenSim.Data.MSSQL | |||
891 | return taskItem; | 988 | return taskItem; |
892 | } | 989 | } |
893 | 990 | ||
991 | /// <summary> | ||
992 | /// | ||
993 | /// </summary> | ||
994 | /// <param name="row"></param> | ||
995 | /// <returns></returns> | ||
894 | private static LandData buildLandData(DataRow row) | 996 | private static LandData buildLandData(DataRow row) |
895 | { | 997 | { |
896 | LandData newData = new LandData(); | 998 | LandData newData = new LandData(); |
@@ -936,6 +1038,11 @@ namespace OpenSim.Data.MSSQL | |||
936 | return newData; | 1038 | return newData; |
937 | } | 1039 | } |
938 | 1040 | ||
1041 | /// <summary> | ||
1042 | /// | ||
1043 | /// </summary> | ||
1044 | /// <param name="row"></param> | ||
1045 | /// <returns></returns> | ||
939 | private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) | 1046 | private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) |
940 | { | 1047 | { |
941 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 1048 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
@@ -945,6 +1052,11 @@ namespace OpenSim.Data.MSSQL | |||
945 | return entry; | 1052 | return entry; |
946 | } | 1053 | } |
947 | 1054 | ||
1055 | /// <summary> | ||
1056 | /// Serialize terrain HeightField | ||
1057 | /// </summary> | ||
1058 | /// <param name="val">the terrain heightfield</param> | ||
1059 | /// <returns></returns> | ||
948 | private static Array serializeTerrain(double[,] val) | 1060 | private static Array serializeTerrain(double[,] val) |
949 | { | 1061 | { |
950 | MemoryStream str = new MemoryStream(65536 * sizeof(double)); | 1062 | MemoryStream str = new MemoryStream(65536 * sizeof(double)); |
@@ -958,6 +1070,13 @@ namespace OpenSim.Data.MSSQL | |||
958 | return str.ToArray(); | 1070 | return str.ToArray(); |
959 | } | 1071 | } |
960 | 1072 | ||
1073 | /// <summary> | ||
1074 | /// | ||
1075 | /// </summary> | ||
1076 | /// <param name="row"></param> | ||
1077 | /// <param name="prim"></param> | ||
1078 | /// <param name="sceneGroupID"></param> | ||
1079 | /// <param name="regionUUID"></param> | ||
961 | private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) | 1080 | private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) |
962 | { | 1081 | { |
963 | row["UUID"] = prim.UUID; | 1082 | row["UUID"] = prim.UUID; |
@@ -1034,6 +1153,11 @@ namespace OpenSim.Data.MSSQL | |||
1034 | } | 1153 | } |
1035 | } | 1154 | } |
1036 | 1155 | ||
1156 | /// <summary> | ||
1157 | /// | ||
1158 | /// </summary> | ||
1159 | /// <param name="row"></param> | ||
1160 | /// <param name="taskItem"></param> | ||
1037 | private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) | 1161 | private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) |
1038 | { | 1162 | { |
1039 | row["itemID"] = taskItem.ItemID; | 1163 | row["itemID"] = taskItem.ItemID; |
@@ -1059,6 +1183,12 @@ namespace OpenSim.Data.MSSQL | |||
1059 | // row["flags"] = taskItem.Flags; | 1183 | // row["flags"] = taskItem.Flags; |
1060 | } | 1184 | } |
1061 | 1185 | ||
1186 | /// <summary> | ||
1187 | /// | ||
1188 | /// </summary> | ||
1189 | /// <param name="row"></param> | ||
1190 | /// <param name="land"></param> | ||
1191 | /// <param name="regionUUID"></param> | ||
1062 | private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) | 1192 | private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) |
1063 | { | 1193 | { |
1064 | row["UUID"] = land.globalID.UUID; | 1194 | row["UUID"] = land.globalID.UUID; |
@@ -1097,6 +1227,12 @@ namespace OpenSim.Data.MSSQL | |||
1097 | row["UserLookAtZ"] = land.userLookAt.Z; | 1227 | row["UserLookAtZ"] = land.userLookAt.Z; |
1098 | } | 1228 | } |
1099 | 1229 | ||
1230 | /// <summary> | ||
1231 | /// | ||
1232 | /// </summary> | ||
1233 | /// <param name="row"></param> | ||
1234 | /// <param name="entry"></param> | ||
1235 | /// <param name="parcelID"></param> | ||
1100 | private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID) | 1236 | private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, LLUUID parcelID) |
1101 | { | 1237 | { |
1102 | row["LandUUID"] = parcelID.UUID; | 1238 | row["LandUUID"] = parcelID.UUID; |
@@ -1104,6 +1240,11 @@ namespace OpenSim.Data.MSSQL | |||
1104 | row["Flags"] = entry.Flags; | 1240 | row["Flags"] = entry.Flags; |
1105 | } | 1241 | } |
1106 | 1242 | ||
1243 | /// <summary> | ||
1244 | /// | ||
1245 | /// </summary> | ||
1246 | /// <param name="row"></param> | ||
1247 | /// <returns></returns> | ||
1107 | private static PrimitiveBaseShape buildShape(DataRow row) | 1248 | private static PrimitiveBaseShape buildShape(DataRow row) |
1108 | { | 1249 | { |
1109 | PrimitiveBaseShape s = new PrimitiveBaseShape(); | 1250 | PrimitiveBaseShape s = new PrimitiveBaseShape(); |
@@ -1143,6 +1284,11 @@ namespace OpenSim.Data.MSSQL | |||
1143 | return s; | 1284 | return s; |
1144 | } | 1285 | } |
1145 | 1286 | ||
1287 | /// <summary> | ||
1288 | /// | ||
1289 | /// </summary> | ||
1290 | /// <param name="row"></param> | ||
1291 | /// <param name="prim"></param> | ||
1146 | private static void fillShapeRow(DataRow row, SceneObjectPart prim) | 1292 | private static void fillShapeRow(DataRow row, SceneObjectPart prim) |
1147 | { | 1293 | { |
1148 | PrimitiveBaseShape s = prim.Shape; | 1294 | PrimitiveBaseShape s = prim.Shape; |
@@ -1179,6 +1325,12 @@ namespace OpenSim.Data.MSSQL | |||
1179 | row["ExtraParams"] = s.ExtraParams; | 1325 | row["ExtraParams"] = s.ExtraParams; |
1180 | } | 1326 | } |
1181 | 1327 | ||
1328 | /// <summary> | ||
1329 | /// | ||
1330 | /// </summary> | ||
1331 | /// <param name="prim"></param> | ||
1332 | /// <param name="sceneGroupID"></param> | ||
1333 | /// <param name="regionUUID"></param> | ||
1182 | private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) | 1334 | private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) |
1183 | { | 1335 | { |
1184 | DataTable prims = m_dataSet.Tables["prims"]; | 1336 | DataTable prims = m_dataSet.Tables["prims"]; |
@@ -1209,7 +1361,11 @@ namespace OpenSim.Data.MSSQL | |||
1209 | } | 1361 | } |
1210 | } | 1362 | } |
1211 | 1363 | ||
1212 | // see IRegionDatastore | 1364 | /// <summary> |
1365 | /// See <see cref="IRegionDatastore"/> | ||
1366 | /// </summary> | ||
1367 | /// <param name="primID"></param> | ||
1368 | /// <param name="items"></param> | ||
1213 | public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) | 1369 | public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) |
1214 | { | 1370 | { |
1215 | if (!persistPrimInventories) | 1371 | if (!persistPrimInventories) |
@@ -1250,6 +1406,12 @@ namespace OpenSim.Data.MSSQL | |||
1250 | * | 1406 | * |
1251 | **********************************************************************/ | 1407 | **********************************************************************/ |
1252 | 1408 | ||
1409 | /// <summary> | ||
1410 | /// Create an Insert command | ||
1411 | /// </summary> | ||
1412 | /// <param name="table"></param> | ||
1413 | /// <param name="dt"></param> | ||
1414 | /// <returns>the sql command</returns> | ||
1253 | private static SqlCommand createInsertCommand(string table, DataTable dt) | 1415 | private static SqlCommand createInsertCommand(string table, DataTable dt) |
1254 | { | 1416 | { |
1255 | /** | 1417 | /** |
@@ -1285,6 +1447,13 @@ namespace OpenSim.Data.MSSQL | |||
1285 | return cmd; | 1447 | return cmd; |
1286 | } | 1448 | } |
1287 | 1449 | ||
1450 | /// <summary> | ||
1451 | /// Create an update command | ||
1452 | /// </summary> | ||
1453 | /// <param name="table"></param> | ||
1454 | /// <param name="pk"></param> | ||
1455 | /// <param name="dt"></param> | ||
1456 | /// <returns>the sql command</returns> | ||
1288 | private static SqlCommand createUpdateCommand(string table, string pk, DataTable dt) | 1457 | private static SqlCommand createUpdateCommand(string table, string pk, DataTable dt) |
1289 | { | 1458 | { |
1290 | string sql = "update " + table + " set "; | 1459 | string sql = "update " + table + " set "; |
@@ -1312,6 +1481,11 @@ namespace OpenSim.Data.MSSQL | |||
1312 | return cmd; | 1481 | return cmd; |
1313 | } | 1482 | } |
1314 | 1483 | ||
1484 | /// <summary> | ||
1485 | /// | ||
1486 | /// </summary> | ||
1487 | /// <param name="dt"></param> | ||
1488 | /// <returns></returns> | ||
1315 | private static string defineTable(DataTable dt) | 1489 | private static string defineTable(DataTable dt) |
1316 | { | 1490 | { |
1317 | string sql = "create table " + dt.TableName + "("; | 1491 | string sql = "create table " + dt.TableName + "("; |
@@ -1345,14 +1519,18 @@ namespace OpenSim.Data.MSSQL | |||
1345 | **********************************************************************/ | 1519 | **********************************************************************/ |
1346 | 1520 | ||
1347 | ///<summary> | 1521 | ///<summary> |
1522 | /// <para> | ||
1348 | /// This is a convenience function that collapses 5 repetitive | 1523 | /// This is a convenience function that collapses 5 repetitive |
1349 | /// lines for defining SqlParameters to 2 parameters: | 1524 | /// lines for defining SqlParameters to 2 parameters: |
1350 | /// column name and database type. | 1525 | /// column name and database type. |
1351 | /// | 1526 | /// </para> |
1527 | /// | ||
1528 | /// <para> | ||
1352 | /// It assumes certain conventions like :param as the param | 1529 | /// It assumes certain conventions like :param as the param |
1353 | /// name to replace in parametrized queries, and that source | 1530 | /// name to replace in parametrized queries, and that source |
1354 | /// version is always current version, both of which are fine | 1531 | /// version is always current version, both of which are fine |
1355 | /// for us. | 1532 | /// for us. |
1533 | /// </para> | ||
1356 | ///</summary> | 1534 | ///</summary> |
1357 | ///<returns>a built Sql parameter</returns> | 1535 | ///<returns>a built Sql parameter</returns> |
1358 | private static SqlParameter createSqlParameter(string name, Type type) | 1536 | private static SqlParameter createSqlParameter(string name, Type type) |
@@ -1365,6 +1543,11 @@ namespace OpenSim.Data.MSSQL | |||
1365 | return param; | 1543 | return param; |
1366 | } | 1544 | } |
1367 | 1545 | ||
1546 | /// <summary> | ||
1547 | /// | ||
1548 | /// </summary> | ||
1549 | /// <param name="da"></param> | ||
1550 | /// <param name="conn"></param> | ||
1368 | private void setupPrimCommands(SqlDataAdapter da, SqlConnection conn) | 1551 | private void setupPrimCommands(SqlDataAdapter da, SqlConnection conn) |
1369 | { | 1552 | { |
1370 | da.InsertCommand = createInsertCommand("prims", m_dataSet.Tables["prims"]); | 1553 | da.InsertCommand = createInsertCommand("prims", m_dataSet.Tables["prims"]); |
@@ -1379,6 +1562,11 @@ namespace OpenSim.Data.MSSQL | |||
1379 | da.DeleteCommand = delete; | 1562 | da.DeleteCommand = delete; |
1380 | } | 1563 | } |
1381 | 1564 | ||
1565 | /// <summary> | ||
1566 | /// | ||
1567 | /// </summary> | ||
1568 | /// <param name="da"></param> | ||
1569 | /// <param name="conn"></param> | ||
1382 | private void SetupItemsCommands(SqlDataAdapter da, SqlConnection conn) | 1570 | private void SetupItemsCommands(SqlDataAdapter da, SqlConnection conn) |
1383 | { | 1571 | { |
1384 | da.InsertCommand = createInsertCommand("primitems", m_itemsTable); | 1572 | da.InsertCommand = createInsertCommand("primitems", m_itemsTable); |
@@ -1393,12 +1581,22 @@ namespace OpenSim.Data.MSSQL | |||
1393 | da.DeleteCommand = delete; | 1581 | da.DeleteCommand = delete; |
1394 | } | 1582 | } |
1395 | 1583 | ||
1584 | /// <summary> | ||
1585 | /// | ||
1586 | /// </summary> | ||
1587 | /// <param name="da"></param> | ||
1588 | /// <param name="conn"></param> | ||
1396 | private void setupTerrainCommands(SqlDataAdapter da, SqlConnection conn) | 1589 | private void setupTerrainCommands(SqlDataAdapter da, SqlConnection conn) |
1397 | { | 1590 | { |
1398 | da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]); | 1591 | da.InsertCommand = createInsertCommand("terrain", m_dataSet.Tables["terrain"]); |
1399 | da.InsertCommand.Connection = conn; | 1592 | da.InsertCommand.Connection = conn; |
1400 | } | 1593 | } |
1401 | 1594 | ||
1595 | /// <summary> | ||
1596 | /// | ||
1597 | /// </summary> | ||
1598 | /// <param name="da"></param> | ||
1599 | /// <param name="conn"></param> | ||
1402 | private void setupLandCommands(SqlDataAdapter da, SqlConnection conn) | 1600 | private void setupLandCommands(SqlDataAdapter da, SqlConnection conn) |
1403 | { | 1601 | { |
1404 | da.InsertCommand = createInsertCommand("land", m_dataSet.Tables["land"]); | 1602 | da.InsertCommand = createInsertCommand("land", m_dataSet.Tables["land"]); |
@@ -1408,12 +1606,22 @@ namespace OpenSim.Data.MSSQL | |||
1408 | da.UpdateCommand.Connection = conn; | 1606 | da.UpdateCommand.Connection = conn; |
1409 | } | 1607 | } |
1410 | 1608 | ||
1609 | /// <summary> | ||
1610 | /// | ||
1611 | /// </summary> | ||
1612 | /// <param name="da"></param> | ||
1613 | /// <param name="conn"></param> | ||
1411 | private void setupLandAccessCommands(SqlDataAdapter da, SqlConnection conn) | 1614 | private void setupLandAccessCommands(SqlDataAdapter da, SqlConnection conn) |
1412 | { | 1615 | { |
1413 | da.InsertCommand = createInsertCommand("landaccesslist", m_dataSet.Tables["landaccesslist"]); | 1616 | da.InsertCommand = createInsertCommand("landaccesslist", m_dataSet.Tables["landaccesslist"]); |
1414 | da.InsertCommand.Connection = conn; | 1617 | da.InsertCommand.Connection = conn; |
1415 | } | 1618 | } |
1416 | 1619 | ||
1620 | /// <summary> | ||
1621 | /// | ||
1622 | /// </summary> | ||
1623 | /// <param name="da"></param> | ||
1624 | /// <param name="conn"></param> | ||
1417 | private void setupShapeCommands(SqlDataAdapter da, SqlConnection conn) | 1625 | private void setupShapeCommands(SqlDataAdapter da, SqlConnection conn) |
1418 | { | 1626 | { |
1419 | da.InsertCommand = createInsertCommand("primshapes", m_dataSet.Tables["primshapes"]); | 1627 | da.InsertCommand = createInsertCommand("primshapes", m_dataSet.Tables["primshapes"]); |
@@ -1428,6 +1636,10 @@ namespace OpenSim.Data.MSSQL | |||
1428 | da.DeleteCommand = delete; | 1636 | da.DeleteCommand = delete; |
1429 | } | 1637 | } |
1430 | 1638 | ||
1639 | /// <summary> | ||
1640 | /// | ||
1641 | /// </summary> | ||
1642 | /// <param name="conn"></param> | ||
1431 | private static void InitDB(SqlConnection conn) | 1643 | private static void InitDB(SqlConnection conn) |
1432 | { | 1644 | { |
1433 | string createPrims = defineTable(createPrimTable()); | 1645 | string createPrims = defineTable(createPrimTable()); |
@@ -1501,6 +1713,11 @@ namespace OpenSim.Data.MSSQL | |||
1501 | conn.Close(); | 1713 | conn.Close(); |
1502 | } | 1714 | } |
1503 | 1715 | ||
1716 | /// <summary> | ||
1717 | /// | ||
1718 | /// </summary> | ||
1719 | /// <param name="conn"></param> | ||
1720 | /// <returns></returns> | ||
1504 | private bool TestTables(SqlConnection conn) | 1721 | private bool TestTables(SqlConnection conn) |
1505 | { | 1722 | { |
1506 | SqlCommand primSelectCmd = new SqlCommand(m_primSelect, conn); | 1723 | SqlCommand primSelectCmd = new SqlCommand(m_primSelect, conn); |
@@ -1601,6 +1818,11 @@ namespace OpenSim.Data.MSSQL | |||
1601 | * | 1818 | * |
1602 | **********************************************************************/ | 1819 | **********************************************************************/ |
1603 | 1820 | ||
1821 | /// <summary> | ||
1822 | /// Type conversion function | ||
1823 | /// </summary> | ||
1824 | /// <param name="type">a Type</param> | ||
1825 | /// <returns>a DbType</returns> | ||
1604 | private static DbType dbtypeFromType(Type type) | 1826 | private static DbType dbtypeFromType(Type type) |
1605 | { | 1827 | { |
1606 | if (type == typeof(String)) | 1828 | if (type == typeof(String)) |
diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs index d7adb84..d67e463 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs | |||
@@ -37,7 +37,7 @@ using log4net; | |||
37 | namespace OpenSim.Data.MSSQL | 37 | namespace OpenSim.Data.MSSQL |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// A grid data interface for Microsoft SQL Server | 40 | /// A grid data interface for MSSQL Server |
41 | /// </summary> | 41 | /// </summary> |
42 | public class MSSQLGridData : GridDataBase | 42 | public class MSSQLGridData : GridDataBase |
43 | { | 43 | { |
@@ -53,6 +53,8 @@ namespace OpenSim.Data.MSSQL | |||
53 | /// <summary> | 53 | /// <summary> |
54 | /// Initialises the Grid Interface | 54 | /// Initialises the Grid Interface |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="connect">connect string</param> | ||
57 | /// <remarks>use mssql_connection.ini</remarks> | ||
56 | override public void Initialise(string connect) | 58 | override public void Initialise(string connect) |
57 | { | 59 | { |
58 | // TODO: make the connect string actually do something | 60 | // TODO: make the connect string actually do something |
@@ -77,6 +79,9 @@ namespace OpenSim.Data.MSSQL | |||
77 | TestTables(); | 79 | TestTables(); |
78 | } | 80 | } |
79 | 81 | ||
82 | /// <summary> | ||
83 | /// | ||
84 | /// </summary> | ||
80 | private void TestTables() | 85 | private void TestTables() |
81 | { | 86 | { |
82 | IDbCommand cmd = database.Query("SELECT TOP 1 * FROM "+m_regionsTableName, new Dictionary<string, string>()); | 87 | IDbCommand cmd = database.Query("SELECT TOP 1 * FROM "+m_regionsTableName, new Dictionary<string, string>()); |
@@ -102,7 +107,7 @@ namespace OpenSim.Data.MSSQL | |||
102 | } | 107 | } |
103 | 108 | ||
104 | /// <summary> | 109 | /// <summary> |
105 | /// Returns the storage system name | 110 | /// The name of this DB provider. |
106 | /// </summary> | 111 | /// </summary> |
107 | /// <returns>A string containing the storage system name</returns> | 112 | /// <returns>A string containing the storage system name</returns> |
108 | override public string getName() | 113 | override public string getName() |
@@ -111,7 +116,7 @@ namespace OpenSim.Data.MSSQL | |||
111 | } | 116 | } |
112 | 117 | ||
113 | /// <summary> | 118 | /// <summary> |
114 | /// Returns the storage system version | 119 | /// Database provider version. |
115 | /// </summary> | 120 | /// </summary> |
116 | /// <returns>A string containing the storage system version</returns> | 121 | /// <returns>A string containing the storage system version</returns> |
117 | override public string getVersion() | 122 | override public string getVersion() |
@@ -120,13 +125,15 @@ namespace OpenSim.Data.MSSQL | |||
120 | } | 125 | } |
121 | 126 | ||
122 | /// <summary> | 127 | /// <summary> |
128 | /// NOT IMPLEMENTED, | ||
123 | /// Returns a list of regions within the specified ranges | 129 | /// Returns a list of regions within the specified ranges |
124 | /// </summary> | 130 | /// </summary> |
125 | /// <param name="a">minimum X coordinate</param> | 131 | /// <param name="a">minimum X coordinate</param> |
126 | /// <param name="b">minimum Y coordinate</param> | 132 | /// <param name="b">minimum Y coordinate</param> |
127 | /// <param name="c">maximum X coordinate</param> | 133 | /// <param name="c">maximum X coordinate</param> |
128 | /// <param name="d">maximum Y coordinate</param> | 134 | /// <param name="d">maximum Y coordinate</param> |
129 | /// <returns>An array of region profiles</returns> | 135 | /// <returns>null</returns> |
136 | /// <remarks>always return null</remarks> | ||
130 | override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | 137 | override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) |
131 | { | 138 | { |
132 | return null; | 139 | return null; |
@@ -240,6 +247,11 @@ namespace OpenSim.Data.MSSQL | |||
240 | } | 247 | } |
241 | } | 248 | } |
242 | 249 | ||
250 | /// <summary> | ||
251 | /// Update the specified region in the database | ||
252 | /// </summary> | ||
253 | /// <param name="profile">The profile to update</param> | ||
254 | /// <returns>A dataresponse enum indicating success</returns> | ||
243 | public override DataResponse UpdateProfile(RegionProfileData profile) | 255 | public override DataResponse UpdateProfile(RegionProfileData profile) |
244 | { | 256 | { |
245 | if (updateRegionRow(profile)) | 257 | if (updateRegionRow(profile)) |
@@ -252,6 +264,11 @@ namespace OpenSim.Data.MSSQL | |||
252 | } | 264 | } |
253 | } | 265 | } |
254 | 266 | ||
267 | /// <summary> | ||
268 | /// Update the specified region in the database | ||
269 | /// </summary> | ||
270 | /// <param name="profile">The profile to update</param> | ||
271 | /// <returns>success ?</returns> | ||
255 | public bool updateRegionRow(RegionProfileData profile) | 272 | public bool updateRegionRow(RegionProfileData profile) |
256 | { | 273 | { |
257 | //Insert new region | 274 | //Insert new region |
@@ -425,6 +442,12 @@ namespace OpenSim.Data.MSSQL | |||
425 | return false; | 442 | return false; |
426 | } | 443 | } |
427 | 444 | ||
445 | /// <summary> | ||
446 | /// NOT IMPLEMENTED | ||
447 | /// </summary> | ||
448 | /// <param name="x"></param> | ||
449 | /// <param name="y"></param> | ||
450 | /// <returns>null</returns> | ||
428 | override public ReservationData GetReservationAtPoint(uint x, uint y) | 451 | override public ReservationData GetReservationAtPoint(uint x, uint y) |
429 | { | 452 | { |
430 | return null; | 453 | return null; |
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index b92eeab..3177325 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Framework; | |||
37 | namespace OpenSim.Data.MSSQL | 37 | namespace OpenSim.Data.MSSQL |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// A MySQL interface for the inventory server | 40 | /// A MSSQL interface for the inventory server |
41 | /// </summary> | 41 | /// </summary> |
42 | public class MSSQLInventoryData : IInventoryData | 42 | public class MSSQLInventoryData : IInventoryData |
43 | { | 43 | { |
@@ -59,6 +59,11 @@ namespace OpenSim.Data.MSSQL | |||
59 | /// </summary> | 59 | /// </summary> |
60 | private MSSQLManager database; | 60 | private MSSQLManager database; |
61 | 61 | ||
62 | /// <summary> | ||
63 | /// Loads and initialises the MSSQL inventory storage interface | ||
64 | /// </summary> | ||
65 | /// <param name="connect">connect string</param> | ||
66 | /// <remarks>use mssql_connection.ini</remarks> | ||
62 | public void Initialise(string connect) | 67 | public void Initialise(string connect) |
63 | { | 68 | { |
64 | // TODO: actually use the provided connect string | 69 | // TODO: actually use the provided connect string |
@@ -77,6 +82,10 @@ namespace OpenSim.Data.MSSQL | |||
77 | 82 | ||
78 | #region Test and initialization code | 83 | #region Test and initialization code |
79 | 84 | ||
85 | /// <summary> | ||
86 | /// Execute "CreateFoldersTable.sql" if tableName == null | ||
87 | /// </summary> | ||
88 | /// <param name="tableName">the table name</param> | ||
80 | private void UpgradeFoldersTable(string tableName) | 89 | private void UpgradeFoldersTable(string tableName) |
81 | { | 90 | { |
82 | // null as the version, indicates that the table didn't exist | 91 | // null as the version, indicates that the table didn't exist |
@@ -88,6 +97,10 @@ namespace OpenSim.Data.MSSQL | |||
88 | } | 97 | } |
89 | } | 98 | } |
90 | 99 | ||
100 | /// <summary> | ||
101 | /// Execute "CreateItemsTable.sql" if tableName = null | ||
102 | /// </summary> | ||
103 | /// <param name="tableName">the table name</param> | ||
91 | private void UpgradeItemsTable(string tableName) | 104 | private void UpgradeItemsTable(string tableName) |
92 | { | 105 | { |
93 | // null as the version, indicates that the table didn't exist | 106 | // null as the version, indicates that the table didn't exist |
@@ -99,6 +112,9 @@ namespace OpenSim.Data.MSSQL | |||
99 | } | 112 | } |
100 | } | 113 | } |
101 | 114 | ||
115 | /// <summary> | ||
116 | /// | ||
117 | /// </summary> | ||
102 | private void TestTables() | 118 | private void TestTables() |
103 | { | 119 | { |
104 | Dictionary<string, string> tableList = new Dictionary<string, string>(); | 120 | Dictionary<string, string> tableList = new Dictionary<string, string>(); |
@@ -117,7 +133,7 @@ namespace OpenSim.Data.MSSQL | |||
117 | /// <summary> | 133 | /// <summary> |
118 | /// The name of this DB provider | 134 | /// The name of this DB provider |
119 | /// </summary> | 135 | /// </summary> |
120 | /// <returns>Name of DB provider</returns> | 136 | /// <returns>A string containing the name of the DB provider</returns> |
121 | public string getName() | 137 | public string getName() |
122 | { | 138 | { |
123 | return "MSSQL Inventory Data Interface"; | 139 | return "MSSQL Inventory Data Interface"; |
@@ -215,7 +231,11 @@ namespace OpenSim.Data.MSSQL | |||
215 | } | 231 | } |
216 | } | 232 | } |
217 | 233 | ||
218 | // see InventoryItemBase.getUserRootFolder | 234 | /// <summary> |
235 | /// see InventoryItemBase.getUserRootFolder | ||
236 | /// </summary> | ||
237 | /// <param name="user">the User UUID</param> | ||
238 | /// <returns></returns> | ||
219 | public InventoryFolderBase getUserRootFolder(LLUUID user) | 239 | public InventoryFolderBase getUserRootFolder(LLUUID user) |
220 | { | 240 | { |
221 | try | 241 | try |
@@ -549,9 +569,9 @@ namespace OpenSim.Data.MSSQL | |||
549 | } | 569 | } |
550 | 570 | ||
551 | /// <summary> | 571 | /// <summary> |
552 | /// | 572 | /// Delete an item in inventory database |
553 | /// </summary> | 573 | /// </summary> |
554 | /// <param name="item"></param> | 574 | /// <param name="item">the item UUID</param> |
555 | public void deleteInventoryItem(LLUUID itemID) | 575 | public void deleteInventoryItem(LLUUID itemID) |
556 | { | 576 | { |
557 | try | 577 | try |
@@ -690,6 +710,10 @@ namespace OpenSim.Data.MSSQL | |||
690 | return folders; | 710 | return folders; |
691 | } | 711 | } |
692 | 712 | ||
713 | /// <summary> | ||
714 | /// Delete a folder in inventory databasae | ||
715 | /// </summary> | ||
716 | /// <param name="folderID">the folder UUID</param> | ||
693 | protected void deleteOneFolder(LLUUID folderID) | 717 | protected void deleteOneFolder(LLUUID folderID) |
694 | { | 718 | { |
695 | try | 719 | try |
@@ -708,6 +732,10 @@ namespace OpenSim.Data.MSSQL | |||
708 | } | 732 | } |
709 | } | 733 | } |
710 | 734 | ||
735 | /// <summary> | ||
736 | /// Delete an item in inventory database | ||
737 | /// </summary> | ||
738 | /// <param name="folderID">the item ID</param> | ||
711 | protected void deleteItemsInFolder(LLUUID folderID) | 739 | protected void deleteItemsInFolder(LLUUID folderID) |
712 | { | 740 | { |
713 | try | 741 | try |
diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index 3221b3a..a170a87 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs | |||
@@ -108,12 +108,23 @@ namespace OpenSim.Data.MSSQL | |||
108 | // return regions; | 108 | // return regions; |
109 | //} | 109 | //} |
110 | 110 | ||
111 | /// <summary> | ||
112 | /// | ||
113 | /// </summary> | ||
114 | /// <param name="dt"></param> | ||
115 | /// <param name="name"></param> | ||
116 | /// <param name="type"></param> | ||
111 | protected static void createCol(DataTable dt, string name, Type type) | 117 | protected static void createCol(DataTable dt, string name, Type type) |
112 | { | 118 | { |
113 | DataColumn col = new DataColumn(name, type); | 119 | DataColumn col = new DataColumn(name, type); |
114 | dt.Columns.Add(col); | 120 | dt.Columns.Add(col); |
115 | } | 121 | } |
116 | 122 | ||
123 | /// <summary> | ||
124 | /// | ||
125 | /// </summary> | ||
126 | /// <param name="dt"></param> | ||
127 | /// <returns></returns> | ||
117 | protected static string defineTable(DataTable dt) | 128 | protected static string defineTable(DataTable dt) |
118 | { | 129 | { |
119 | string sql = "create table " + dt.TableName + "("; | 130 | string sql = "create table " + dt.TableName + "("; |
@@ -137,9 +148,12 @@ namespace OpenSim.Data.MSSQL | |||
137 | return sql; | 148 | return sql; |
138 | } | 149 | } |
139 | 150 | ||
140 | 151 | /// <summary> | |
141 | // this is something we'll need to implement for each db | 152 | /// Type conversion function |
142 | // slightly differently. | 153 | /// </summary> |
154 | /// <param name="type">a type</param> | ||
155 | /// <returns>a sqltype</returns> | ||
156 | /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks> | ||
143 | public static string SqlType(Type type) | 157 | public static string SqlType(Type type) |
144 | { | 158 | { |
145 | if (type == typeof(String)) | 159 | if (type == typeof(String)) |
@@ -375,6 +389,11 @@ namespace OpenSim.Data.MSSQL | |||
375 | return retval; | 389 | return retval; |
376 | } | 390 | } |
377 | 391 | ||
392 | /// <summary> | ||
393 | /// | ||
394 | /// </summary> | ||
395 | /// <param name="reader"></param> | ||
396 | /// <returns></returns> | ||
378 | public AssetBase getAssetRow(IDataReader reader) | 397 | public AssetBase getAssetRow(IDataReader reader) |
379 | { | 398 | { |
380 | AssetBase asset = new AssetBase(); | 399 | AssetBase asset = new AssetBase(); |
@@ -446,7 +465,7 @@ namespace OpenSim.Data.MSSQL | |||
446 | /// <summary> | 465 | /// <summary> |
447 | /// Execute a SQL statement stored in a resource, as a string | 466 | /// Execute a SQL statement stored in a resource, as a string |
448 | /// </summary> | 467 | /// </summary> |
449 | /// <param name="name"></param> | 468 | /// <param name="name">the ressource string</param> |
450 | public void ExecuteResourceSql(string name) | 469 | public void ExecuteResourceSql(string name) |
451 | { | 470 | { |
452 | SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection)dbcon); | 471 | SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection)dbcon); |
@@ -454,6 +473,10 @@ namespace OpenSim.Data.MSSQL | |||
454 | cmd.Dispose(); | 473 | cmd.Dispose(); |
455 | } | 474 | } |
456 | 475 | ||
476 | /// <summary> | ||
477 | /// | ||
478 | /// </summary> | ||
479 | /// <returns>The actual SqlConnection</returns> | ||
457 | public SqlConnection getConnection() | 480 | public SqlConnection getConnection() |
458 | { | 481 | { |
459 | return (SqlConnection)dbcon; | 482 | return (SqlConnection)dbcon; |
@@ -491,6 +514,11 @@ namespace OpenSim.Data.MSSQL | |||
491 | } | 514 | } |
492 | } | 515 | } |
493 | 516 | ||
517 | /// <summary> | ||
518 | /// | ||
519 | /// </summary> | ||
520 | /// <param name="name"></param> | ||
521 | /// <returns></returns> | ||
494 | private string getResourceString(string name) | 522 | private string getResourceString(string name) |
495 | { | 523 | { |
496 | Assembly assem = GetType().Assembly; | 524 | Assembly assem = GetType().Assembly; |
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index 8714e2b..cb5ba24 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs | |||
@@ -53,8 +53,10 @@ namespace OpenSim.Data.MSSQL | |||
53 | private string m_userFriendsTableName; | 53 | private string m_userFriendsTableName; |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// Loads and initialises the MySQL storage plugin | 56 | /// Loads and initialises the MSSQL storage plugin |
57 | /// </summary> | 57 | /// </summary> |
58 | /// <param name="connect">TODO: do something with the connect string instead of ignoring it.</param> | ||
59 | /// <remarks>use mssql_connection.ini</remarks> | ||
58 | override public void Initialise(string connect) | 60 | override public void Initialise(string connect) |
59 | { | 61 | { |
60 | // TODO: do something with the connect string instead of | 62 | // TODO: do something with the connect string instead of |
@@ -92,6 +94,10 @@ namespace OpenSim.Data.MSSQL | |||
92 | TestTables(); | 94 | TestTables(); |
93 | } | 95 | } |
94 | 96 | ||
97 | /// <summary> | ||
98 | /// | ||
99 | /// </summary> | ||
100 | /// <returns></returns> | ||
95 | private bool TestTables() | 101 | private bool TestTables() |
96 | { | 102 | { |
97 | IDbCommand cmd; | 103 | IDbCommand cmd; |
@@ -128,6 +134,7 @@ namespace OpenSim.Data.MSSQL | |||
128 | 134 | ||
129 | return true; | 135 | return true; |
130 | } | 136 | } |
137 | |||
131 | /// <summary> | 138 | /// <summary> |
132 | /// Searches the database for a specified user profile by name components | 139 | /// Searches the database for a specified user profile by name components |
133 | /// </summary> | 140 | /// </summary> |
@@ -166,6 +173,12 @@ namespace OpenSim.Data.MSSQL | |||
166 | 173 | ||
167 | #region User Friends List Data | 174 | #region User Friends List Data |
168 | 175 | ||
176 | /// <summary> | ||
177 | /// Add a new friend in the friendlist | ||
178 | /// </summary> | ||
179 | /// <param name="friendlistowner">UUID of the friendlist owner</param> | ||
180 | /// <param name="friend">Friend's UUID</param> | ||
181 | /// <param name="perms">Permission flag</param> | ||
169 | override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) | 182 | override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) |
170 | { | 183 | { |
171 | int dtvalue = Util.UnixTimeSinceEpoch(); | 184 | int dtvalue = Util.UnixTimeSinceEpoch(); |
@@ -209,6 +222,11 @@ namespace OpenSim.Data.MSSQL | |||
209 | } | 222 | } |
210 | } | 223 | } |
211 | 224 | ||
225 | /// <summary> | ||
226 | /// Remove an friend from the friendlist | ||
227 | /// </summary> | ||
228 | /// <param name="friendlistowner">UUID of the friendlist owner</param> | ||
229 | /// <param name="friend">UUID of the not-so-friendly user to remove from the list</param> | ||
212 | override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) | 230 | override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) |
213 | { | 231 | { |
214 | Dictionary<string, string> param = new Dictionary<string, string>(); | 232 | Dictionary<string, string> param = new Dictionary<string, string>(); |
@@ -242,6 +260,12 @@ namespace OpenSim.Data.MSSQL | |||
242 | } | 260 | } |
243 | } | 261 | } |
244 | 262 | ||
263 | /// <summary> | ||
264 | /// Update friendlist permission flag for a friend | ||
265 | /// </summary> | ||
266 | /// <param name="friendlistowner">UUID of the friendlist owner</param> | ||
267 | /// <param name="friend">UUID of the friend</param> | ||
268 | /// <param name="perms">new permission flag</param> | ||
245 | override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) | 269 | override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) |
246 | { | 270 | { |
247 | Dictionary<string, string> param = new Dictionary<string, string>(); | 271 | Dictionary<string, string> param = new Dictionary<string, string>(); |
@@ -272,7 +296,11 @@ namespace OpenSim.Data.MSSQL | |||
272 | } | 296 | } |
273 | } | 297 | } |
274 | 298 | ||
275 | 299 | /// <summary> | |
300 | /// Get (fetch?) the user's friendlist | ||
301 | /// </summary> | ||
302 | /// <param name="friendlistowner">UUID of the friendlist owner</param> | ||
303 | /// <returns>Friendlist list</returns> | ||
276 | override public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) | 304 | override public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) |
277 | { | 305 | { |
278 | List<FriendListItem> Lfli = new List<FriendListItem>(); | 306 | List<FriendListItem> Lfli = new List<FriendListItem>(); |
@@ -321,13 +349,23 @@ namespace OpenSim.Data.MSSQL | |||
321 | 349 | ||
322 | #endregion | 350 | #endregion |
323 | 351 | ||
352 | /// <summary> | ||
353 | /// STUB ! Update current region | ||
354 | /// </summary> | ||
355 | /// <param name="avatarid">avatar uuid</param> | ||
356 | /// <param name="regionuuid">region uuid</param> | ||
357 | /// <param name="regionhandle">region handle</param> | ||
324 | override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) | 358 | override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) |
325 | { | 359 | { |
326 | //m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); | 360 | //m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); |
327 | } | 361 | } |
328 | 362 | ||
329 | 363 | /// <summary> | |
330 | 364 | /// | |
365 | /// </summary> | ||
366 | /// <param name="queryID"></param> | ||
367 | /// <param name="query"></param> | ||
368 | /// <returns></returns> | ||
331 | override public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) | 369 | override public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) |
332 | { | 370 | { |
333 | List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); | 371 | List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); |
@@ -407,7 +445,11 @@ namespace OpenSim.Data.MSSQL | |||
407 | return returnlist; | 445 | return returnlist; |
408 | } | 446 | } |
409 | 447 | ||
410 | // See IUserData | 448 | /// <summary> |
449 | /// See IUserData | ||
450 | /// </summary> | ||
451 | /// <param name="uuid"></param> | ||
452 | /// <returns></returns> | ||
411 | override public UserProfileData GetUserByUUID(LLUUID uuid) | 453 | override public UserProfileData GetUserByUUID(LLUUID uuid) |
412 | { | 454 | { |
413 | try | 455 | try |
@@ -490,6 +532,13 @@ namespace OpenSim.Data.MSSQL | |||
490 | return null; | 532 | return null; |
491 | } | 533 | } |
492 | } | 534 | } |
535 | |||
536 | /// <summary> | ||
537 | /// Store a weblogin key | ||
538 | /// </summary> | ||
539 | /// <param name="AgentID">The agent UUID</param> | ||
540 | /// <param name="WebLoginKey">the WebLogin Key</param> | ||
541 | /// <remarks>unused ?</remarks> | ||
493 | override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) | 542 | override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) |
494 | { | 543 | { |
495 | UserProfileData user = GetUserByUUID(AgentID); | 544 | UserProfileData user = GetUserByUUID(AgentID); |
@@ -626,7 +675,11 @@ namespace OpenSim.Data.MSSQL | |||
626 | // Do nothing. | 675 | // Do nothing. |
627 | } | 676 | } |
628 | 677 | ||
629 | 678 | /// <summary> | |
679 | /// update a user profile | ||
680 | /// </summary> | ||
681 | /// <param name="user">the profile to update</param> | ||
682 | /// <returns></returns> | ||
630 | override public bool UpdateUserProfile(UserProfileData user) | 683 | override public bool UpdateUserProfile(UserProfileData user) |
631 | { | 684 | { |
632 | SqlCommand command = new SqlCommand("UPDATE " + m_usersTableName + " set UUID = @uuid, " + | 685 | SqlCommand command = new SqlCommand("UPDATE " + m_usersTableName + " set UUID = @uuid, " + |
@@ -726,7 +779,7 @@ namespace OpenSim.Data.MSSQL | |||
726 | /// <param name="from">The senders account ID</param> | 779 | /// <param name="from">The senders account ID</param> |
727 | /// <param name="to">The receivers account ID</param> | 780 | /// <param name="to">The receivers account ID</param> |
728 | /// <param name="amount">The amount to transfer</param> | 781 | /// <param name="amount">The amount to transfer</param> |
729 | /// <returns>Success?</returns> | 782 | /// <returns>false</returns> |
730 | override public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) | 783 | override public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) |
731 | { | 784 | { |
732 | return false; | 785 | return false; |
@@ -739,7 +792,7 @@ namespace OpenSim.Data.MSSQL | |||
739 | /// <param name="from">The senders account ID</param> | 792 | /// <param name="from">The senders account ID</param> |
740 | /// <param name="to">The receivers account ID</param> | 793 | /// <param name="to">The receivers account ID</param> |
741 | /// <param name="item">The item to transfer</param> | 794 | /// <param name="item">The item to transfer</param> |
742 | /// <returns>Success?</returns> | 795 | /// <returns>false</returns> |
743 | override public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | 796 | override public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) |
744 | { | 797 | { |
745 | return false; | 798 | return false; |
@@ -832,6 +885,11 @@ namespace OpenSim.Data.MSSQL | |||
832 | return null; | 885 | return null; |
833 | } | 886 | } |
834 | 887 | ||
888 | /// <summary> | ||
889 | /// Update a user appearence into database | ||
890 | /// </summary> | ||
891 | /// <param name="user">the used UUID</param> | ||
892 | /// <param name="appearance">the appearence</param> | ||
835 | override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) | 893 | override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) |
836 | { | 894 | { |
837 | string sql = String.Empty; | 895 | string sql = String.Empty; |
@@ -893,16 +951,32 @@ namespace OpenSim.Data.MSSQL | |||
893 | return; | 951 | return; |
894 | } | 952 | } |
895 | 953 | ||
954 | /// <summary> | ||
955 | /// add an attachement to an avatar | ||
956 | /// </summary> | ||
957 | /// <param name="user">the avatar UUID</param> | ||
958 | /// <param name="item">the item UUID</param> | ||
896 | override public void AddAttachment(LLUUID user, LLUUID item) | 959 | override public void AddAttachment(LLUUID user, LLUUID item) |
897 | { | 960 | { |
898 | return; | 961 | return; |
899 | } | 962 | } |
900 | 963 | ||
964 | /// <summary> | ||
965 | /// Remove an attachement from an avatar | ||
966 | /// </summary> | ||
967 | /// <param name="user">the avatar UUID</param> | ||
968 | /// <param name="item">the item UUID</param> | ||
901 | override public void RemoveAttachment(LLUUID user, LLUUID item) | 969 | override public void RemoveAttachment(LLUUID user, LLUUID item) |
902 | { | 970 | { |
903 | return; | 971 | return; |
904 | } | 972 | } |
905 | 973 | ||
974 | /// <summary> | ||
975 | /// get (fetch?) all attached item to an avatar | ||
976 | /// </summary> | ||
977 | /// <param name="user">the avatar UUID</param> | ||
978 | /// <returns>List of attached item</returns> | ||
979 | /// <remarks>return an empty list</remarks> | ||
906 | override public List<LLUUID> GetAttachments(LLUUID user) | 980 | override public List<LLUUID> GetAttachments(LLUUID user) |
907 | { | 981 | { |
908 | return new List<LLUUID>(); | 982 | return new List<LLUUID>(); |