mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
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.
This commit is contained in:
@@ -1,4 +1,31 @@
|
||||
using System;
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
@@ -17,7 +44,7 @@ namespace OpenSim.Data
|
||||
/// <returns></returns>
|
||||
public static UUID FromDB(object id)
|
||||
{
|
||||
if( (id == null) || (id == DBNull.Value))
|
||||
if ((id == null) || (id == DBNull.Value))
|
||||
return UUID.Zero;
|
||||
|
||||
if (id.GetType() == typeof(Guid))
|
||||
|
||||
@@ -40,15 +40,4 @@ namespace OpenSim.Data
|
||||
void Initialise(string connect);
|
||||
bool Delete(string id);
|
||||
}
|
||||
|
||||
public class AssetDataInitialiser : PluginInitialiserBase
|
||||
{
|
||||
private string connect;
|
||||
public AssetDataInitialiser (string s) { connect = s; }
|
||||
public override void Initialise (IPlugin plugin)
|
||||
{
|
||||
IAssetDataPlugin p = plugin as IAssetDataPlugin;
|
||||
p.Initialise (connect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,15 +155,4 @@ namespace OpenSim.Data
|
||||
/// </returns>
|
||||
List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
|
||||
}
|
||||
|
||||
public class InventoryDataInitialiser : PluginInitialiserBase
|
||||
{
|
||||
private string connect;
|
||||
public InventoryDataInitialiser (string s) { connect = s; }
|
||||
public override void Initialise (IPlugin plugin)
|
||||
{
|
||||
IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
|
||||
p.Initialise (connect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,15 @@ namespace OpenSim.Data.MSSQL
|
||||
|
||||
#region Public methods
|
||||
|
||||
public MSSQLEstateStore()
|
||||
{
|
||||
}
|
||||
|
||||
public MSSQLEstateStore(string connectionString)
|
||||
{
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the estatedata class.
|
||||
/// </summary>
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <summary>
|
||||
/// A MSSQL Interface for the Region Server.
|
||||
/// </summary>
|
||||
public class MSSQLRegionDataStore : IRegionDataStore
|
||||
public class MSSQLSimulationData : ISimulationDataStore
|
||||
{
|
||||
private const string _migrationStore = "RegionStore";
|
||||
|
||||
@@ -55,6 +55,16 @@ namespace OpenSim.Data.MSSQL
|
||||
/// </summary>
|
||||
private MSSQLManager _Database;
|
||||
private string m_connectionString;
|
||||
|
||||
public MSSQLSimulationData()
|
||||
{
|
||||
}
|
||||
|
||||
public MSSQLSimulationData(string connectionString)
|
||||
{
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the region datastore
|
||||
/// </summary>
|
||||
@@ -1126,7 +1136,7 @@ VALUES
|
||||
prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]);
|
||||
|
||||
if (!(primRow["MediaURL"] is System.DBNull))
|
||||
prim.MediaUrl = (string)primRow["MediaURL"];
|
||||
prim.MediaUrl = (string)primRow["MediaURL"];
|
||||
|
||||
return prim;
|
||||
}
|
||||
@@ -1180,7 +1190,7 @@ VALUES
|
||||
{
|
||||
}
|
||||
|
||||
if (!(shapeRow["Media"] is System.DBNull))
|
||||
if (!(shapeRow["Media"] is System.DBNull))
|
||||
baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
|
||||
|
||||
return baseShape;
|
||||
@@ -1511,7 +1521,7 @@ VALUES
|
||||
parameters.Add(_Database.CreateParameter("PassTouches", 1));
|
||||
else
|
||||
parameters.Add(_Database.CreateParameter("PassTouches", 0));
|
||||
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
|
||||
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
|
||||
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
|
||||
|
||||
return parameters.ToArray();
|
||||
@@ -122,7 +122,7 @@ namespace OpenSim.Data
|
||||
int ver = FindVersion(_conn, "migrations");
|
||||
if (ver <= 0) // -1 = no table, 0 = no version record
|
||||
{
|
||||
if( ver < 0 )
|
||||
if (ver < 0)
|
||||
ExecuteScript("create table migrations(name varchar(100), version int)");
|
||||
InsertVersion("migrations", 1);
|
||||
}
|
||||
@@ -288,7 +288,7 @@ namespace OpenSim.Data
|
||||
SortedList<int, string[]> migrations = new SortedList<int, string[]>();
|
||||
|
||||
string[] names = _assem.GetManifestResourceNames();
|
||||
if( names.Length == 0 ) // should never happen
|
||||
if (names.Length == 0) // should never happen
|
||||
return migrations;
|
||||
|
||||
Array.Sort(names); // we want all the migrations ordered
|
||||
@@ -297,7 +297,7 @@ namespace OpenSim.Data
|
||||
Match m = null;
|
||||
string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase
|
||||
|
||||
if( (m != null) && !String.IsNullOrEmpty(sFile) )
|
||||
if ((m != null) && !String.IsNullOrEmpty(sFile))
|
||||
{
|
||||
/* The filename should be '<StoreName>.migrations[.NNN]' where NNN
|
||||
* 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
|
||||
|
||||
if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound))
|
||||
{
|
||||
if( nLastVerFound <= after )
|
||||
if (nLastVerFound <= after)
|
||||
goto scan_old_style;
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ namespace OpenSim.Data
|
||||
sb.Length = 0;
|
||||
}
|
||||
|
||||
if ( (nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list
|
||||
if ((nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list
|
||||
{
|
||||
migrations[nVersion] = script.ToArray();
|
||||
}
|
||||
@@ -345,7 +345,7 @@ namespace OpenSim.Data
|
||||
string sLine = resourceReader.ReadLine();
|
||||
nLineNo++;
|
||||
|
||||
if( String.IsNullOrEmpty(sLine) || sLine.StartsWith("#") ) // ignore a comment or empty line
|
||||
if (String.IsNullOrEmpty(sLine) || sLine.StartsWith("#")) // ignore a comment or empty line
|
||||
continue;
|
||||
|
||||
if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase))
|
||||
@@ -392,7 +392,7 @@ scan_old_style:
|
||||
if (m.Success)
|
||||
{
|
||||
int version = int.Parse(m.Groups[1].ToString());
|
||||
if ( (version > after) && !migrations.ContainsKey(version) )
|
||||
if ((version > after) && !migrations.ContainsKey(version))
|
||||
{
|
||||
using (Stream resource = _assem.GetManifestResourceStream(s))
|
||||
{
|
||||
|
||||
@@ -216,9 +216,6 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
private void UpdateAccessTime(AssetBase asset)
|
||||
{
|
||||
// Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph
|
||||
return;
|
||||
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
|
||||
@@ -54,6 +54,15 @@ namespace OpenSim.Data.MySQL
|
||||
private Dictionary<string, FieldInfo> m_FieldMap =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
public MySQLEstateStore()
|
||||
{
|
||||
}
|
||||
|
||||
public MySQLEstateStore(string connectionString)
|
||||
{
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace OpenSim.Data.MySQL
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
|
||||
// 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.
|
||||
// ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero )
|
||||
// (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero)
|
||||
item.CreatorId = reader["creatorID"].ToString();
|
||||
|
||||
// Be a bit safer in parsing these because the
|
||||
|
||||
@@ -45,13 +45,22 @@ namespace OpenSim.Data.MySQL
|
||||
/// <summary>
|
||||
/// A MySQL Interface for the Region Server
|
||||
/// </summary>
|
||||
public class MySQLDataStore : IRegionDataStore
|
||||
public class MySQLSimulationData : ISimulationDataStore
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_connectionString;
|
||||
private object m_dbLock = new object();
|
||||
|
||||
public MySQLSimulationData()
|
||||
{
|
||||
}
|
||||
|
||||
public MySQLSimulationData(string connectionString)
|
||||
{
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
@@ -680,7 +689,7 @@ namespace OpenSim.Data.MySQL
|
||||
"UserLocationX, UserLocationY, UserLocationZ, " +
|
||||
"UserLookAtX, UserLookAtY, UserLookAtZ, " +
|
||||
"AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
|
||||
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
|
||||
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
|
||||
"?UUID, ?RegionUUID, " +
|
||||
"?LocalLandID, ?Bitmap, ?Name, ?Description, " +
|
||||
"?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
|
||||
@@ -691,7 +700,7 @@ namespace OpenSim.Data.MySQL
|
||||
"?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
|
||||
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
|
||||
"?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
|
||||
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
|
||||
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
|
||||
|
||||
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
|
||||
|
||||
@@ -728,7 +737,7 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using(MySqlCommand cmd = new MySqlCommand(command))
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
@@ -1350,13 +1359,13 @@ namespace OpenSim.Data.MySQL
|
||||
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
|
||||
}
|
||||
|
||||
newData.MediaDescription = (string) row["MediaDescription"];
|
||||
newData.MediaType = (string) row["MediaType"];
|
||||
newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
|
||||
newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
|
||||
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
|
||||
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
|
||||
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
|
||||
newData.MediaDescription = (string) row["MediaDescription"];
|
||||
newData.MediaType = (string) row["MediaType"];
|
||||
newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
|
||||
newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
|
||||
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
|
||||
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
|
||||
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
|
||||
|
||||
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
|
||||
|
||||
@@ -1724,7 +1733,7 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
s.State = (byte)(int)row["State"];
|
||||
|
||||
if (!(row["Media"] is System.DBNull))
|
||||
if (!(row["Media"] is System.DBNull))
|
||||
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
|
||||
|
||||
return s;
|
||||
@@ -1,4 +1,31 @@
|
||||
using System;
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenSim.Data.Null
|
||||
/// <summary>
|
||||
/// NULL DataStore, do not store anything
|
||||
/// </summary>
|
||||
public class NullDataStore : IRegionDataStore
|
||||
public class NullSimulationData : ISimulationDataStore
|
||||
{
|
||||
public void Initialise(string dbfile)
|
||||
{
|
||||
@@ -73,7 +73,6 @@ namespace OpenSim.Data.Null
|
||||
{
|
||||
}
|
||||
|
||||
// see IRegionDatastore
|
||||
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
||||
{
|
||||
}
|
||||
@@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLite
|
||||
private Dictionary<string, FieldInfo> m_FieldMap =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
public SQLiteEstateStore()
|
||||
{
|
||||
}
|
||||
|
||||
public SQLiteEstateStore(string connectionString)
|
||||
{
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
|
||||
@@ -731,12 +731,12 @@ namespace OpenSim.Data.SQLite
|
||||
**********************************************************************/
|
||||
|
||||
protected void CreateDataSetMapping(IDataAdapter da, string tableName)
|
||||
{
|
||||
{
|
||||
ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
|
||||
foreach (DataColumn col in ds.Tables[tableName].Columns)
|
||||
{
|
||||
{
|
||||
dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite
|
||||
/// <summary>
|
||||
/// A RegionData Interface to the SQLite database
|
||||
/// </summary>
|
||||
public class SQLiteRegionData : IRegionDataStore
|
||||
public class SQLiteSimulationData : ISimulationDataStore
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
@@ -70,6 +70,15 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
private String m_connectionString;
|
||||
|
||||
public SQLiteSimulationData()
|
||||
{
|
||||
}
|
||||
|
||||
public SQLiteSimulationData(string connectionString)
|
||||
{
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
// Temporary attribute while this is experimental
|
||||
|
||||
/***********************************************************************
|
||||
@@ -79,7 +88,6 @@ namespace OpenSim.Data.SQLite
|
||||
**********************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// See IRegionDataStore
|
||||
/// <list type="bullet">
|
||||
/// <item>Initialises RegionData Interface</item>
|
||||
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
|
||||
@@ -177,7 +185,7 @@ namespace OpenSim.Data.SQLite
|
||||
{
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
terrainDa.Fill(ds.Tables["terrain"]);
|
||||
@@ -511,7 +519,7 @@ namespace OpenSim.Data.SQLite
|
||||
"[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
|
||||
prim.Shape = PrimitiveBaseShape.Default;
|
||||
}
|
||||
|
||||
|
||||
createdObjects[new UUID(objID)].AddPart(prim);
|
||||
LoadItems(prim);
|
||||
}
|
||||
@@ -535,17 +543,17 @@ namespace OpenSim.Data.SQLite
|
||||
/// </summary>
|
||||
/// <param name="prim">the prim</param>
|
||||
private void LoadItems(SceneObjectPart prim)
|
||||
{
|
||||
// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
|
||||
|
||||
{
|
||||
// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
|
||||
|
||||
DataTable dbItems = ds.Tables["primitems"];
|
||||
String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
|
||||
String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
|
||||
DataRow[] dbItemRows = dbItems.Select(sql);
|
||||
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
|
||||
|
||||
foreach (DataRow row in dbItemRows)
|
||||
{
|
||||
TaskInventoryItem item = buildItem(row);
|
||||
@@ -694,8 +702,6 @@ namespace OpenSim.Data.SQLite
|
||||
{
|
||||
landaccesslist.Rows.Remove(rowsToDelete[iter]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Commit();
|
||||
}
|
||||
@@ -805,7 +811,7 @@ namespace OpenSim.Data.SQLite
|
||||
try
|
||||
{
|
||||
regionSettingsDa.Update(ds, "regionsettings");
|
||||
}
|
||||
}
|
||||
catch (SqliteException SqlEx)
|
||||
{
|
||||
throw new Exception(
|
||||
@@ -975,7 +981,7 @@ namespace OpenSim.Data.SQLite
|
||||
createCol(prims, "CollisionSoundVolume", typeof(Double));
|
||||
|
||||
createCol(prims, "VolumeDetect", typeof(Int16));
|
||||
|
||||
|
||||
createCol(prims, "MediaURL", typeof(String));
|
||||
|
||||
// Add in contraints
|
||||
@@ -1192,10 +1198,10 @@ namespace OpenSim.Data.SQLite
|
||||
private SceneObjectPart buildPrim(DataRow row)
|
||||
{
|
||||
// Code commented. Uncomment to test the unit test inline.
|
||||
|
||||
// The unit test mentions this commented code for the purposes
|
||||
|
||||
// The unit test mentions this commented code for the purposes
|
||||
// of debugging a unit test failure
|
||||
|
||||
|
||||
// SceneObjectGroup sog = new SceneObjectGroup();
|
||||
// SceneObjectPart sop = new SceneObjectPart();
|
||||
// sop.LocalId = 1;
|
||||
@@ -1212,7 +1218,7 @@ namespace OpenSim.Data.SQLite
|
||||
// TODO: this doesn't work yet because something more
|
||||
// interesting has to be done to actually get these values
|
||||
// back out. Not enough time to figure it out yet.
|
||||
|
||||
|
||||
SceneObjectPart prim = new SceneObjectPart();
|
||||
prim.UUID = new UUID((String) row["UUID"]);
|
||||
// explicit conversion of integers is required, which sort
|
||||
@@ -1342,7 +1348,7 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
if (Convert.ToInt16(row["VolumeDetect"]) != 0)
|
||||
prim.VolumeDetectActive = true;
|
||||
|
||||
|
||||
if (!(row["MediaURL"] is System.DBNull))
|
||||
{
|
||||
//m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
|
||||
@@ -1681,7 +1687,7 @@ namespace OpenSim.Data.SQLite
|
||||
row["VolumeDetect"] = 1;
|
||||
else
|
||||
row["VolumeDetect"] = 0;
|
||||
|
||||
|
||||
row["MediaURL"] = prim.MediaUrl;
|
||||
}
|
||||
|
||||
@@ -1759,12 +1765,12 @@ namespace OpenSim.Data.SQLite
|
||||
row["UserLookAtZ"] = land.UserLookAt.Z;
|
||||
row["AuthbuyerID"] = land.AuthBuyerID.ToString();
|
||||
row["OtherCleanTime"] = land.OtherCleanTime;
|
||||
row["MediaType"] = land.MediaType;
|
||||
row["MediaDescription"] = land.MediaDescription;
|
||||
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
|
||||
row["MediaLoop"] = land.MediaLoop.ToString();
|
||||
row["ObscureMusic"] = land.ObscureMusic.ToString();
|
||||
row["ObscureMedia"] = land.ObscureMedia.ToString();
|
||||
row["MediaType"] = land.MediaType;
|
||||
row["MediaDescription"] = land.MediaDescription;
|
||||
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
|
||||
row["MediaLoop"] = land.MediaLoop.ToString();
|
||||
row["ObscureMusic"] = land.ObscureMusic.ToString();
|
||||
row["ObscureMedia"] = land.ObscureMedia.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1862,10 +1868,10 @@ namespace OpenSim.Data.SQLite
|
||||
s.TextureEntry = textureEntry;
|
||||
|
||||
s.ExtraParams = (byte[]) row["ExtraParams"];
|
||||
|
||||
|
||||
if (!(row["Media"] is System.DBNull))
|
||||
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -1909,7 +1915,7 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
row["Texture"] = s.TextureEntry;
|
||||
row["ExtraParams"] = s.ExtraParams;
|
||||
|
||||
|
||||
if (s.Media != null)
|
||||
row["Media"] = s.Media.ToXml();
|
||||
}
|
||||
@@ -1951,7 +1957,6 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// see IRegionDatastore
|
||||
/// </summary>
|
||||
/// <param name="primID"></param>
|
||||
/// <param name="items"></param>
|
||||
@@ -2248,7 +2253,6 @@ namespace OpenSim.Data.SQLite
|
||||
delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
|
||||
da.DeleteCommand = delete;
|
||||
da.DeleteCommand.Connection = conn;
|
||||
|
||||
}
|
||||
|
||||
private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)
|
||||
@@ -2320,7 +2324,7 @@ namespace OpenSim.Data.SQLite
|
||||
return DbType.String;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void PrintDataSet(DataSet ds)
|
||||
{
|
||||
// Print out any name and extended properties.
|
||||
@@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLiteLegacy
|
||||
private Dictionary<string, FieldInfo> m_FieldMap =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
public SQLiteEstateStore()
|
||||
{
|
||||
}
|
||||
|
||||
public SQLiteEstateStore(string connectionString)
|
||||
{
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.SQLiteLegacy
|
||||
/// <summary>
|
||||
/// A RegionData Interface to the SQLite database
|
||||
/// </summary>
|
||||
public class SQLiteRegionData : IRegionDataStore
|
||||
public class SQLiteSimulationData : ISimulationDataStore
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
@@ -69,6 +69,15 @@ namespace OpenSim.Data.SQLiteLegacy
|
||||
|
||||
private String m_connectionString;
|
||||
|
||||
public SQLiteSimulationData()
|
||||
{
|
||||
}
|
||||
|
||||
public SQLiteSimulationData(string connectionString)
|
||||
{
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
// Temporary attribute while this is experimental
|
||||
|
||||
/***********************************************************************
|
||||
@@ -78,7 +87,6 @@ namespace OpenSim.Data.SQLiteLegacy
|
||||
**********************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// See IRegionDataStore
|
||||
/// <list type="bullet">
|
||||
/// <item>Initialises RegionData Interface</item>
|
||||
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
|
||||
@@ -1888,7 +1896,6 @@ namespace OpenSim.Data.SQLiteLegacy
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// see IRegionDatastore
|
||||
/// </summary>
|
||||
/// <param name="primID"></param>
|
||||
/// <param name="items"></param>
|
||||
@@ -1,4 +1,31 @@
|
||||
using System;
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using log4net.Config;
|
||||
@@ -41,13 +68,13 @@ namespace OpenSim.Data.Tests
|
||||
{
|
||||
m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn));
|
||||
|
||||
m_log = LogManager.GetLogger(this.GetType());
|
||||
m_log = LogManager.GetLogger(this.GetType());
|
||||
OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it.
|
||||
/// You'd probably want to to cast the 'service' to a more specific type and store it in a member var.
|
||||
/// You'd probably want to to cast the 'service' to a more specific type and store it in a member var.
|
||||
/// This framework takes care of disposing it, if it's disposable.
|
||||
/// </summary>
|
||||
/// <param name="service">The service being tested</param>
|
||||
@@ -118,12 +145,12 @@ namespace OpenSim.Data.Tests
|
||||
{
|
||||
if (m_service != null)
|
||||
{
|
||||
if( m_service is IDisposable)
|
||||
if (m_service is IDisposable)
|
||||
((IDisposable)m_service).Dispose();
|
||||
m_service = null;
|
||||
}
|
||||
|
||||
if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) )
|
||||
if (!String.IsNullOrEmpty(m_file) && File.Exists(m_file))
|
||||
File.Delete(m_file);
|
||||
}
|
||||
|
||||
@@ -204,7 +231,7 @@ namespace OpenSim.Data.Tests
|
||||
lst += ", " + s;
|
||||
}
|
||||
|
||||
string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
|
||||
string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
|
||||
try
|
||||
{
|
||||
ExecuteSql("DELETE FROM migrations where name " + sCond);
|
||||
|
||||
@@ -1,4 +1,31 @@
|
||||
using System;
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests
|
||||
#else
|
||||
|
||||
[TestFixture(Description = "Region store tests (SQLite)")]
|
||||
public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteRegionData>
|
||||
public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
|
||||
{
|
||||
}
|
||||
|
||||
[TestFixture(Description = "Region store tests (MySQL)")]
|
||||
public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLDataStore>
|
||||
public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLSimulationData>
|
||||
{
|
||||
}
|
||||
|
||||
[TestFixture(Description = "Region store tests (MS SQL Server)")]
|
||||
public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLRegionDataStore>
|
||||
public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLSimulationData>
|
||||
{
|
||||
}
|
||||
|
||||
@@ -79,11 +79,11 @@ namespace OpenSim.Data.Tests
|
||||
|
||||
public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
|
||||
where TConn : DbConnection, new()
|
||||
where TRegStore : class, IRegionDataStore, new()
|
||||
where TRegStore : class, ISimulationDataStore, new()
|
||||
{
|
||||
bool m_rebuildDB;
|
||||
|
||||
public IRegionDataStore db;
|
||||
public ISimulationDataStore db;
|
||||
public UUID zero = UUID.Zero;
|
||||
public UUID region1 = UUID.Random();
|
||||
public UUID region2 = UUID.Random();
|
||||
@@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests
|
||||
protected override void InitService(object service)
|
||||
{
|
||||
ClearDB();
|
||||
db = (IRegionDataStore)service;
|
||||
db = (ISimulationDataStore)service;
|
||||
db.Initialise(m_connStr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user