diff options
author | John Hurliman | 2010-09-12 14:21:51 -0700 |
---|---|---|
committer | John Hurliman | 2010-09-12 14:21:51 -0700 |
commit | c03b24cbfdc449cf326cf0f560395753339169dc (patch) | |
tree | d62a666839d3c638b5c9799c70be971a2d6d6c18 /OpenSim/Data | |
parent | * Added ISimulationDataService and IEstateDataService (diff) | |
parent | Formatting cleanup. (diff) | |
download | opensim-SC_OLD-c03b24cbfdc449cf326cf0f560395753339169dc.zip opensim-SC_OLD-c03b24cbfdc449cf326cf0f560395753339169dc.tar.gz opensim-SC_OLD-c03b24cbfdc449cf326cf0f560395753339169dc.tar.bz2 opensim-SC_OLD-c03b24cbfdc449cf326cf0f560395753339169dc.tar.xz |
Merged
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/DBGuids.cs | 31 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/Migration.cs | 14 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLInventoryData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 22 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullInventoryData.cs | 29 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteSimulationData.cs | 57 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicDataServiceTest.cs | 39 | ||||
-rw-r--r-- | OpenSim/Data/Tests/DefaultTestConns.cs | 29 |
10 files changed, 170 insertions, 65 deletions
diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs index fb6832b..ad1c19c 100644 --- a/OpenSim/Data/DBGuids.cs +++ b/OpenSim/Data/DBGuids.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using System.Text; | 30 | using System.Text; |
4 | using OpenMetaverse; | 31 | using OpenMetaverse; |
@@ -17,7 +44,7 @@ namespace OpenSim.Data | |||
17 | /// <returns></returns> | 44 | /// <returns></returns> |
18 | public static UUID FromDB(object id) | 45 | public static UUID FromDB(object id) |
19 | { | 46 | { |
20 | if( (id == null) || (id == DBNull.Value)) | 47 | if ((id == null) || (id == DBNull.Value)) |
21 | return UUID.Zero; | 48 | return UUID.Zero; |
22 | 49 | ||
23 | if (id.GetType() == typeof(Guid)) | 50 | if (id.GetType() == typeof(Guid)) |
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 8532af4..8eae0a2 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |||
@@ -1136,7 +1136,7 @@ VALUES | |||
1136 | prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); | 1136 | prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); |
1137 | 1137 | ||
1138 | if (!(primRow["MediaURL"] is System.DBNull)) | 1138 | if (!(primRow["MediaURL"] is System.DBNull)) |
1139 | prim.MediaUrl = (string)primRow["MediaURL"]; | 1139 | prim.MediaUrl = (string)primRow["MediaURL"]; |
1140 | 1140 | ||
1141 | return prim; | 1141 | return prim; |
1142 | } | 1142 | } |
@@ -1190,7 +1190,7 @@ VALUES | |||
1190 | { | 1190 | { |
1191 | } | 1191 | } |
1192 | 1192 | ||
1193 | if (!(shapeRow["Media"] is System.DBNull)) | 1193 | if (!(shapeRow["Media"] is System.DBNull)) |
1194 | baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); | 1194 | baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); |
1195 | 1195 | ||
1196 | return baseShape; | 1196 | return baseShape; |
@@ -1521,7 +1521,7 @@ VALUES | |||
1521 | parameters.Add(_Database.CreateParameter("PassTouches", 1)); | 1521 | parameters.Add(_Database.CreateParameter("PassTouches", 1)); |
1522 | else | 1522 | else |
1523 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); | 1523 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); |
1524 | parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); | 1524 | parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); |
1525 | parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); | 1525 | parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); |
1526 | 1526 | ||
1527 | return parameters.ToArray(); | 1527 | return parameters.ToArray(); |
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 86531d9..fc9a142 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Data | |||
122 | int ver = FindVersion(_conn, "migrations"); | 122 | int ver = FindVersion(_conn, "migrations"); |
123 | if (ver <= 0) // -1 = no table, 0 = no version record | 123 | if (ver <= 0) // -1 = no table, 0 = no version record |
124 | { | 124 | { |
125 | if( ver < 0 ) | 125 | if (ver < 0) |
126 | ExecuteScript("create table migrations(name varchar(100), version int)"); | 126 | ExecuteScript("create table migrations(name varchar(100), version int)"); |
127 | InsertVersion("migrations", 1); | 127 | InsertVersion("migrations", 1); |
128 | } | 128 | } |
@@ -288,7 +288,7 @@ namespace OpenSim.Data | |||
288 | SortedList<int, string[]> migrations = new SortedList<int, string[]>(); | 288 | SortedList<int, string[]> migrations = new SortedList<int, string[]>(); |
289 | 289 | ||
290 | string[] names = _assem.GetManifestResourceNames(); | 290 | string[] names = _assem.GetManifestResourceNames(); |
291 | if( names.Length == 0 ) // should never happen | 291 | if (names.Length == 0) // should never happen |
292 | return migrations; | 292 | return migrations; |
293 | 293 | ||
294 | Array.Sort(names); // we want all the migrations ordered | 294 | Array.Sort(names); // we want all the migrations ordered |
@@ -297,7 +297,7 @@ namespace OpenSim.Data | |||
297 | Match m = null; | 297 | Match m = null; |
298 | string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase | 298 | string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase |
299 | 299 | ||
300 | if( (m != null) && !String.IsNullOrEmpty(sFile) ) | 300 | if ((m != null) && !String.IsNullOrEmpty(sFile)) |
301 | { | 301 | { |
302 | /* The filename should be '<StoreName>.migrations[.NNN]' where NNN | 302 | /* The filename should be '<StoreName>.migrations[.NNN]' where NNN |
303 | * is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip | 303 | * is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip |
@@ -312,7 +312,7 @@ namespace OpenSim.Data | |||
312 | 312 | ||
313 | if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound)) | 313 | if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound)) |
314 | { | 314 | { |
315 | if( nLastVerFound <= after ) | 315 | if (nLastVerFound <= after) |
316 | goto scan_old_style; | 316 | goto scan_old_style; |
317 | } | 317 | } |
318 | 318 | ||
@@ -329,7 +329,7 @@ namespace OpenSim.Data | |||
329 | sb.Length = 0; | 329 | sb.Length = 0; |
330 | } | 330 | } |
331 | 331 | ||
332 | if ( (nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list | 332 | if ((nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list |
333 | { | 333 | { |
334 | migrations[nVersion] = script.ToArray(); | 334 | migrations[nVersion] = script.ToArray(); |
335 | } | 335 | } |
@@ -345,7 +345,7 @@ namespace OpenSim.Data | |||
345 | string sLine = resourceReader.ReadLine(); | 345 | string sLine = resourceReader.ReadLine(); |
346 | nLineNo++; | 346 | nLineNo++; |
347 | 347 | ||
348 | if( String.IsNullOrEmpty(sLine) || sLine.StartsWith("#") ) // ignore a comment or empty line | 348 | if (String.IsNullOrEmpty(sLine) || sLine.StartsWith("#")) // ignore a comment or empty line |
349 | continue; | 349 | continue; |
350 | 350 | ||
351 | if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase)) | 351 | if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase)) |
@@ -392,7 +392,7 @@ scan_old_style: | |||
392 | if (m.Success) | 392 | if (m.Success) |
393 | { | 393 | { |
394 | int version = int.Parse(m.Groups[1].ToString()); | 394 | int version = int.Parse(m.Groups[1].ToString()); |
395 | if ( (version > after) && !migrations.ContainsKey(version) ) | 395 | if ((version > after) && !migrations.ContainsKey(version)) |
396 | { | 396 | { |
397 | using (Stream resource = _assem.GetManifestResourceStream(s)) | 397 | using (Stream resource = _assem.GetManifestResourceStream(s)) |
398 | { | 398 | { |
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 0aea30f..2dca3eb 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -286,7 +286,7 @@ namespace OpenSim.Data.MySQL | |||
286 | InventoryItemBase item = new InventoryItemBase(); | 286 | InventoryItemBase item = new InventoryItemBase(); |
287 | 287 | ||
288 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. | 288 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. |
289 | // ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero ) | 289 | // (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero) |
290 | item.CreatorId = reader["creatorID"].ToString(); | 290 | item.CreatorId = reader["creatorID"].ToString(); |
291 | 291 | ||
292 | // Be a bit safer in parsing these because the | 292 | // Be a bit safer in parsing these because the |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index ac752f6..87f6d07 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -689,7 +689,7 @@ namespace OpenSim.Data.MySQL | |||
689 | "UserLocationX, UserLocationY, UserLocationZ, " + | 689 | "UserLocationX, UserLocationY, UserLocationZ, " + |
690 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + | 690 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + |
691 | "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + | 691 | "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + |
692 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + | 692 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + |
693 | "?UUID, ?RegionUUID, " + | 693 | "?UUID, ?RegionUUID, " + |
694 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + | 694 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + |
695 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + | 695 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + |
@@ -700,7 +700,7 @@ namespace OpenSim.Data.MySQL | |||
700 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + | 700 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + |
701 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + | 701 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + |
702 | "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ | 702 | "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ |
703 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; | 703 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; |
704 | 704 | ||
705 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); | 705 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); |
706 | 706 | ||
@@ -737,7 +737,7 @@ namespace OpenSim.Data.MySQL | |||
737 | 737 | ||
738 | string command = "select * from `regionwindlight` where region_id = ?regionID"; | 738 | string command = "select * from `regionwindlight` where region_id = ?regionID"; |
739 | 739 | ||
740 | using(MySqlCommand cmd = new MySqlCommand(command)) | 740 | using (MySqlCommand cmd = new MySqlCommand(command)) |
741 | { | 741 | { |
742 | cmd.Connection = dbcon; | 742 | cmd.Connection = dbcon; |
743 | 743 | ||
@@ -1359,13 +1359,13 @@ namespace OpenSim.Data.MySQL | |||
1359 | m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); | 1359 | m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); |
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | newData.MediaDescription = (string) row["MediaDescription"]; | 1362 | newData.MediaDescription = (string) row["MediaDescription"]; |
1363 | newData.MediaType = (string) row["MediaType"]; | 1363 | newData.MediaType = (string) row["MediaType"]; |
1364 | newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); | 1364 | newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); |
1365 | newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); | 1365 | newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); |
1366 | newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); | 1366 | newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); |
1367 | newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); | 1367 | newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); |
1368 | newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); | 1368 | newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); |
1369 | 1369 | ||
1370 | newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); | 1370 | newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); |
1371 | 1371 | ||
@@ -1733,7 +1733,7 @@ namespace OpenSim.Data.MySQL | |||
1733 | 1733 | ||
1734 | s.State = (byte)(int)row["State"]; | 1734 | s.State = (byte)(int)row["State"]; |
1735 | 1735 | ||
1736 | if (!(row["Media"] is System.DBNull)) | 1736 | if (!(row["Media"] is System.DBNull)) |
1737 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); | 1737 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); |
1738 | 1738 | ||
1739 | return s; | 1739 | return s; |
diff --git a/OpenSim/Data/Null/NullInventoryData.cs b/OpenSim/Data/Null/NullInventoryData.cs index 8f196e2..fe9ed01 100644 --- a/OpenSim/Data/Null/NullInventoryData.cs +++ b/OpenSim/Data/Null/NullInventoryData.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | 30 | ||
4 | using OpenMetaverse; | 31 | using OpenMetaverse; |
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/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 7e62e84..3e9bc3f 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -185,7 +185,7 @@ namespace OpenSim.Data.SQLite | |||
185 | { | 185 | { |
186 | 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"); |
187 | } | 187 | } |
188 | 188 | ||
189 | try | 189 | try |
190 | { | 190 | { |
191 | terrainDa.Fill(ds.Tables["terrain"]); | 191 | terrainDa.Fill(ds.Tables["terrain"]); |
@@ -519,7 +519,7 @@ namespace OpenSim.Data.SQLite | |||
519 | "[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"); |
520 | prim.Shape = PrimitiveBaseShape.Default; | 520 | prim.Shape = PrimitiveBaseShape.Default; |
521 | } | 521 | } |
522 | 522 | ||
523 | createdObjects[new UUID(objID)].AddPart(prim); | 523 | createdObjects[new UUID(objID)].AddPart(prim); |
524 | LoadItems(prim); | 524 | LoadItems(prim); |
525 | } | 525 | } |
@@ -543,17 +543,17 @@ namespace OpenSim.Data.SQLite | |||
543 | /// </summary> | 543 | /// </summary> |
544 | /// <param name="prim">the prim</param> | 544 | /// <param name="prim">the prim</param> |
545 | private void LoadItems(SceneObjectPart prim) | 545 | private void LoadItems(SceneObjectPart prim) |
546 | { | 546 | { |
547 | // 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); |
548 | 548 | ||
549 | DataTable dbItems = ds.Tables["primitems"]; | 549 | DataTable dbItems = ds.Tables["primitems"]; |
550 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); | 550 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); |
551 | DataRow[] dbItemRows = dbItems.Select(sql); | 551 | DataRow[] dbItemRows = dbItems.Select(sql); |
552 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); | 552 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); |
553 | 553 | ||
554 | // m_log.DebugFormat( | 554 | // m_log.DebugFormat( |
555 | // "[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); |
556 | 556 | ||
557 | foreach (DataRow row in dbItemRows) | 557 | foreach (DataRow row in dbItemRows) |
558 | { | 558 | { |
559 | TaskInventoryItem item = buildItem(row); | 559 | TaskInventoryItem item = buildItem(row); |
@@ -702,8 +702,6 @@ namespace OpenSim.Data.SQLite | |||
702 | { | 702 | { |
703 | landaccesslist.Rows.Remove(rowsToDelete[iter]); | 703 | landaccesslist.Rows.Remove(rowsToDelete[iter]); |
704 | } | 704 | } |
705 | |||
706 | |||
707 | } | 705 | } |
708 | Commit(); | 706 | Commit(); |
709 | } | 707 | } |
@@ -813,7 +811,7 @@ namespace OpenSim.Data.SQLite | |||
813 | try | 811 | try |
814 | { | 812 | { |
815 | regionSettingsDa.Update(ds, "regionsettings"); | 813 | regionSettingsDa.Update(ds, "regionsettings"); |
816 | } | 814 | } |
817 | catch (SqliteException SqlEx) | 815 | catch (SqliteException SqlEx) |
818 | { | 816 | { |
819 | throw new Exception( | 817 | throw new Exception( |
@@ -983,7 +981,7 @@ namespace OpenSim.Data.SQLite | |||
983 | createCol(prims, "CollisionSoundVolume", typeof(Double)); | 981 | createCol(prims, "CollisionSoundVolume", typeof(Double)); |
984 | 982 | ||
985 | createCol(prims, "VolumeDetect", typeof(Int16)); | 983 | createCol(prims, "VolumeDetect", typeof(Int16)); |
986 | 984 | ||
987 | createCol(prims, "MediaURL", typeof(String)); | 985 | createCol(prims, "MediaURL", typeof(String)); |
988 | 986 | ||
989 | // Add in contraints | 987 | // Add in contraints |
@@ -1200,10 +1198,10 @@ namespace OpenSim.Data.SQLite | |||
1200 | private SceneObjectPart buildPrim(DataRow row) | 1198 | private SceneObjectPart buildPrim(DataRow row) |
1201 | { | 1199 | { |
1202 | // Code commented. Uncomment to test the unit test inline. | 1200 | // Code commented. Uncomment to test the unit test inline. |
1203 | 1201 | ||
1204 | // The unit test mentions this commented code for the purposes | 1202 | // The unit test mentions this commented code for the purposes |
1205 | // of debugging a unit test failure | 1203 | // of debugging a unit test failure |
1206 | 1204 | ||
1207 | // SceneObjectGroup sog = new SceneObjectGroup(); | 1205 | // SceneObjectGroup sog = new SceneObjectGroup(); |
1208 | // SceneObjectPart sop = new SceneObjectPart(); | 1206 | // SceneObjectPart sop = new SceneObjectPart(); |
1209 | // sop.LocalId = 1; | 1207 | // sop.LocalId = 1; |
@@ -1220,7 +1218,7 @@ namespace OpenSim.Data.SQLite | |||
1220 | // TODO: this doesn't work yet because something more | 1218 | // TODO: this doesn't work yet because something more |
1221 | // interesting has to be done to actually get these values | 1219 | // interesting has to be done to actually get these values |
1222 | // back out. Not enough time to figure it out yet. | 1220 | // back out. Not enough time to figure it out yet. |
1223 | 1221 | ||
1224 | SceneObjectPart prim = new SceneObjectPart(); | 1222 | SceneObjectPart prim = new SceneObjectPart(); |
1225 | prim.UUID = new UUID((String) row["UUID"]); | 1223 | prim.UUID = new UUID((String) row["UUID"]); |
1226 | // explicit conversion of integers is required, which sort | 1224 | // explicit conversion of integers is required, which sort |
@@ -1350,7 +1348,7 @@ namespace OpenSim.Data.SQLite | |||
1350 | 1348 | ||
1351 | if (Convert.ToInt16(row["VolumeDetect"]) != 0) | 1349 | if (Convert.ToInt16(row["VolumeDetect"]) != 0) |
1352 | prim.VolumeDetectActive = true; | 1350 | prim.VolumeDetectActive = true; |
1353 | 1351 | ||
1354 | if (!(row["MediaURL"] is System.DBNull)) | 1352 | if (!(row["MediaURL"] is System.DBNull)) |
1355 | { | 1353 | { |
1356 | //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); | 1354 | //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); |
@@ -1689,7 +1687,7 @@ namespace OpenSim.Data.SQLite | |||
1689 | row["VolumeDetect"] = 1; | 1687 | row["VolumeDetect"] = 1; |
1690 | else | 1688 | else |
1691 | row["VolumeDetect"] = 0; | 1689 | row["VolumeDetect"] = 0; |
1692 | 1690 | ||
1693 | row["MediaURL"] = prim.MediaUrl; | 1691 | row["MediaURL"] = prim.MediaUrl; |
1694 | } | 1692 | } |
1695 | 1693 | ||
@@ -1767,12 +1765,12 @@ namespace OpenSim.Data.SQLite | |||
1767 | row["UserLookAtZ"] = land.UserLookAt.Z; | 1765 | row["UserLookAtZ"] = land.UserLookAt.Z; |
1768 | row["AuthbuyerID"] = land.AuthBuyerID.ToString(); | 1766 | row["AuthbuyerID"] = land.AuthBuyerID.ToString(); |
1769 | row["OtherCleanTime"] = land.OtherCleanTime; | 1767 | row["OtherCleanTime"] = land.OtherCleanTime; |
1770 | row["MediaType"] = land.MediaType; | 1768 | row["MediaType"] = land.MediaType; |
1771 | row["MediaDescription"] = land.MediaDescription; | 1769 | row["MediaDescription"] = land.MediaDescription; |
1772 | row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); | 1770 | row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); |
1773 | row["MediaLoop"] = land.MediaLoop.ToString(); | 1771 | row["MediaLoop"] = land.MediaLoop.ToString(); |
1774 | row["ObscureMusic"] = land.ObscureMusic.ToString(); | 1772 | row["ObscureMusic"] = land.ObscureMusic.ToString(); |
1775 | row["ObscureMedia"] = land.ObscureMedia.ToString(); | 1773 | row["ObscureMedia"] = land.ObscureMedia.ToString(); |
1776 | } | 1774 | } |
1777 | 1775 | ||
1778 | /// <summary> | 1776 | /// <summary> |
@@ -1870,10 +1868,10 @@ namespace OpenSim.Data.SQLite | |||
1870 | s.TextureEntry = textureEntry; | 1868 | s.TextureEntry = textureEntry; |
1871 | 1869 | ||
1872 | s.ExtraParams = (byte[]) row["ExtraParams"]; | 1870 | s.ExtraParams = (byte[]) row["ExtraParams"]; |
1873 | 1871 | ||
1874 | if (!(row["Media"] is System.DBNull)) | 1872 | if (!(row["Media"] is System.DBNull)) |
1875 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); | 1873 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); |
1876 | 1874 | ||
1877 | return s; | 1875 | return s; |
1878 | } | 1876 | } |
1879 | 1877 | ||
@@ -1917,7 +1915,7 @@ namespace OpenSim.Data.SQLite | |||
1917 | 1915 | ||
1918 | row["Texture"] = s.TextureEntry; | 1916 | row["Texture"] = s.TextureEntry; |
1919 | row["ExtraParams"] = s.ExtraParams; | 1917 | row["ExtraParams"] = s.ExtraParams; |
1920 | 1918 | ||
1921 | if (s.Media != null) | 1919 | if (s.Media != null) |
1922 | row["Media"] = s.Media.ToXml(); | 1920 | row["Media"] = s.Media.ToXml(); |
1923 | } | 1921 | } |
@@ -2255,7 +2253,6 @@ namespace OpenSim.Data.SQLite | |||
2255 | delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); | 2253 | delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); |
2256 | da.DeleteCommand = delete; | 2254 | da.DeleteCommand = delete; |
2257 | da.DeleteCommand.Connection = conn; | 2255 | da.DeleteCommand.Connection = conn; |
2258 | |||
2259 | } | 2256 | } |
2260 | 2257 | ||
2261 | private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) | 2258 | private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) |
@@ -2327,7 +2324,7 @@ namespace OpenSim.Data.SQLite | |||
2327 | return DbType.String; | 2324 | return DbType.String; |
2328 | } | 2325 | } |
2329 | } | 2326 | } |
2330 | 2327 | ||
2331 | static void PrintDataSet(DataSet ds) | 2328 | static void PrintDataSet(DataSet ds) |
2332 | { | 2329 | { |
2333 | // Print out any name and extended properties. | 2330 | // Print out any name and extended properties. |
diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index c261126..7d85f0c 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.IO; | 29 | using System.IO; |
3 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
4 | using log4net.Config; | 31 | using log4net.Config; |
@@ -41,13 +68,13 @@ namespace OpenSim.Data.Tests | |||
41 | { | 68 | { |
42 | m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn)); | 69 | m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn)); |
43 | 70 | ||
44 | m_log = LogManager.GetLogger(this.GetType()); | 71 | m_log = LogManager.GetLogger(this.GetType()); |
45 | OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right? | 72 | OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right? |
46 | } | 73 | } |
47 | 74 | ||
48 | /// <summary> | 75 | /// <summary> |
49 | /// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it. | 76 | /// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it. |
50 | /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. | 77 | /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. |
51 | /// This framework takes care of disposing it, if it's disposable. | 78 | /// This framework takes care of disposing it, if it's disposable. |
52 | /// </summary> | 79 | /// </summary> |
53 | /// <param name="service">The service being tested</param> | 80 | /// <param name="service">The service being tested</param> |
@@ -118,12 +145,12 @@ namespace OpenSim.Data.Tests | |||
118 | { | 145 | { |
119 | if (m_service != null) | 146 | if (m_service != null) |
120 | { | 147 | { |
121 | if( m_service is IDisposable) | 148 | if (m_service is IDisposable) |
122 | ((IDisposable)m_service).Dispose(); | 149 | ((IDisposable)m_service).Dispose(); |
123 | m_service = null; | 150 | m_service = null; |
124 | } | 151 | } |
125 | 152 | ||
126 | if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) ) | 153 | if (!String.IsNullOrEmpty(m_file) && File.Exists(m_file)) |
127 | File.Delete(m_file); | 154 | File.Delete(m_file); |
128 | } | 155 | } |
129 | 156 | ||
@@ -204,7 +231,7 @@ namespace OpenSim.Data.Tests | |||
204 | lst += ", " + s; | 231 | lst += ", " + s; |
205 | } | 232 | } |
206 | 233 | ||
207 | string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); | 234 | string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); |
208 | try | 235 | try |
209 | { | 236 | { |
210 | ExecuteSql("DELETE FROM migrations where name " + sCond); | 237 | ExecuteSql("DELETE FROM migrations where name " + sCond); |
diff --git a/OpenSim/Data/Tests/DefaultTestConns.cs b/OpenSim/Data/Tests/DefaultTestConns.cs index 7b52af5..7c47bdd 100644 --- a/OpenSim/Data/Tests/DefaultTestConns.cs +++ b/OpenSim/Data/Tests/DefaultTestConns.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using System.Linq; | 30 | using System.Linq; |
4 | using System.Text; | 31 | using System.Text; |