diff options
author | Melanie | 2010-09-13 16:16:40 +0100 |
---|---|---|
committer | Melanie | 2010-09-13 16:17:38 +0100 |
commit | 6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e (patch) | |
tree | 1e7bf4fddcf559886c6b2babf13cf4b2ca8829a1 /OpenSim/Data/SQLite | |
parent | Merge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff) | |
parent | Fix unit test SceneSetupHelpers to load the mock simulation data store (diff) | |
download | opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.zip opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.gz opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.bz2 opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.xz |
Merge branch 'master' into careminster-presence-refactor
The modules will need to be updated for this to compile and run again. Please
don't use until I do the companion commit to modules later on.
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteEstateData.cs | 9 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteSimulationData.cs (renamed from OpenSim/Data/SQLite/SQLiteRegionData.cs) | 70 |
3 files changed, 49 insertions, 36 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index fcf041e..d1d67eb 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs | |||
@@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLite | |||
49 | private Dictionary<string, FieldInfo> m_FieldMap = | 49 | private Dictionary<string, FieldInfo> m_FieldMap = |
50 | new Dictionary<string, FieldInfo>(); | 50 | new Dictionary<string, FieldInfo>(); |
51 | 51 | ||
52 | public SQLiteEstateStore() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | public SQLiteEstateStore(string connectionString) | ||
57 | { | ||
58 | Initialise(connectionString); | ||
59 | } | ||
60 | |||
52 | public void Initialise(string connectionString) | 61 | public void Initialise(string connectionString) |
53 | { | 62 | { |
54 | m_connectionString = connectionString; | 63 | m_connectionString = connectionString; |
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index ece2495..ecf8e02 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs | |||
@@ -731,12 +731,12 @@ namespace OpenSim.Data.SQLite | |||
731 | **********************************************************************/ | 731 | **********************************************************************/ |
732 | 732 | ||
733 | protected void CreateDataSetMapping(IDataAdapter da, string tableName) | 733 | protected void CreateDataSetMapping(IDataAdapter da, string tableName) |
734 | { | 734 | { |
735 | ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); | 735 | ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); |
736 | foreach (DataColumn col in ds.Tables[tableName].Columns) | 736 | foreach (DataColumn col in ds.Tables[tableName].Columns) |
737 | { | 737 | { |
738 | dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); | 738 | dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); |
739 | } | 739 | } |
740 | } | 740 | } |
741 | 741 | ||
742 | /// <summary> | 742 | /// <summary> |
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 88699a7..3e9bc3f 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite | |||
44 | /// <summary> | 44 | /// <summary> |
45 | /// A RegionData Interface to the SQLite database | 45 | /// A RegionData Interface to the SQLite database |
46 | /// </summary> | 46 | /// </summary> |
47 | public class SQLiteRegionData : IRegionDataStore | 47 | public class SQLiteSimulationData : ISimulationDataStore |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
@@ -70,6 +70,15 @@ namespace OpenSim.Data.SQLite | |||
70 | 70 | ||
71 | private String m_connectionString; | 71 | private String m_connectionString; |
72 | 72 | ||
73 | public SQLiteSimulationData() | ||
74 | { | ||
75 | } | ||
76 | |||
77 | public SQLiteSimulationData(string connectionString) | ||
78 | { | ||
79 | Initialise(connectionString); | ||
80 | } | ||
81 | |||
73 | // Temporary attribute while this is experimental | 82 | // Temporary attribute while this is experimental |
74 | 83 | ||
75 | /*********************************************************************** | 84 | /*********************************************************************** |
@@ -79,7 +88,6 @@ namespace OpenSim.Data.SQLite | |||
79 | **********************************************************************/ | 88 | **********************************************************************/ |
80 | 89 | ||
81 | /// <summary> | 90 | /// <summary> |
82 | /// See IRegionDataStore | ||
83 | /// <list type="bullet"> | 91 | /// <list type="bullet"> |
84 | /// <item>Initialises RegionData Interface</item> | 92 | /// <item>Initialises RegionData Interface</item> |
85 | /// <item>Loads and initialises a new SQLite connection and maintains it.</item> | 93 | /// <item>Loads and initialises a new SQLite connection and maintains it.</item> |
@@ -177,7 +185,7 @@ namespace OpenSim.Data.SQLite | |||
177 | { | 185 | { |
178 | m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); | 186 | m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); |
179 | } | 187 | } |
180 | 188 | ||
181 | try | 189 | try |
182 | { | 190 | { |
183 | terrainDa.Fill(ds.Tables["terrain"]); | 191 | terrainDa.Fill(ds.Tables["terrain"]); |
@@ -511,7 +519,7 @@ namespace OpenSim.Data.SQLite | |||
511 | "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); | 519 | "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); |
512 | prim.Shape = PrimitiveBaseShape.Default; | 520 | prim.Shape = PrimitiveBaseShape.Default; |
513 | } | 521 | } |
514 | 522 | ||
515 | createdObjects[new UUID(objID)].AddPart(prim); | 523 | createdObjects[new UUID(objID)].AddPart(prim); |
516 | LoadItems(prim); | 524 | LoadItems(prim); |
517 | } | 525 | } |
@@ -535,17 +543,17 @@ namespace OpenSim.Data.SQLite | |||
535 | /// </summary> | 543 | /// </summary> |
536 | /// <param name="prim">the prim</param> | 544 | /// <param name="prim">the prim</param> |
537 | private void LoadItems(SceneObjectPart prim) | 545 | private void LoadItems(SceneObjectPart prim) |
538 | { | 546 | { |
539 | // m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); | 547 | // m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); |
540 | 548 | ||
541 | DataTable dbItems = ds.Tables["primitems"]; | 549 | DataTable dbItems = ds.Tables["primitems"]; |
542 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); | 550 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); |
543 | DataRow[] dbItemRows = dbItems.Select(sql); | 551 | DataRow[] dbItemRows = dbItems.Select(sql); |
544 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); | 552 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); |
545 | 553 | ||
546 | // m_log.DebugFormat( | 554 | // m_log.DebugFormat( |
547 | // "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); | 555 | // "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); |
548 | 556 | ||
549 | foreach (DataRow row in dbItemRows) | 557 | foreach (DataRow row in dbItemRows) |
550 | { | 558 | { |
551 | TaskInventoryItem item = buildItem(row); | 559 | TaskInventoryItem item = buildItem(row); |
@@ -694,8 +702,6 @@ namespace OpenSim.Data.SQLite | |||
694 | { | 702 | { |
695 | landaccesslist.Rows.Remove(rowsToDelete[iter]); | 703 | landaccesslist.Rows.Remove(rowsToDelete[iter]); |
696 | } | 704 | } |
697 | |||
698 | |||
699 | } | 705 | } |
700 | Commit(); | 706 | Commit(); |
701 | } | 707 | } |
@@ -805,7 +811,7 @@ namespace OpenSim.Data.SQLite | |||
805 | try | 811 | try |
806 | { | 812 | { |
807 | regionSettingsDa.Update(ds, "regionsettings"); | 813 | regionSettingsDa.Update(ds, "regionsettings"); |
808 | } | 814 | } |
809 | catch (SqliteException SqlEx) | 815 | catch (SqliteException SqlEx) |
810 | { | 816 | { |
811 | throw new Exception( | 817 | throw new Exception( |
@@ -975,7 +981,7 @@ namespace OpenSim.Data.SQLite | |||
975 | createCol(prims, "CollisionSoundVolume", typeof(Double)); | 981 | createCol(prims, "CollisionSoundVolume", typeof(Double)); |
976 | 982 | ||
977 | createCol(prims, "VolumeDetect", typeof(Int16)); | 983 | createCol(prims, "VolumeDetect", typeof(Int16)); |
978 | 984 | ||
979 | createCol(prims, "MediaURL", typeof(String)); | 985 | createCol(prims, "MediaURL", typeof(String)); |
980 | 986 | ||
981 | // Add in contraints | 987 | // Add in contraints |
@@ -1192,10 +1198,10 @@ namespace OpenSim.Data.SQLite | |||
1192 | private SceneObjectPart buildPrim(DataRow row) | 1198 | private SceneObjectPart buildPrim(DataRow row) |
1193 | { | 1199 | { |
1194 | // Code commented. Uncomment to test the unit test inline. | 1200 | // Code commented. Uncomment to test the unit test inline. |
1195 | 1201 | ||
1196 | // The unit test mentions this commented code for the purposes | 1202 | // The unit test mentions this commented code for the purposes |
1197 | // of debugging a unit test failure | 1203 | // of debugging a unit test failure |
1198 | 1204 | ||
1199 | // SceneObjectGroup sog = new SceneObjectGroup(); | 1205 | // SceneObjectGroup sog = new SceneObjectGroup(); |
1200 | // SceneObjectPart sop = new SceneObjectPart(); | 1206 | // SceneObjectPart sop = new SceneObjectPart(); |
1201 | // sop.LocalId = 1; | 1207 | // sop.LocalId = 1; |
@@ -1212,7 +1218,7 @@ namespace OpenSim.Data.SQLite | |||
1212 | // TODO: this doesn't work yet because something more | 1218 | // TODO: this doesn't work yet because something more |
1213 | // interesting has to be done to actually get these values | 1219 | // interesting has to be done to actually get these values |
1214 | // back out. Not enough time to figure it out yet. | 1220 | // back out. Not enough time to figure it out yet. |
1215 | 1221 | ||
1216 | SceneObjectPart prim = new SceneObjectPart(); | 1222 | SceneObjectPart prim = new SceneObjectPart(); |
1217 | prim.UUID = new UUID((String) row["UUID"]); | 1223 | prim.UUID = new UUID((String) row["UUID"]); |
1218 | // explicit conversion of integers is required, which sort | 1224 | // explicit conversion of integers is required, which sort |
@@ -1342,7 +1348,7 @@ namespace OpenSim.Data.SQLite | |||
1342 | 1348 | ||
1343 | if (Convert.ToInt16(row["VolumeDetect"]) != 0) | 1349 | if (Convert.ToInt16(row["VolumeDetect"]) != 0) |
1344 | prim.VolumeDetectActive = true; | 1350 | prim.VolumeDetectActive = true; |
1345 | 1351 | ||
1346 | if (!(row["MediaURL"] is System.DBNull)) | 1352 | if (!(row["MediaURL"] is System.DBNull)) |
1347 | { | 1353 | { |
1348 | //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); | 1354 | //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); |
@@ -1681,7 +1687,7 @@ namespace OpenSim.Data.SQLite | |||
1681 | row["VolumeDetect"] = 1; | 1687 | row["VolumeDetect"] = 1; |
1682 | else | 1688 | else |
1683 | row["VolumeDetect"] = 0; | 1689 | row["VolumeDetect"] = 0; |
1684 | 1690 | ||
1685 | row["MediaURL"] = prim.MediaUrl; | 1691 | row["MediaURL"] = prim.MediaUrl; |
1686 | } | 1692 | } |
1687 | 1693 | ||
@@ -1759,12 +1765,12 @@ namespace OpenSim.Data.SQLite | |||
1759 | row["UserLookAtZ"] = land.UserLookAt.Z; | 1765 | row["UserLookAtZ"] = land.UserLookAt.Z; |
1760 | row["AuthbuyerID"] = land.AuthBuyerID.ToString(); | 1766 | row["AuthbuyerID"] = land.AuthBuyerID.ToString(); |
1761 | row["OtherCleanTime"] = land.OtherCleanTime; | 1767 | row["OtherCleanTime"] = land.OtherCleanTime; |
1762 | row["MediaType"] = land.MediaType; | 1768 | row["MediaType"] = land.MediaType; |
1763 | row["MediaDescription"] = land.MediaDescription; | 1769 | row["MediaDescription"] = land.MediaDescription; |
1764 | row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); | 1770 | row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); |
1765 | row["MediaLoop"] = land.MediaLoop.ToString(); | 1771 | row["MediaLoop"] = land.MediaLoop.ToString(); |
1766 | row["ObscureMusic"] = land.ObscureMusic.ToString(); | 1772 | row["ObscureMusic"] = land.ObscureMusic.ToString(); |
1767 | row["ObscureMedia"] = land.ObscureMedia.ToString(); | 1773 | row["ObscureMedia"] = land.ObscureMedia.ToString(); |
1768 | } | 1774 | } |
1769 | 1775 | ||
1770 | /// <summary> | 1776 | /// <summary> |
@@ -1862,10 +1868,10 @@ namespace OpenSim.Data.SQLite | |||
1862 | s.TextureEntry = textureEntry; | 1868 | s.TextureEntry = textureEntry; |
1863 | 1869 | ||
1864 | s.ExtraParams = (byte[]) row["ExtraParams"]; | 1870 | s.ExtraParams = (byte[]) row["ExtraParams"]; |
1865 | 1871 | ||
1866 | if (!(row["Media"] is System.DBNull)) | 1872 | if (!(row["Media"] is System.DBNull)) |
1867 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); | 1873 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); |
1868 | 1874 | ||
1869 | return s; | 1875 | return s; |
1870 | } | 1876 | } |
1871 | 1877 | ||
@@ -1909,7 +1915,7 @@ namespace OpenSim.Data.SQLite | |||
1909 | 1915 | ||
1910 | row["Texture"] = s.TextureEntry; | 1916 | row["Texture"] = s.TextureEntry; |
1911 | row["ExtraParams"] = s.ExtraParams; | 1917 | row["ExtraParams"] = s.ExtraParams; |
1912 | 1918 | ||
1913 | if (s.Media != null) | 1919 | if (s.Media != null) |
1914 | row["Media"] = s.Media.ToXml(); | 1920 | row["Media"] = s.Media.ToXml(); |
1915 | } | 1921 | } |
@@ -1951,7 +1957,6 @@ namespace OpenSim.Data.SQLite | |||
1951 | } | 1957 | } |
1952 | 1958 | ||
1953 | /// <summary> | 1959 | /// <summary> |
1954 | /// see IRegionDatastore | ||
1955 | /// </summary> | 1960 | /// </summary> |
1956 | /// <param name="primID"></param> | 1961 | /// <param name="primID"></param> |
1957 | /// <param name="items"></param> | 1962 | /// <param name="items"></param> |
@@ -2248,7 +2253,6 @@ namespace OpenSim.Data.SQLite | |||
2248 | delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); | 2253 | delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); |
2249 | da.DeleteCommand = delete; | 2254 | da.DeleteCommand = delete; |
2250 | da.DeleteCommand.Connection = conn; | 2255 | da.DeleteCommand.Connection = conn; |
2251 | |||
2252 | } | 2256 | } |
2253 | 2257 | ||
2254 | private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) | 2258 | private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) |
@@ -2320,7 +2324,7 @@ namespace OpenSim.Data.SQLite | |||
2320 | return DbType.String; | 2324 | return DbType.String; |
2321 | } | 2325 | } |
2322 | } | 2326 | } |
2323 | 2327 | ||
2324 | static void PrintDataSet(DataSet ds) | 2328 | static void PrintDataSet(DataSet ds) |
2325 | { | 2329 | { |
2326 | // Print out any name and extended properties. | 2330 | // Print out any name and extended properties. |