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 /OpenSim/Data/MSSQL/MSSQLDataStore.cs | |
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!
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLDataStore.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLDataStore.cs | 230 |
1 files changed, 226 insertions, 4 deletions
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)) |