diff options
Diffstat (limited to 'OpenSim/Data')
20 files changed, 254 insertions, 106 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/IAssetData.cs b/OpenSim/Data/IAssetData.cs index 065d3a5..0c8eadd 100644 --- a/OpenSim/Data/IAssetData.cs +++ b/OpenSim/Data/IAssetData.cs | |||
@@ -40,15 +40,4 @@ namespace OpenSim.Data | |||
40 | void Initialise(string connect); | 40 | void Initialise(string connect); |
41 | bool Delete(string id); | 41 | bool Delete(string id); |
42 | } | 42 | } |
43 | |||
44 | public class AssetDataInitialiser : PluginInitialiserBase | ||
45 | { | ||
46 | private string connect; | ||
47 | public AssetDataInitialiser (string s) { connect = s; } | ||
48 | public override void Initialise (IPlugin plugin) | ||
49 | { | ||
50 | IAssetDataPlugin p = plugin as IAssetDataPlugin; | ||
51 | p.Initialise (connect); | ||
52 | } | ||
53 | } | ||
54 | } | 43 | } |
diff --git a/OpenSim/Data/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs index 90f74b7..74d5d37 100644 --- a/OpenSim/Data/IInventoryData.cs +++ b/OpenSim/Data/IInventoryData.cs | |||
@@ -155,15 +155,4 @@ namespace OpenSim.Data | |||
155 | /// </returns> | 155 | /// </returns> |
156 | List<InventoryItemBase> fetchActiveGestures(UUID avatarID); | 156 | List<InventoryItemBase> fetchActiveGestures(UUID avatarID); |
157 | } | 157 | } |
158 | |||
159 | public class InventoryDataInitialiser : PluginInitialiserBase | ||
160 | { | ||
161 | private string connect; | ||
162 | public InventoryDataInitialiser (string s) { connect = s; } | ||
163 | public override void Initialise (IPlugin plugin) | ||
164 | { | ||
165 | IInventoryDataPlugin p = plugin as IInventoryDataPlugin; | ||
166 | p.Initialise (connect); | ||
167 | } | ||
168 | } | ||
169 | } | 158 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index 80bf106..e9a0935 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs | |||
@@ -50,6 +50,15 @@ namespace OpenSim.Data.MSSQL | |||
50 | 50 | ||
51 | #region Public methods | 51 | #region Public methods |
52 | 52 | ||
53 | public MSSQLEstateStore() | ||
54 | { | ||
55 | } | ||
56 | |||
57 | public MSSQLEstateStore(string connectionString) | ||
58 | { | ||
59 | Initialise(connectionString); | ||
60 | } | ||
61 | |||
53 | /// <summary> | 62 | /// <summary> |
54 | /// Initialises the estatedata class. | 63 | /// Initialises the estatedata class. |
55 | /// </summary> | 64 | /// </summary> |
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 77b8a10..8eae0a2 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL | |||
43 | /// <summary> | 43 | /// <summary> |
44 | /// A MSSQL Interface for the Region Server. | 44 | /// A MSSQL Interface for the Region Server. |
45 | /// </summary> | 45 | /// </summary> |
46 | public class MSSQLRegionDataStore : IRegionDataStore | 46 | public class MSSQLSimulationData : ISimulationDataStore |
47 | { | 47 | { |
48 | private const string _migrationStore = "RegionStore"; | 48 | private const string _migrationStore = "RegionStore"; |
49 | 49 | ||
@@ -55,6 +55,16 @@ namespace OpenSim.Data.MSSQL | |||
55 | /// </summary> | 55 | /// </summary> |
56 | private MSSQLManager _Database; | 56 | private MSSQLManager _Database; |
57 | private string m_connectionString; | 57 | private string m_connectionString; |
58 | |||
59 | public MSSQLSimulationData() | ||
60 | { | ||
61 | } | ||
62 | |||
63 | public MSSQLSimulationData(string connectionString) | ||
64 | { | ||
65 | Initialise(connectionString); | ||
66 | } | ||
67 | |||
58 | /// <summary> | 68 | /// <summary> |
59 | /// Initialises the region datastore | 69 | /// Initialises the region datastore |
60 | /// </summary> | 70 | /// </summary> |
@@ -1126,7 +1136,7 @@ VALUES | |||
1126 | prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); | 1136 | prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); |
1127 | 1137 | ||
1128 | if (!(primRow["MediaURL"] is System.DBNull)) | 1138 | if (!(primRow["MediaURL"] is System.DBNull)) |
1129 | prim.MediaUrl = (string)primRow["MediaURL"]; | 1139 | prim.MediaUrl = (string)primRow["MediaURL"]; |
1130 | 1140 | ||
1131 | return prim; | 1141 | return prim; |
1132 | } | 1142 | } |
@@ -1180,7 +1190,7 @@ VALUES | |||
1180 | { | 1190 | { |
1181 | } | 1191 | } |
1182 | 1192 | ||
1183 | if (!(shapeRow["Media"] is System.DBNull)) | 1193 | if (!(shapeRow["Media"] is System.DBNull)) |
1184 | baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); | 1194 | baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); |
1185 | 1195 | ||
1186 | return baseShape; | 1196 | return baseShape; |
@@ -1511,7 +1521,7 @@ VALUES | |||
1511 | parameters.Add(_Database.CreateParameter("PassTouches", 1)); | 1521 | parameters.Add(_Database.CreateParameter("PassTouches", 1)); |
1512 | else | 1522 | else |
1513 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); | 1523 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); |
1514 | parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); | 1524 | parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); |
1515 | parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); | 1525 | parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); |
1516 | 1526 | ||
1517 | 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/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index f9ce3d9..0b0a638 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -216,9 +216,6 @@ namespace OpenSim.Data.MySQL | |||
216 | 216 | ||
217 | private void UpdateAccessTime(AssetBase asset) | 217 | private void UpdateAccessTime(AssetBase asset) |
218 | { | 218 | { |
219 | // Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph | ||
220 | return; | ||
221 | |||
222 | lock (m_dbLock) | 219 | lock (m_dbLock) |
223 | { | 220 | { |
224 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 221 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 9158f7a..c42c687 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -54,6 +54,15 @@ namespace OpenSim.Data.MySQL | |||
54 | private Dictionary<string, FieldInfo> m_FieldMap = | 54 | private Dictionary<string, FieldInfo> m_FieldMap = |
55 | new Dictionary<string, FieldInfo>(); | 55 | new Dictionary<string, FieldInfo>(); |
56 | 56 | ||
57 | public MySQLEstateStore() | ||
58 | { | ||
59 | } | ||
60 | |||
61 | public MySQLEstateStore(string connectionString) | ||
62 | { | ||
63 | Initialise(connectionString); | ||
64 | } | ||
65 | |||
57 | public void Initialise(string connectionString) | 66 | public void Initialise(string connectionString) |
58 | { | 67 | { |
59 | m_connectionString = connectionString; | 68 | m_connectionString = connectionString; |
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/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index a39e68d..87f6d07 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -45,13 +45,22 @@ namespace OpenSim.Data.MySQL | |||
45 | /// <summary> | 45 | /// <summary> |
46 | /// A MySQL Interface for the Region Server | 46 | /// A MySQL Interface for the Region Server |
47 | /// </summary> | 47 | /// </summary> |
48 | public class MySQLDataStore : IRegionDataStore | 48 | public class MySQLSimulationData : ISimulationDataStore |
49 | { | 49 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | private string m_connectionString; | 52 | private string m_connectionString; |
53 | private object m_dbLock = new object(); | 53 | private object m_dbLock = new object(); |
54 | 54 | ||
55 | public MySQLSimulationData() | ||
56 | { | ||
57 | } | ||
58 | |||
59 | public MySQLSimulationData(string connectionString) | ||
60 | { | ||
61 | Initialise(connectionString); | ||
62 | } | ||
63 | |||
55 | public void Initialise(string connectionString) | 64 | public void Initialise(string connectionString) |
56 | { | 65 | { |
57 | m_connectionString = connectionString; | 66 | m_connectionString = connectionString; |
@@ -680,7 +689,7 @@ namespace OpenSim.Data.MySQL | |||
680 | "UserLocationX, UserLocationY, UserLocationZ, " + | 689 | "UserLocationX, UserLocationY, UserLocationZ, " + |
681 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + | 690 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + |
682 | "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + | 691 | "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + |
683 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + | 692 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + |
684 | "?UUID, ?RegionUUID, " + | 693 | "?UUID, ?RegionUUID, " + |
685 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + | 694 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + |
686 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + | 695 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + |
@@ -691,7 +700,7 @@ namespace OpenSim.Data.MySQL | |||
691 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + | 700 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + |
692 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + | 701 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + |
693 | "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ | 702 | "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ |
694 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; | 703 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; |
695 | 704 | ||
696 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); | 705 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); |
697 | 706 | ||
@@ -728,7 +737,7 @@ namespace OpenSim.Data.MySQL | |||
728 | 737 | ||
729 | string command = "select * from `regionwindlight` where region_id = ?regionID"; | 738 | string command = "select * from `regionwindlight` where region_id = ?regionID"; |
730 | 739 | ||
731 | using(MySqlCommand cmd = new MySqlCommand(command)) | 740 | using (MySqlCommand cmd = new MySqlCommand(command)) |
732 | { | 741 | { |
733 | cmd.Connection = dbcon; | 742 | cmd.Connection = dbcon; |
734 | 743 | ||
@@ -1350,13 +1359,13 @@ namespace OpenSim.Data.MySQL | |||
1350 | 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); |
1351 | } | 1360 | } |
1352 | 1361 | ||
1353 | newData.MediaDescription = (string) row["MediaDescription"]; | 1362 | newData.MediaDescription = (string) row["MediaDescription"]; |
1354 | newData.MediaType = (string) row["MediaType"]; | 1363 | newData.MediaType = (string) row["MediaType"]; |
1355 | newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); | 1364 | newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); |
1356 | newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); | 1365 | newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); |
1357 | newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); | 1366 | newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); |
1358 | newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); | 1367 | newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); |
1359 | newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); | 1368 | newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); |
1360 | 1369 | ||
1361 | newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); | 1370 | newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); |
1362 | 1371 | ||
@@ -1724,7 +1733,7 @@ namespace OpenSim.Data.MySQL | |||
1724 | 1733 | ||
1725 | s.State = (byte)(int)row["State"]; | 1734 | s.State = (byte)(int)row["State"]; |
1726 | 1735 | ||
1727 | if (!(row["Media"] is System.DBNull)) | 1736 | if (!(row["Media"] is System.DBNull)) |
1728 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); | 1737 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); |
1729 | 1738 | ||
1730 | 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/Null/NullDataStore.cs b/OpenSim/Data/Null/NullSimulationData.cs index 3ba44bb..34d3a4e 100644 --- a/OpenSim/Data/Null/NullDataStore.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Data.Null | |||
36 | /// <summary> | 36 | /// <summary> |
37 | /// NULL DataStore, do not store anything | 37 | /// NULL DataStore, do not store anything |
38 | /// </summary> | 38 | /// </summary> |
39 | public class NullDataStore : IRegionDataStore | 39 | public class NullSimulationData : ISimulationDataStore |
40 | { | 40 | { |
41 | public void Initialise(string dbfile) | 41 | public void Initialise(string dbfile) |
42 | { | 42 | { |
@@ -73,7 +73,6 @@ namespace OpenSim.Data.Null | |||
73 | { | 73 | { |
74 | } | 74 | } |
75 | 75 | ||
76 | // see IRegionDatastore | ||
77 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 76 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
78 | { | 77 | { |
79 | } | 78 | } |
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. |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs index bf8ee14..547ea6b 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs | |||
@@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLiteLegacy | |||
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/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index b5ce4c0..2dde926 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.SQLiteLegacy | |||
43 | /// <summary> | 43 | /// <summary> |
44 | /// A RegionData Interface to the SQLite database | 44 | /// A RegionData Interface to the SQLite database |
45 | /// </summary> | 45 | /// </summary> |
46 | public class SQLiteRegionData : IRegionDataStore | 46 | public class SQLiteSimulationData : ISimulationDataStore |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
@@ -69,6 +69,15 @@ namespace OpenSim.Data.SQLiteLegacy | |||
69 | 69 | ||
70 | private String m_connectionString; | 70 | private String m_connectionString; |
71 | 71 | ||
72 | public SQLiteSimulationData() | ||
73 | { | ||
74 | } | ||
75 | |||
76 | public SQLiteSimulationData(string connectionString) | ||
77 | { | ||
78 | Initialise(connectionString); | ||
79 | } | ||
80 | |||
72 | // Temporary attribute while this is experimental | 81 | // Temporary attribute while this is experimental |
73 | 82 | ||
74 | /*********************************************************************** | 83 | /*********************************************************************** |
@@ -78,7 +87,6 @@ namespace OpenSim.Data.SQLiteLegacy | |||
78 | **********************************************************************/ | 87 | **********************************************************************/ |
79 | 88 | ||
80 | /// <summary> | 89 | /// <summary> |
81 | /// See IRegionDataStore | ||
82 | /// <list type="bullet"> | 90 | /// <list type="bullet"> |
83 | /// <item>Initialises RegionData Interface</item> | 91 | /// <item>Initialises RegionData Interface</item> |
84 | /// <item>Loads and initialises a new SQLite connection and maintains it.</item> | 92 | /// <item>Loads and initialises a new SQLite connection and maintains it.</item> |
@@ -1888,7 +1896,6 @@ namespace OpenSim.Data.SQLiteLegacy | |||
1888 | } | 1896 | } |
1889 | 1897 | ||
1890 | /// <summary> | 1898 | /// <summary> |
1891 | /// see IRegionDatastore | ||
1892 | /// </summary> | 1899 | /// </summary> |
1893 | /// <param name="primID"></param> | 1900 | /// <param name="primID"></param> |
1894 | /// <param name="items"></param> | 1901 | /// <param name="items"></param> |
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; |
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 29bf5a3..a081462 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests | |||
61 | #else | 61 | #else |
62 | 62 | ||
63 | [TestFixture(Description = "Region store tests (SQLite)")] | 63 | [TestFixture(Description = "Region store tests (SQLite)")] |
64 | public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteRegionData> | 64 | public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData> |
65 | { | 65 | { |
66 | } | 66 | } |
67 | 67 | ||
68 | [TestFixture(Description = "Region store tests (MySQL)")] | 68 | [TestFixture(Description = "Region store tests (MySQL)")] |
69 | public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLDataStore> | 69 | public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLSimulationData> |
70 | { | 70 | { |
71 | } | 71 | } |
72 | 72 | ||
73 | [TestFixture(Description = "Region store tests (MS SQL Server)")] | 73 | [TestFixture(Description = "Region store tests (MS SQL Server)")] |
74 | public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLRegionDataStore> | 74 | public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLSimulationData> |
75 | { | 75 | { |
76 | } | 76 | } |
77 | 77 | ||
@@ -79,11 +79,11 @@ namespace OpenSim.Data.Tests | |||
79 | 79 | ||
80 | public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> | 80 | public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> |
81 | where TConn : DbConnection, new() | 81 | where TConn : DbConnection, new() |
82 | where TRegStore : class, IRegionDataStore, new() | 82 | where TRegStore : class, ISimulationDataStore, new() |
83 | { | 83 | { |
84 | bool m_rebuildDB; | 84 | bool m_rebuildDB; |
85 | 85 | ||
86 | public IRegionDataStore db; | 86 | public ISimulationDataStore db; |
87 | public UUID zero = UUID.Zero; | 87 | public UUID zero = UUID.Zero; |
88 | public UUID region1 = UUID.Random(); | 88 | public UUID region1 = UUID.Random(); |
89 | public UUID region2 = UUID.Random(); | 89 | public UUID region2 = UUID.Random(); |
@@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests | |||
122 | protected override void InitService(object service) | 122 | protected override void InitService(object service) |
123 | { | 123 | { |
124 | ClearDB(); | 124 | ClearDB(); |
125 | db = (IRegionDataStore)service; | 125 | db = (ISimulationDataStore)service; |
126 | db.Initialise(m_connStr); | 126 | db.Initialise(m_connStr); |
127 | } | 127 | } |
128 | 128 | ||