Merge branch 'master' into careminster-presence-refactor
commit
9bc5098dd8
|
@ -30,7 +30,7 @@ using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLite
|
namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
|
@ -56,13 +56,8 @@ namespace OpenSim.Data.SQLite
|
||||||
m_Connection = new SqliteConnection(connectionString);
|
m_Connection = new SqliteConnection(connectionString);
|
||||||
m_Connection.Open();
|
m_Connection.Open();
|
||||||
|
|
||||||
using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone())
|
Migration m = new Migration(m_Connection, GetType().Assembly, "AuthStore");
|
||||||
{
|
m.Update();
|
||||||
dbcon.Open();
|
|
||||||
Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
|
|
||||||
m.Update();
|
|
||||||
dbcon.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +108,7 @@ namespace OpenSim.Data.SQLite
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -156,14 +151,14 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||||
{
|
{
|
||||||
CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ToString());
|
Console.WriteLine(e.ToString());
|
||||||
CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,19 +179,19 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||||
{
|
{
|
||||||
CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ToString());
|
Console.WriteLine(e.ToString());
|
||||||
CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ using System.Threading;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLite
|
namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
|
@ -55,8 +55,8 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
SqliteCommand cmd = new SqliteCommand();
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
|
||||||
cmd.Parameters.Add(":PrincipalID", principalID.ToString());
|
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
||||||
cmd.Parameters.Add(":Name", name);
|
cmd.Parameters.AddWithValue(":Name", name);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ namespace OpenSim.Data.SQLite
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLite
|
||||||
Migration m = new Migration(m_connection, assem, "EstateStore");
|
Migration m = new Migration(m_connection, assem, "EstateStore");
|
||||||
m.Update();
|
m.Update();
|
||||||
|
|
||||||
m_connection.Close();
|
//m_connection.Close();
|
||||||
m_connection.Open();
|
// m_connection.Open();
|
||||||
|
|
||||||
Type t = typeof(EstateSettings);
|
Type t = typeof(EstateSettings);
|
||||||
m_Fields = t.GetFields(BindingFlags.NonPublic |
|
m_Fields = t.GetFields(BindingFlags.NonPublic |
|
||||||
|
@ -87,7 +87,7 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
||||||
|
|
||||||
return DoLoad(cmd, regionID, create);
|
return DoLoad(cmd, regionID, create);
|
||||||
}
|
}
|
||||||
|
@ -143,13 +143,13 @@ namespace OpenSim.Data.SQLite
|
||||||
if (m_FieldMap[name].GetValue(es) is bool)
|
if (m_FieldMap[name].GetValue(es) is bool)
|
||||||
{
|
{
|
||||||
if ((bool)m_FieldMap[name].GetValue(es))
|
if ((bool)m_FieldMap[name].GetValue(es))
|
||||||
cmd.Parameters.Add(":"+name, "1");
|
cmd.Parameters.AddWithValue(":"+name, "1");
|
||||||
else
|
else
|
||||||
cmd.Parameters.Add(":"+name, "0");
|
cmd.Parameters.AddWithValue(":"+name, "0");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,8 +167,8 @@ namespace OpenSim.Data.SQLite
|
||||||
r.Close();
|
r.Close();
|
||||||
|
|
||||||
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
||||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
||||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||||
|
|
||||||
// This will throw on dupe key
|
// This will throw on dupe key
|
||||||
try
|
try
|
||||||
|
@ -211,13 +211,13 @@ namespace OpenSim.Data.SQLite
|
||||||
if (m_FieldMap[name].GetValue(es) is bool)
|
if (m_FieldMap[name].GetValue(es) is bool)
|
||||||
{
|
{
|
||||||
if ((bool)m_FieldMap[name].GetValue(es))
|
if ((bool)m_FieldMap[name].GetValue(es))
|
||||||
cmd.Parameters.Add(":"+name, "1");
|
cmd.Parameters.AddWithValue(":"+name, "1");
|
||||||
else
|
else
|
||||||
cmd.Parameters.Add(":"+name, "0");
|
cmd.Parameters.AddWithValue(":"+name, "0");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
|
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
|
||||||
cmd.Parameters.Add(":EstateID", es.EstateID);
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
IDataReader r = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
|
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
|
||||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
@ -270,8 +270,8 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
foreach (EstateBan b in es.EstateBans)
|
foreach (EstateBan b in es.EstateBans)
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||||
cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString());
|
cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
@ -283,7 +283,7 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
|
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
|
||||||
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
@ -293,8 +293,8 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
foreach (UUID uuid in data)
|
foreach (UUID uuid in data)
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
||||||
cmd.Parameters.Add(":uuid", uuid.ToString());
|
cmd.Parameters.AddWithValue(":uuid", uuid.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
@ -308,7 +308,7 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
|
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
|
||||||
cmd.Parameters.Add(":EstateID", EstateID);
|
cmd.Parameters.AddWithValue(":EstateID", EstateID);
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
IDataReader r = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
cmd.Parameters.Add(":EstateID", estateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
|
||||||
|
|
||||||
return DoLoad(cmd, UUID.Zero, false);
|
return DoLoad(cmd, UUID.Zero, false);
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
cmd.Parameters.Add(":EstateName", search);
|
cmd.Parameters.AddWithValue(":EstateName", search);
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
IDataReader r = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
@ -365,8 +365,8 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
||||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
||||||
cmd.Parameters.Add(":EstateID", estateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
|
||||||
|
|
||||||
if (cmd.ExecuteNonQuery() == 0)
|
if (cmd.ExecuteNonQuery() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -31,7 +31,7 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLite
|
namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
|
@ -55,11 +55,14 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
lock (connection)
|
lock (connection)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
SqliteConnection newConnection =
|
SqliteConnection newConnection =
|
||||||
(SqliteConnection)((ICloneable)connection).Clone();
|
(SqliteConnection)((ICloneable)connection).Clone();
|
||||||
newConnection.Open();
|
newConnection.Open();
|
||||||
|
|
||||||
cmd.Connection = newConnection;
|
cmd.Connection = newConnection;
|
||||||
|
*/
|
||||||
|
cmd.Connection = connection;
|
||||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
//Console.WriteLine("XXX " + cmd.CommandText);
|
||||||
|
|
||||||
return cmd.ExecuteNonQuery();
|
return cmd.ExecuteNonQuery();
|
||||||
|
@ -70,11 +73,12 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
lock (connection)
|
lock (connection)
|
||||||
{
|
{
|
||||||
SqliteConnection newConnection =
|
//SqliteConnection newConnection =
|
||||||
(SqliteConnection)((ICloneable)connection).Clone();
|
// (SqliteConnection)((ICloneable)connection).Clone();
|
||||||
newConnection.Open();
|
//newConnection.Open();
|
||||||
|
|
||||||
cmd.Connection = newConnection;
|
//cmd.Connection = newConnection;
|
||||||
|
cmd.Connection = connection;
|
||||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
//Console.WriteLine("XXX " + cmd.CommandText);
|
||||||
|
|
||||||
return cmd.ExecuteReader();
|
return cmd.ExecuteReader();
|
||||||
|
|
|
@ -31,7 +31,7 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLite
|
namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
SqliteCommand cmd = new SqliteCommand();
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm);
|
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm);
|
||||||
cmd.Parameters.Add(":PrincipalID", userID.ToString());
|
cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString());
|
||||||
|
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ namespace OpenSim.Data.SQLite
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
SqliteCommand cmd = new SqliteCommand();
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
|
||||||
cmd.Parameters.Add(":PrincipalID", principalID.ToString());
|
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
||||||
cmd.Parameters.Add(":Friend", friend);
|
cmd.Parameters.AddWithValue(":Friend", friend);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd, cmd.Connection);
|
ExecuteNonQuery(cmd, cmd.Connection);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
@ -59,19 +59,21 @@ namespace OpenSim.Data.SQLite
|
||||||
if (!m_initialized)
|
if (!m_initialized)
|
||||||
{
|
{
|
||||||
m_Connection = new SqliteConnection(connectionString);
|
m_Connection = new SqliteConnection(connectionString);
|
||||||
|
Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString));
|
||||||
m_Connection.Open();
|
m_Connection.Open();
|
||||||
|
|
||||||
if (storeName != String.Empty)
|
if (storeName != String.Empty)
|
||||||
{
|
{
|
||||||
Assembly assem = GetType().Assembly;
|
Assembly assem = GetType().Assembly;
|
||||||
SqliteConnection newConnection =
|
//SqliteConnection newConnection =
|
||||||
(SqliteConnection)((ICloneable)m_Connection).Clone();
|
// (SqliteConnection)((ICloneable)m_Connection).Clone();
|
||||||
newConnection.Open();
|
//newConnection.Open();
|
||||||
|
|
||||||
Migration m = new Migration(newConnection, assem, storeName);
|
//Migration m = new Migration(newConnection, assem, storeName);
|
||||||
|
Migration m = new Migration(m_Connection, assem, storeName);
|
||||||
m.Update();
|
m.Update();
|
||||||
newConnection.Close();
|
//newConnection.Close();
|
||||||
newConnection.Dispose();
|
//newConnection.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
|
@ -197,7 +199,7 @@ namespace OpenSim.Data.SQLite
|
||||||
result.Add(row);
|
result.Add(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
|
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
@ -98,11 +98,13 @@ namespace OpenSim.Data.SQLite
|
||||||
ds.Tables.Add(createInventoryFoldersTable());
|
ds.Tables.Add(createInventoryFoldersTable());
|
||||||
invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
|
invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
|
||||||
setupFoldersCommands(invFoldersDa, conn);
|
setupFoldersCommands(invFoldersDa, conn);
|
||||||
|
CreateDataSetMapping(invFoldersDa, "inventoryfolders");
|
||||||
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
|
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
|
||||||
|
|
||||||
ds.Tables.Add(createInventoryItemsTable());
|
ds.Tables.Add(createInventoryItemsTable());
|
||||||
invItemsDa.Fill(ds.Tables["inventoryitems"]);
|
invItemsDa.Fill(ds.Tables["inventoryitems"]);
|
||||||
setupItemsCommands(invItemsDa, conn);
|
setupItemsCommands(invItemsDa, conn);
|
||||||
|
CreateDataSetMapping(invItemsDa, "inventoryitems");
|
||||||
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
|
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
|
||||||
|
|
||||||
ds.AcceptChanges();
|
ds.AcceptChanges();
|
||||||
|
@ -728,6 +730,15 @@ 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>
|
/// <summary>
|
||||||
/// Create the "inventoryitems" table
|
/// Create the "inventoryitems" table
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -32,7 +32,7 @@ using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
@ -87,119 +87,142 @@ namespace OpenSim.Data.SQLite
|
||||||
/// <param name="connectionString">the connection string</param>
|
/// <param name="connectionString">the connection string</param>
|
||||||
public void Initialise(string connectionString)
|
public void Initialise(string connectionString)
|
||||||
{
|
{
|
||||||
m_connectionString = connectionString;
|
try
|
||||||
|
|
||||||
ds = new DataSet();
|
|
||||||
|
|
||||||
m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
|
|
||||||
m_conn = new SqliteConnection(m_connectionString);
|
|
||||||
m_conn.Open();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
|
|
||||||
primDa = new SqliteDataAdapter(primSelectCmd);
|
|
||||||
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
|
|
||||||
|
|
||||||
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
|
|
||||||
shapeDa = new SqliteDataAdapter(shapeSelectCmd);
|
|
||||||
// SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
|
|
||||||
|
|
||||||
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
|
|
||||||
itemsDa = new SqliteDataAdapter(itemsSelectCmd);
|
|
||||||
|
|
||||||
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
|
|
||||||
terrainDa = new SqliteDataAdapter(terrainSelectCmd);
|
|
||||||
|
|
||||||
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
|
|
||||||
landDa = new SqliteDataAdapter(landSelectCmd);
|
|
||||||
|
|
||||||
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
|
|
||||||
landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
|
|
||||||
|
|
||||||
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
|
|
||||||
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
|
|
||||||
// This actually does the roll forward assembly stuff
|
|
||||||
Assembly assem = GetType().Assembly;
|
|
||||||
Migration m = new Migration(m_conn, assem, "RegionStore");
|
|
||||||
m.Update();
|
|
||||||
|
|
||||||
lock (ds)
|
|
||||||
{
|
{
|
||||||
ds.Tables.Add(createPrimTable());
|
m_connectionString = connectionString;
|
||||||
setupPrimCommands(primDa, m_conn);
|
|
||||||
primDa.Fill(ds.Tables["prims"]);
|
|
||||||
|
|
||||||
ds.Tables.Add(createShapeTable());
|
ds = new DataSet("Region");
|
||||||
setupShapeCommands(shapeDa, m_conn);
|
|
||||||
|
|
||||||
ds.Tables.Add(createItemsTable());
|
m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
|
||||||
setupItemsCommands(itemsDa, m_conn);
|
m_conn = new SqliteConnection(m_connectionString);
|
||||||
itemsDa.Fill(ds.Tables["primitems"]);
|
m_conn.Open();
|
||||||
|
|
||||||
ds.Tables.Add(createTerrainTable());
|
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
|
||||||
setupTerrainCommands(terrainDa, m_conn);
|
primDa = new SqliteDataAdapter(primSelectCmd);
|
||||||
|
|
||||||
ds.Tables.Add(createLandTable());
|
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
|
||||||
setupLandCommands(landDa, m_conn);
|
shapeDa = new SqliteDataAdapter(shapeSelectCmd);
|
||||||
|
// SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
|
||||||
|
|
||||||
ds.Tables.Add(createLandAccessListTable());
|
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
|
||||||
setupLandAccessCommands(landAccessListDa, m_conn);
|
itemsDa = new SqliteDataAdapter(itemsSelectCmd);
|
||||||
|
|
||||||
ds.Tables.Add(createRegionSettingsTable());
|
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
|
||||||
|
terrainDa = new SqliteDataAdapter(terrainSelectCmd);
|
||||||
|
|
||||||
setupRegionSettingsCommands(regionSettingsDa, m_conn);
|
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
|
||||||
|
landDa = new SqliteDataAdapter(landSelectCmd);
|
||||||
|
|
||||||
// WORKAROUND: This is a work around for sqlite on
|
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
|
||||||
// windows, which gets really unhappy with blob columns
|
landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
|
||||||
// that have no sample data in them. At some point we
|
|
||||||
// need to actually find a proper way to handle this.
|
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
|
||||||
try
|
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
|
||||||
|
// This actually does the roll forward assembly stuff
|
||||||
|
Assembly assem = GetType().Assembly;
|
||||||
|
Migration m = new Migration(m_conn, assem, "RegionStore");
|
||||||
|
m.Update();
|
||||||
|
|
||||||
|
lock (ds)
|
||||||
{
|
{
|
||||||
shapeDa.Fill(ds.Tables["primshapes"]);
|
ds.Tables.Add(createPrimTable());
|
||||||
}
|
setupPrimCommands(primDa, m_conn);
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on primshapes table");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
ds.Tables.Add(createShapeTable());
|
||||||
{
|
setupShapeCommands(shapeDa, m_conn);
|
||||||
terrainDa.Fill(ds.Tables["terrain"]);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on terrain table");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
ds.Tables.Add(createItemsTable());
|
||||||
{
|
setupItemsCommands(itemsDa, m_conn);
|
||||||
landDa.Fill(ds.Tables["land"]);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on land table");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
ds.Tables.Add(createTerrainTable());
|
||||||
{
|
setupTerrainCommands(terrainDa, m_conn);
|
||||||
landAccessListDa.Fill(ds.Tables["landaccesslist"]);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
ds.Tables.Add(createLandTable());
|
||||||
{
|
setupLandCommands(landDa, m_conn);
|
||||||
regionSettingsDa.Fill(ds.Tables["regionsettings"]);
|
|
||||||
|
ds.Tables.Add(createLandAccessListTable());
|
||||||
|
setupLandAccessCommands(landAccessListDa, m_conn);
|
||||||
|
|
||||||
|
ds.Tables.Add(createRegionSettingsTable());
|
||||||
|
setupRegionSettingsCommands(regionSettingsDa, m_conn);
|
||||||
|
|
||||||
|
// WORKAROUND: This is a work around for sqlite on
|
||||||
|
// windows, which gets really unhappy with blob columns
|
||||||
|
// that have no sample data in them. At some point we
|
||||||
|
// need to actually find a proper way to handle this.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
primDa.Fill(ds.Tables["prims"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on prims table");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
shapeDa.Fill(ds.Tables["primshapes"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on primshapes table");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
terrainDa.Fill(ds.Tables["terrain"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on terrain table");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
landDa.Fill(ds.Tables["land"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on land table");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
landAccessListDa.Fill(ds.Tables["landaccesslist"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
regionSettingsDa.Fill(ds.Tables["regionsettings"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
|
||||||
|
// Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409
|
||||||
|
// Possibly because we manually set up our own DataTables before connecting to the database
|
||||||
|
CreateDataSetMapping(primDa, "prims");
|
||||||
|
CreateDataSetMapping(shapeDa, "primshapes");
|
||||||
|
CreateDataSetMapping(itemsDa, "primitems");
|
||||||
|
CreateDataSetMapping(terrainDa, "terrain");
|
||||||
|
CreateDataSetMapping(landDa, "land");
|
||||||
|
CreateDataSetMapping(landAccessListDa, "landaccesslist");
|
||||||
|
CreateDataSetMapping(regionSettingsDa, "regionsettings");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error(e);
|
||||||
|
Environment.Exit(23);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -603,7 +626,7 @@ namespace OpenSim.Data.SQLite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rev = (int) row["Revision"];
|
rev = Convert.ToInt32(row["Revision"]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -755,6 +778,7 @@ namespace OpenSim.Data.SQLite
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Commit()
|
public void Commit()
|
||||||
{
|
{
|
||||||
|
//m_log.Debug("[SQLITE]: Starting commit");
|
||||||
lock (ds)
|
lock (ds)
|
||||||
{
|
{
|
||||||
primDa.Update(ds, "prims");
|
primDa.Update(ds, "prims");
|
||||||
|
@ -769,18 +793,11 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
regionSettingsDa.Update(ds, "regionsettings");
|
regionSettingsDa.Update(ds, "regionsettings");
|
||||||
}
|
}
|
||||||
catch (SqliteExecutionException SqlEx)
|
catch (SqliteException SqlEx)
|
||||||
{
|
{
|
||||||
if (SqlEx.Message.Contains("logic error"))
|
throw new Exception(
|
||||||
{
|
"There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
|
||||||
throw new Exception(
|
SqlEx);
|
||||||
"There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
|
|
||||||
SqlEx);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw SqlEx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ds.AcceptChanges();
|
ds.AcceptChanges();
|
||||||
}
|
}
|
||||||
|
@ -802,6 +819,15 @@ 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>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1897,7 +1923,7 @@ namespace OpenSim.Data.SQLite
|
||||||
/// <param name="items"></param>
|
/// <param name="items"></param>
|
||||||
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
|
//m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
|
||||||
|
|
||||||
DataTable dbItems = ds.Tables["primitems"];
|
DataTable dbItems = ds.Tables["primitems"];
|
||||||
|
|
||||||
|
@ -1964,6 +1990,7 @@ namespace OpenSim.Data.SQLite
|
||||||
sql += ") values (:";
|
sql += ") values (:";
|
||||||
sql += String.Join(", :", cols);
|
sql += String.Join(", :", cols);
|
||||||
sql += ")";
|
sql += ")";
|
||||||
|
//m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
|
||||||
SqliteCommand cmd = new SqliteCommand(sql);
|
SqliteCommand cmd = new SqliteCommand(sql);
|
||||||
|
|
||||||
// this provides the binding for all our parameters, so
|
// this provides the binding for all our parameters, so
|
||||||
|
@ -2260,5 +2287,35 @@ namespace OpenSim.Data.SQLite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PrintDataSet(DataSet ds)
|
||||||
|
{
|
||||||
|
// Print out any name and extended properties.
|
||||||
|
Console.WriteLine("DataSet is named: {0}", ds.DataSetName);
|
||||||
|
foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
|
||||||
|
}
|
||||||
|
Console.WriteLine();
|
||||||
|
foreach (DataTable dt in ds.Tables)
|
||||||
|
{
|
||||||
|
Console.WriteLine("=> {0} Table:", dt.TableName);
|
||||||
|
// Print out the column names.
|
||||||
|
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
|
||||||
|
{
|
||||||
|
Console.Write(dt.Columns[curCol].ColumnName + "\t");
|
||||||
|
}
|
||||||
|
Console.WriteLine("\n----------------------------------");
|
||||||
|
// Print the DataTable.
|
||||||
|
for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
|
||||||
|
{
|
||||||
|
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
|
||||||
|
{
|
||||||
|
Console.Write(dt.Rows[curRow][curCol].ToString() + "\t");
|
||||||
|
}
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLite
|
namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
if (words.Length == 1)
|
if (words.Length == 1)
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
||||||
m_Realm, scopeID.ToString(), words[0]);
|
m_Realm, scopeID.ToString(), words[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLite
|
namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.Sqlite;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLite
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
|
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,11 @@ using System.Runtime.InteropServices;
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
|
|
||||||
[assembly : AssemblyTitle("OpenSim.Data.SQLiteNG")]
|
[assembly : AssemblyTitle("OpenSim.Data.SQLiteLegacy")]
|
||||||
[assembly : AssemblyDescription("")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyConfiguration("")]
|
[assembly : AssemblyConfiguration("")]
|
||||||
[assembly : AssemblyCompany("http://opensimulator.org")]
|
[assembly : AssemblyCompany("http://opensimulator.org")]
|
||||||
[assembly : AssemblyProduct("OpenSim.Data.SQLiteNG")]
|
[assembly : AssemblyProduct("OpenSim.Data.SQLiteLegacy")]
|
||||||
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
|
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
|
||||||
[assembly : AssemblyTrademark("")]
|
[assembly : AssemblyTrademark("")]
|
||||||
[assembly : AssemblyCulture("")]
|
[assembly : AssemblyCulture("")]
|
|
@ -30,11 +30,11 @@ using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An asset storage interface for the SQLite database system
|
/// An asset storage interface for the SQLite database system
|
|
@ -31,9 +31,9 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData
|
public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData
|
||||||
{
|
{
|
||||||
|
@ -56,8 +56,13 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
m_Connection = new SqliteConnection(connectionString);
|
m_Connection = new SqliteConnection(connectionString);
|
||||||
m_Connection.Open();
|
m_Connection.Open();
|
||||||
|
|
||||||
Migration m = new Migration(m_Connection, GetType().Assembly, "AuthStore");
|
using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone())
|
||||||
m.Update();
|
{
|
||||||
|
dbcon.Open();
|
||||||
|
Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
|
||||||
|
m.Update();
|
||||||
|
dbcon.Close();
|
||||||
|
}
|
||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +113,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
//CloseCommand(cmd);
|
CloseCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -151,14 +156,14 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
{
|
{
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||||
{
|
{
|
||||||
//CloseCommand(cmd);
|
CloseCommand(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ToString());
|
Console.WriteLine(e.ToString());
|
||||||
//CloseCommand(cmd);
|
CloseCommand(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,19 +184,19 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
{
|
{
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||||
{
|
{
|
||||||
//CloseCommand(cmd);
|
CloseCommand(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ToString());
|
Console.WriteLine(e.ToString());
|
||||||
//CloseCommand(cmd);
|
CloseCommand(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//CloseCommand(cmd);
|
CloseCommand(cmd);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -33,9 +33,9 @@ using System.Threading;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A SQLite Interface for Avatar Data
|
/// A SQLite Interface for Avatar Data
|
||||||
|
@ -55,8 +55,8 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
SqliteCommand cmd = new SqliteCommand();
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
|
||||||
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
cmd.Parameters.Add(":PrincipalID", principalID.ToString());
|
||||||
cmd.Parameters.AddWithValue(":Name", name);
|
cmd.Parameters.Add(":Name", name);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
//CloseCommand(cmd);
|
CloseCommand(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,12 +30,12 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
public class SQLiteEstateStore : IEstateDataStore
|
public class SQLiteEstateStore : IEstateDataStore
|
||||||
{
|
{
|
||||||
|
@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
Migration m = new Migration(m_connection, assem, "EstateStore");
|
Migration m = new Migration(m_connection, assem, "EstateStore");
|
||||||
m.Update();
|
m.Update();
|
||||||
|
|
||||||
//m_connection.Close();
|
m_connection.Close();
|
||||||
// m_connection.Open();
|
m_connection.Open();
|
||||||
|
|
||||||
Type t = typeof(EstateSettings);
|
Type t = typeof(EstateSettings);
|
||||||
m_Fields = t.GetFields(BindingFlags.NonPublic |
|
m_Fields = t.GetFields(BindingFlags.NonPublic |
|
||||||
|
@ -87,7 +87,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||||
|
|
||||||
return DoLoad(cmd, regionID, create);
|
return DoLoad(cmd, regionID, create);
|
||||||
}
|
}
|
||||||
|
@ -143,13 +143,13 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
if (m_FieldMap[name].GetValue(es) is bool)
|
if (m_FieldMap[name].GetValue(es) is bool)
|
||||||
{
|
{
|
||||||
if ((bool)m_FieldMap[name].GetValue(es))
|
if ((bool)m_FieldMap[name].GetValue(es))
|
||||||
cmd.Parameters.AddWithValue(":"+name, "1");
|
cmd.Parameters.Add(":"+name, "1");
|
||||||
else
|
else
|
||||||
cmd.Parameters.AddWithValue(":"+name, "0");
|
cmd.Parameters.Add(":"+name, "0");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,8 +167,8 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
r.Close();
|
r.Close();
|
||||||
|
|
||||||
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
||||||
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||||
|
|
||||||
// This will throw on dupe key
|
// This will throw on dupe key
|
||||||
try
|
try
|
||||||
|
@ -211,13 +211,13 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
if (m_FieldMap[name].GetValue(es) is bool)
|
if (m_FieldMap[name].GetValue(es) is bool)
|
||||||
{
|
{
|
||||||
if ((bool)m_FieldMap[name].GetValue(es))
|
if ((bool)m_FieldMap[name].GetValue(es))
|
||||||
cmd.Parameters.AddWithValue(":"+name, "1");
|
cmd.Parameters.Add(":"+name, "1");
|
||||||
else
|
else
|
||||||
cmd.Parameters.AddWithValue(":"+name, "0");
|
cmd.Parameters.Add(":"+name, "0");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
|
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
|
||||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
|
cmd.Parameters.Add(":EstateID", es.EstateID);
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
IDataReader r = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
|
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
|
||||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
@ -270,8 +270,8 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
|
|
||||||
foreach (EstateBan b in es.EstateBans)
|
foreach (EstateBan b in es.EstateBans)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||||
cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
|
cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
@ -283,7 +283,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
|
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
|
||||||
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
@ -293,8 +293,8 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
|
|
||||||
foreach (UUID uuid in data)
|
foreach (UUID uuid in data)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
||||||
cmd.Parameters.AddWithValue(":uuid", uuid.ToString());
|
cmd.Parameters.Add(":uuid", uuid.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
@ -308,7 +308,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
|
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
|
||||||
cmd.Parameters.AddWithValue(":EstateID", EstateID);
|
cmd.Parameters.Add(":EstateID", EstateID);
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
IDataReader r = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
|
cmd.Parameters.Add(":EstateID", estateID.ToString());
|
||||||
|
|
||||||
return DoLoad(cmd, UUID.Zero, false);
|
return DoLoad(cmd, UUID.Zero, false);
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
cmd.Parameters.AddWithValue(":EstateName", search);
|
cmd.Parameters.Add(":EstateName", search);
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
IDataReader r = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
@ -365,8 +365,8 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
||||||
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||||
cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
|
cmd.Parameters.Add(":EstateID", estateID.ToString());
|
||||||
|
|
||||||
if (cmd.ExecuteNonQuery() == 0)
|
if (cmd.ExecuteNonQuery() == 0)
|
||||||
return false;
|
return false;
|
|
@ -31,9 +31,9 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A database interface class to a user profile storage system
|
/// A database interface class to a user profile storage system
|
||||||
|
@ -55,14 +55,11 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
{
|
{
|
||||||
lock (connection)
|
lock (connection)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
SqliteConnection newConnection =
|
SqliteConnection newConnection =
|
||||||
(SqliteConnection)((ICloneable)connection).Clone();
|
(SqliteConnection)((ICloneable)connection).Clone();
|
||||||
newConnection.Open();
|
newConnection.Open();
|
||||||
|
|
||||||
cmd.Connection = newConnection;
|
cmd.Connection = newConnection;
|
||||||
*/
|
|
||||||
cmd.Connection = connection;
|
|
||||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
//Console.WriteLine("XXX " + cmd.CommandText);
|
||||||
|
|
||||||
return cmd.ExecuteNonQuery();
|
return cmd.ExecuteNonQuery();
|
||||||
|
@ -73,12 +70,11 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
{
|
{
|
||||||
lock (connection)
|
lock (connection)
|
||||||
{
|
{
|
||||||
//SqliteConnection newConnection =
|
SqliteConnection newConnection =
|
||||||
// (SqliteConnection)((ICloneable)connection).Clone();
|
(SqliteConnection)((ICloneable)connection).Clone();
|
||||||
//newConnection.Open();
|
newConnection.Open();
|
||||||
|
|
||||||
//cmd.Connection = newConnection;
|
cmd.Connection = newConnection;
|
||||||
cmd.Connection = connection;
|
|
||||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
//Console.WriteLine("XXX " + cmd.CommandText);
|
||||||
|
|
||||||
return cmd.ExecuteReader();
|
return cmd.ExecuteReader();
|
|
@ -31,9 +31,9 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
public class SQLiteFriendsData : SQLiteGenericTableHandler<FriendsData>, IFriendsData
|
public class SQLiteFriendsData : SQLiteGenericTableHandler<FriendsData>, IFriendsData
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
SqliteCommand cmd = new SqliteCommand();
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm);
|
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm);
|
||||||
cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString());
|
cmd.Parameters.Add(":PrincipalID", userID.ToString());
|
||||||
|
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
SqliteCommand cmd = new SqliteCommand();
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
|
||||||
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
cmd.Parameters.Add(":PrincipalID", principalID.ToString());
|
||||||
cmd.Parameters.AddWithValue(":Friend", friend);
|
cmd.Parameters.Add(":Friend", friend);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd, cmd.Connection);
|
ExecuteNonQuery(cmd, cmd.Connection);
|
||||||
|
|
|
@ -30,12 +30,12 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new()
|
public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new()
|
||||||
{
|
{
|
||||||
|
@ -59,21 +59,19 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
if (!m_initialized)
|
if (!m_initialized)
|
||||||
{
|
{
|
||||||
m_Connection = new SqliteConnection(connectionString);
|
m_Connection = new SqliteConnection(connectionString);
|
||||||
Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString));
|
|
||||||
m_Connection.Open();
|
m_Connection.Open();
|
||||||
|
|
||||||
if (storeName != String.Empty)
|
if (storeName != String.Empty)
|
||||||
{
|
{
|
||||||
Assembly assem = GetType().Assembly;
|
Assembly assem = GetType().Assembly;
|
||||||
//SqliteConnection newConnection =
|
SqliteConnection newConnection =
|
||||||
// (SqliteConnection)((ICloneable)m_Connection).Clone();
|
(SqliteConnection)((ICloneable)m_Connection).Clone();
|
||||||
//newConnection.Open();
|
newConnection.Open();
|
||||||
|
|
||||||
//Migration m = new Migration(newConnection, assem, storeName);
|
Migration m = new Migration(newConnection, assem, storeName);
|
||||||
Migration m = new Migration(m_Connection, assem, storeName);
|
|
||||||
m.Update();
|
m.Update();
|
||||||
//newConnection.Close();
|
newConnection.Close();
|
||||||
//newConnection.Dispose();
|
newConnection.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
|
@ -199,7 +197,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
result.Add(row);
|
result.Add(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
//CloseCommand(cmd);
|
CloseCommand(cmd);
|
||||||
|
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
|
@ -30,11 +30,11 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An Inventory Interface to the SQLite database
|
/// An Inventory Interface to the SQLite database
|
||||||
|
@ -98,13 +98,11 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
ds.Tables.Add(createInventoryFoldersTable());
|
ds.Tables.Add(createInventoryFoldersTable());
|
||||||
invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
|
invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
|
||||||
setupFoldersCommands(invFoldersDa, conn);
|
setupFoldersCommands(invFoldersDa, conn);
|
||||||
CreateDataSetMapping(invFoldersDa, "inventoryfolders");
|
|
||||||
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
|
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
|
||||||
|
|
||||||
ds.Tables.Add(createInventoryItemsTable());
|
ds.Tables.Add(createInventoryItemsTable());
|
||||||
invItemsDa.Fill(ds.Tables["inventoryitems"]);
|
invItemsDa.Fill(ds.Tables["inventoryitems"]);
|
||||||
setupItemsCommands(invItemsDa, conn);
|
setupItemsCommands(invItemsDa, conn);
|
||||||
CreateDataSetMapping(invItemsDa, "inventoryitems");
|
|
||||||
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
|
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
|
||||||
|
|
||||||
ds.AcceptChanges();
|
ds.AcceptChanges();
|
||||||
|
@ -730,15 +728,6 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
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>
|
/// <summary>
|
||||||
/// Create the "inventoryitems" table
|
/// Create the "inventoryitems" table
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -32,13 +32,13 @@ using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A RegionData Interface to the SQLite database
|
/// A RegionData Interface to the SQLite database
|
||||||
|
@ -87,142 +87,119 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
/// <param name="connectionString">the connection string</param>
|
/// <param name="connectionString">the connection string</param>
|
||||||
public void Initialise(string connectionString)
|
public void Initialise(string connectionString)
|
||||||
{
|
{
|
||||||
try
|
m_connectionString = connectionString;
|
||||||
|
|
||||||
|
ds = new DataSet();
|
||||||
|
|
||||||
|
m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
|
||||||
|
m_conn = new SqliteConnection(m_connectionString);
|
||||||
|
m_conn.Open();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
|
||||||
|
primDa = new SqliteDataAdapter(primSelectCmd);
|
||||||
|
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
|
||||||
|
|
||||||
|
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
|
||||||
|
shapeDa = new SqliteDataAdapter(shapeSelectCmd);
|
||||||
|
// SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
|
||||||
|
|
||||||
|
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
|
||||||
|
itemsDa = new SqliteDataAdapter(itemsSelectCmd);
|
||||||
|
|
||||||
|
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
|
||||||
|
terrainDa = new SqliteDataAdapter(terrainSelectCmd);
|
||||||
|
|
||||||
|
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
|
||||||
|
landDa = new SqliteDataAdapter(landSelectCmd);
|
||||||
|
|
||||||
|
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
|
||||||
|
landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
|
||||||
|
|
||||||
|
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
|
||||||
|
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
|
||||||
|
// This actually does the roll forward assembly stuff
|
||||||
|
Assembly assem = GetType().Assembly;
|
||||||
|
Migration m = new Migration(m_conn, assem, "RegionStore");
|
||||||
|
m.Update();
|
||||||
|
|
||||||
|
lock (ds)
|
||||||
{
|
{
|
||||||
m_connectionString = connectionString;
|
ds.Tables.Add(createPrimTable());
|
||||||
|
setupPrimCommands(primDa, m_conn);
|
||||||
|
primDa.Fill(ds.Tables["prims"]);
|
||||||
|
|
||||||
ds = new DataSet("Region");
|
ds.Tables.Add(createShapeTable());
|
||||||
|
setupShapeCommands(shapeDa, m_conn);
|
||||||
|
|
||||||
m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
|
ds.Tables.Add(createItemsTable());
|
||||||
m_conn = new SqliteConnection(m_connectionString);
|
setupItemsCommands(itemsDa, m_conn);
|
||||||
m_conn.Open();
|
itemsDa.Fill(ds.Tables["primitems"]);
|
||||||
|
|
||||||
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
|
ds.Tables.Add(createTerrainTable());
|
||||||
primDa = new SqliteDataAdapter(primSelectCmd);
|
setupTerrainCommands(terrainDa, m_conn);
|
||||||
|
|
||||||
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
|
ds.Tables.Add(createLandTable());
|
||||||
shapeDa = new SqliteDataAdapter(shapeSelectCmd);
|
setupLandCommands(landDa, m_conn);
|
||||||
// SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
|
|
||||||
|
|
||||||
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
|
ds.Tables.Add(createLandAccessListTable());
|
||||||
itemsDa = new SqliteDataAdapter(itemsSelectCmd);
|
setupLandAccessCommands(landAccessListDa, m_conn);
|
||||||
|
|
||||||
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
|
ds.Tables.Add(createRegionSettingsTable());
|
||||||
terrainDa = new SqliteDataAdapter(terrainSelectCmd);
|
|
||||||
|
|
||||||
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
|
setupRegionSettingsCommands(regionSettingsDa, m_conn);
|
||||||
landDa = new SqliteDataAdapter(landSelectCmd);
|
|
||||||
|
|
||||||
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
|
// WORKAROUND: This is a work around for sqlite on
|
||||||
landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
|
// windows, which gets really unhappy with blob columns
|
||||||
|
// that have no sample data in them. At some point we
|
||||||
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
|
// need to actually find a proper way to handle this.
|
||||||
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
|
try
|
||||||
// This actually does the roll forward assembly stuff
|
|
||||||
Assembly assem = GetType().Assembly;
|
|
||||||
Migration m = new Migration(m_conn, assem, "RegionStore");
|
|
||||||
m.Update();
|
|
||||||
|
|
||||||
lock (ds)
|
|
||||||
{
|
{
|
||||||
ds.Tables.Add(createPrimTable());
|
shapeDa.Fill(ds.Tables["primshapes"]);
|
||||||
setupPrimCommands(primDa, m_conn);
|
}
|
||||||
|
catch (Exception)
|
||||||
ds.Tables.Add(createShapeTable());
|
{
|
||||||
setupShapeCommands(shapeDa, m_conn);
|
m_log.Info("[REGION DB]: Caught fill error on primshapes table");
|
||||||
|
|
||||||
ds.Tables.Add(createItemsTable());
|
|
||||||
setupItemsCommands(itemsDa, m_conn);
|
|
||||||
|
|
||||||
ds.Tables.Add(createTerrainTable());
|
|
||||||
setupTerrainCommands(terrainDa, m_conn);
|
|
||||||
|
|
||||||
ds.Tables.Add(createLandTable());
|
|
||||||
setupLandCommands(landDa, m_conn);
|
|
||||||
|
|
||||||
ds.Tables.Add(createLandAccessListTable());
|
|
||||||
setupLandAccessCommands(landAccessListDa, m_conn);
|
|
||||||
|
|
||||||
ds.Tables.Add(createRegionSettingsTable());
|
|
||||||
setupRegionSettingsCommands(regionSettingsDa, m_conn);
|
|
||||||
|
|
||||||
// WORKAROUND: This is a work around for sqlite on
|
|
||||||
// windows, which gets really unhappy with blob columns
|
|
||||||
// that have no sample data in them. At some point we
|
|
||||||
// need to actually find a proper way to handle this.
|
|
||||||
try
|
|
||||||
{
|
|
||||||
primDa.Fill(ds.Tables["prims"]);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on prims table");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
shapeDa.Fill(ds.Tables["primshapes"]);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on primshapes table");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
terrainDa.Fill(ds.Tables["terrain"]);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on terrain table");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
landDa.Fill(ds.Tables["land"]);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on land table");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
landAccessListDa.Fill(ds.Tables["landaccesslist"]);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
regionSettingsDa.Fill(ds.Tables["regionsettings"]);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
|
|
||||||
}
|
|
||||||
|
|
||||||
// We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
|
|
||||||
// Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409
|
|
||||||
// Possibly because we manually set up our own DataTables before connecting to the database
|
|
||||||
CreateDataSetMapping(primDa, "prims");
|
|
||||||
CreateDataSetMapping(shapeDa, "primshapes");
|
|
||||||
CreateDataSetMapping(itemsDa, "primitems");
|
|
||||||
CreateDataSetMapping(terrainDa, "terrain");
|
|
||||||
CreateDataSetMapping(landDa, "land");
|
|
||||||
CreateDataSetMapping(landAccessListDa, "landaccesslist");
|
|
||||||
CreateDataSetMapping(regionSettingsDa, "regionsettings");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error(e);
|
|
||||||
Environment.Exit(23);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
try
|
||||||
|
{
|
||||||
|
terrainDa.Fill(ds.Tables["terrain"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on terrain table");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
landDa.Fill(ds.Tables["land"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on land table");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
landAccessListDa.Fill(ds.Tables["landaccesslist"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
regionSettingsDa.Fill(ds.Tables["regionsettings"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -626,7 +603,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rev = Convert.ToInt32(row["Revision"]);
|
rev = (int) row["Revision"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -778,7 +755,6 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Commit()
|
public void Commit()
|
||||||
{
|
{
|
||||||
m_log.Debug("[SQLITE]: Starting commit");
|
|
||||||
lock (ds)
|
lock (ds)
|
||||||
{
|
{
|
||||||
primDa.Update(ds, "prims");
|
primDa.Update(ds, "prims");
|
||||||
|
@ -793,11 +769,18 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
{
|
{
|
||||||
regionSettingsDa.Update(ds, "regionsettings");
|
regionSettingsDa.Update(ds, "regionsettings");
|
||||||
}
|
}
|
||||||
catch (SqliteException SqlEx)
|
catch (SqliteExecutionException SqlEx)
|
||||||
{
|
{
|
||||||
throw new Exception(
|
if (SqlEx.Message.Contains("logic error"))
|
||||||
"There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
|
{
|
||||||
SqlEx);
|
throw new Exception(
|
||||||
|
"There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
|
||||||
|
SqlEx);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw SqlEx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ds.AcceptChanges();
|
ds.AcceptChanges();
|
||||||
}
|
}
|
||||||
|
@ -819,15 +802,6 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
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>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1990,7 +1964,6 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
sql += ") values (:";
|
sql += ") values (:";
|
||||||
sql += String.Join(", :", cols);
|
sql += String.Join(", :", cols);
|
||||||
sql += ")";
|
sql += ")";
|
||||||
m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
|
|
||||||
SqliteCommand cmd = new SqliteCommand(sql);
|
SqliteCommand cmd = new SqliteCommand(sql);
|
||||||
|
|
||||||
// this provides the binding for all our parameters, so
|
// this provides the binding for all our parameters, so
|
||||||
|
@ -2287,35 +2260,5 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintDataSet(DataSet ds)
|
|
||||||
{
|
|
||||||
// Print out any name and extended properties.
|
|
||||||
Console.WriteLine("DataSet is named: {0}", ds.DataSetName);
|
|
||||||
foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
|
|
||||||
}
|
|
||||||
Console.WriteLine();
|
|
||||||
foreach (DataTable dt in ds.Tables)
|
|
||||||
{
|
|
||||||
Console.WriteLine("=> {0} Table:", dt.TableName);
|
|
||||||
// Print out the column names.
|
|
||||||
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
|
|
||||||
{
|
|
||||||
Console.Write(dt.Columns[curCol].ColumnName + "\t");
|
|
||||||
}
|
|
||||||
Console.WriteLine("\n----------------------------------");
|
|
||||||
// Print the DataTable.
|
|
||||||
for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
|
|
||||||
{
|
|
||||||
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
|
|
||||||
{
|
|
||||||
Console.Write(dt.Rows[curRow][curCol].ToString() + "\t");
|
|
||||||
}
|
|
||||||
Console.WriteLine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,9 +31,9 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData
|
public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
|
|
||||||
if (words.Length == 1)
|
if (words.Length == 1)
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
||||||
m_Realm, scopeID.ToString(), words[0]);
|
m_Realm, scopeID.ToString(), words[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
|
@ -27,9 +27,9 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A base class for methods needed by all SQLite database classes
|
/// A base class for methods needed by all SQLite database classes
|
|
@ -29,12 +29,12 @@ using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Mono.Data.Sqlite;
|
using Mono.Data.SqliteClient;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteNG
|
namespace OpenSim.Data.SQLiteLegacy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A MySQL Interface for the Asset Server
|
/// A MySQL Interface for the Asset Server
|
||||||
|
@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLiteNG
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
//CloseCommand(cmd);
|
CloseCommand(cmd);
|
||||||
|
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
|
@ -39,7 +39,8 @@ namespace OpenSim.Data.Tests
|
||||||
public class DataTestUtil
|
public class DataTestUtil
|
||||||
{
|
{
|
||||||
public const uint UNSIGNED_INTEGER_MIN = uint.MinValue;
|
public const uint UNSIGNED_INTEGER_MIN = uint.MinValue;
|
||||||
public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue;
|
//public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue;
|
||||||
|
public const uint UNSIGNED_INTEGER_MAX = INTEGER_MAX;
|
||||||
|
|
||||||
public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue
|
public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue
|
||||||
public const int INTEGER_MAX = int.MaxValue;
|
public const int INTEGER_MAX = int.MaxValue;
|
||||||
|
|
|
@ -365,6 +365,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
List<UUID> GetOnlineFriends(UUID userID)
|
List<UUID> GetOnlineFriends(UUID userID)
|
||||||
{
|
{
|
||||||
List<string> friendList = new List<string>();
|
List<string> friendList = new List<string>();
|
||||||
|
List<UUID> online = new List<UUID>();
|
||||||
|
|
||||||
foreach (FriendInfo fi in m_Friends[userID].Friends)
|
foreach (FriendInfo fi in m_Friends[userID].Friends)
|
||||||
{
|
{
|
||||||
|
@ -372,9 +373,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
friendList.Add(fi.Friend);
|
friendList.Add(fi.Friend);
|
||||||
}
|
}
|
||||||
|
|
||||||
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
|
if (friendList.Count == 0)
|
||||||
|
// no friends whatsoever
|
||||||
|
return online;
|
||||||
|
|
||||||
List<UUID> online = new List<UUID>();
|
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
|
||||||
|
|
||||||
foreach (PresenceInfo pi in presence)
|
foreach (PresenceInfo pi in presence)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
<RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" />
|
<RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" />
|
||||||
<RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" />
|
<RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" />
|
||||||
<RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" />
|
<RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" />
|
||||||
|
<RegionModule id="HGInventoryBroker2" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker2" />
|
||||||
<RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" />
|
<RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" />
|
||||||
<RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" />
|
<RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" />
|
||||||
<RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" />
|
<RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" />
|
||||||
|
|
|
@ -41,27 +41,22 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
{
|
{
|
||||||
public class HGInventoryBroker2 : INonSharedRegionModule, IInventoryService
|
public class HGInventoryBroker2 : ISharedRegionModule, IInventoryService
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private static bool m_Initialized = false;
|
|
||||||
private static bool m_Enabled = false;
|
private static bool m_Enabled = false;
|
||||||
|
|
||||||
private static IInventoryService m_LocalGridInventoryService;
|
private static IInventoryService m_LocalGridInventoryService;
|
||||||
private static ISessionAuthInventoryService m_HGService; // obsolete
|
|
||||||
private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>();
|
private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>();
|
||||||
|
|
||||||
// A cache of userIDs --> ServiceURLs, for HGBroker only
|
// A cache of userIDs --> ServiceURLs, for HGBroker only
|
||||||
protected Dictionary<UUID, string> m_InventoryURLs;
|
protected Dictionary<UUID, string> m_InventoryURLs = new Dictionary<UUID,string>();
|
||||||
|
|
||||||
private Scene m_Scene;
|
|
||||||
private List<Scene> m_Scenes = new List<Scene>();
|
private List<Scene> m_Scenes = new List<Scene>();
|
||||||
|
|
||||||
private IUserAccountService m_UserAccountService;
|
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return null; }
|
get { return null; }
|
||||||
|
@ -74,65 +69,45 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
if (!m_Initialized)
|
IConfig moduleConfig = source.Configs["Modules"];
|
||||||
|
if (moduleConfig != null)
|
||||||
{
|
{
|
||||||
IConfig moduleConfig = source.Configs["Modules"];
|
string name = moduleConfig.GetString("InventoryServices", "");
|
||||||
if (moduleConfig != null)
|
if (name == Name)
|
||||||
{
|
{
|
||||||
string name = moduleConfig.GetString("InventoryServices", "");
|
IConfig inventoryConfig = source.Configs["InventoryService"];
|
||||||
if (name == Name)
|
if (inventoryConfig == null)
|
||||||
{
|
{
|
||||||
IConfig inventoryConfig = source.Configs["InventoryService"];
|
m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
|
||||||
if (inventoryConfig == null)
|
return;
|
||||||
{
|
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string localDll = inventoryConfig.GetString("LocalGridInventoryService",
|
|
||||||
String.Empty);
|
|
||||||
string HGDll = inventoryConfig.GetString("HypergridInventoryService",
|
|
||||||
String.Empty);
|
|
||||||
|
|
||||||
if (localDll == String.Empty)
|
|
||||||
{
|
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
|
|
||||||
//return;
|
|
||||||
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HGDll == String.Empty)
|
|
||||||
{
|
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService");
|
|
||||||
//return;
|
|
||||||
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object[] args = new Object[] { source };
|
|
||||||
m_LocalGridInventoryService =
|
|
||||||
ServerUtils.LoadPlugin<IInventoryService>(localDll,
|
|
||||||
args);
|
|
||||||
|
|
||||||
m_HGService =
|
|
||||||
ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll,
|
|
||||||
args);
|
|
||||||
|
|
||||||
if (m_LocalGridInventoryService == null)
|
|
||||||
{
|
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (m_HGService == null)
|
|
||||||
{
|
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Enabled = true;
|
|
||||||
m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string localDll = inventoryConfig.GetString("LocalGridInventoryService",
|
||||||
|
String.Empty);
|
||||||
|
//string HGDll = inventoryConfig.GetString("HypergridInventoryService",
|
||||||
|
// String.Empty);
|
||||||
|
|
||||||
|
if (localDll == String.Empty)
|
||||||
|
{
|
||||||
|
m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
|
||||||
|
//return;
|
||||||
|
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
||||||
|
}
|
||||||
|
|
||||||
|
Object[] args = new Object[] { source };
|
||||||
|
m_LocalGridInventoryService =
|
||||||
|
ServerUtils.LoadPlugin<IInventoryService>(localDll,
|
||||||
|
args);
|
||||||
|
|
||||||
|
if (m_LocalGridInventoryService == null)
|
||||||
|
{
|
||||||
|
m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Enabled = true;
|
||||||
|
m_log.InfoFormat("[HG INVENTORY CONNECTOR]: HG inventory broker enabled with inner connector of type {0}", m_LocalGridInventoryService.GetType());
|
||||||
}
|
}
|
||||||
m_Initialized = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,13 +124,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_Scene = scene;
|
|
||||||
m_Scenes.Add(scene);
|
m_Scenes.Add(scene);
|
||||||
m_UserAccountService = m_Scene.UserAccountService;
|
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IInventoryService>(this);
|
scene.RegisterModuleInterface<IInventoryService>(this);
|
||||||
|
|
||||||
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
|
|
||||||
scene.EventManager.OnClientClosed += OnClientClosed;
|
scene.EventManager.OnClientClosed += OnClientClosed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -177,13 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Cache
|
#region URL Cache
|
||||||
|
|
||||||
void OnMakeRootAgent(ScenePresence presence)
|
|
||||||
{
|
|
||||||
if (!m_InventoryURLs.ContainsKey(presence.UUID))
|
|
||||||
CacheInventoryServiceURL(presence.Scene, presence.UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnClientClosed(UUID clientID, Scene scene)
|
void OnClientClosed(UUID clientID, Scene scene)
|
||||||
{
|
{
|
||||||
|
@ -200,10 +166,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping inventory URL",
|
|
||||||
scene.RegionInfo.RegionName, clientID);
|
|
||||||
DropInventoryServiceURL(clientID);
|
DropInventoryServiceURL(clientID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,35 +175,47 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
/// and sticks it in the cache
|
/// and sticks it in the cache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID"></param>
|
/// <param name="userID"></param>
|
||||||
private void CacheInventoryServiceURL(Scene scene, UUID userID)
|
private void CacheInventoryServiceURL(UUID userID)
|
||||||
{
|
{
|
||||||
if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null)
|
if (m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID) == null)
|
||||||
{
|
{
|
||||||
// The user does not have a local account; let's cache its service URL
|
// The user does not have a local account; let's cache its service URL
|
||||||
string inventoryURL = string.Empty;
|
string inventoryURL = string.Empty;
|
||||||
ScenePresence sp = null;
|
ScenePresence sp = null;
|
||||||
scene.TryGetScenePresence(userID, out sp);
|
foreach (Scene scene in m_Scenes)
|
||||||
if (sp != null)
|
|
||||||
{
|
{
|
||||||
AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
scene.TryGetScenePresence(userID, out sp);
|
||||||
if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
|
if (sp != null)
|
||||||
{
|
{
|
||||||
inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
|
AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
||||||
if (inventoryURL != null && inventoryURL != string.Empty)
|
if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
|
||||||
{
|
{
|
||||||
inventoryURL = inventoryURL.Trim(new char[] { '/' });
|
inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
|
||||||
m_InventoryURLs.Add(userID, inventoryURL);
|
if (inventoryURL != null && inventoryURL != string.Empty)
|
||||||
|
{
|
||||||
|
inventoryURL = inventoryURL.Trim(new char[] { '/' });
|
||||||
|
m_InventoryURLs.Add(userID, inventoryURL);
|
||||||
|
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// else put a null; it means that the methods should forward to local grid's inventory
|
||||||
|
m_InventoryURLs.Add(userID, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DropInventoryServiceURL(UUID userID)
|
private void DropInventoryServiceURL(UUID userID)
|
||||||
{
|
{
|
||||||
lock (m_InventoryURLs)
|
lock (m_InventoryURLs)
|
||||||
if (m_InventoryURLs.ContainsKey(userID))
|
if (m_InventoryURLs.ContainsKey(userID))
|
||||||
|
{
|
||||||
|
string url = m_InventoryURLs[userID];
|
||||||
m_InventoryURLs.Remove(userID);
|
m_InventoryURLs.Remove(userID);
|
||||||
|
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Removed {0} from the cache of inventory URLs", url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetInventoryServiceURL(UUID userID)
|
public string GetInventoryServiceURL(UUID userID)
|
||||||
|
@ -249,7 +223,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (m_InventoryURLs.ContainsKey(userID))
|
if (m_InventoryURLs.ContainsKey(userID))
|
||||||
return m_InventoryURLs[userID];
|
return m_InventoryURLs[userID];
|
||||||
|
|
||||||
return null;
|
else
|
||||||
|
CacheInventoryServiceURL(userID);
|
||||||
|
|
||||||
|
return m_InventoryURLs[userID];
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -276,7 +253,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public InventoryFolderBase GetRootFolder(UUID userID)
|
public InventoryFolderBase GetRootFolder(UUID userID)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HGInventory]: GetRootFolder for {0}", userID);
|
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(userID);
|
string invURL = GetInventoryServiceURL(userID);
|
||||||
|
|
||||||
|
@ -290,7 +267,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HGInventory]: GetFolderForType {0} type {1}", userID, type);
|
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(userID);
|
string invURL = GetInventoryServiceURL(userID);
|
||||||
|
|
||||||
|
@ -304,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
m_log.Debug("[HGInventory]: GetFolderContent " + folderID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(userID);
|
string invURL = GetInventoryServiceURL(userID);
|
||||||
|
|
||||||
|
@ -319,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
m_log.Debug("[HGInventory]: GetFolderItems " + folderID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(userID);
|
string invURL = GetInventoryServiceURL(userID);
|
||||||
|
|
||||||
|
@ -337,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: AddFolder " + folder.ID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||||
|
|
||||||
|
@ -354,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: UpdateFolder " + folder.ID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||||
|
|
||||||
|
@ -373,7 +350,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folderIDs.Count == 0)
|
if (folderIDs.Count == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: DeleteFolders for " + ownerID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(ownerID);
|
string invURL = GetInventoryServiceURL(ownerID);
|
||||||
|
|
||||||
|
@ -390,7 +367,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: MoveFolder for " + folder.Owner);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||||
|
|
||||||
|
@ -407,7 +384,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: PurgeFolder for " + folder.Owner);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||||
|
|
||||||
|
@ -424,7 +401,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: AddItem " + item.ID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(item.Owner);
|
string invURL = GetInventoryServiceURL(item.Owner);
|
||||||
|
|
||||||
|
@ -441,7 +418,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: UpdateItem " + item.ID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(item.Owner);
|
string invURL = GetInventoryServiceURL(item.Owner);
|
||||||
|
|
||||||
|
@ -460,7 +437,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (items.Count == 0)
|
if (items.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: MoveItems for " + ownerID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(ownerID);
|
string invURL = GetInventoryServiceURL(ownerID);
|
||||||
|
|
||||||
|
@ -481,7 +458,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (itemIDs.Count == 0)
|
if (itemIDs.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: DeleteItems for " + ownerID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(ownerID);
|
string invURL = GetInventoryServiceURL(ownerID);
|
||||||
|
|
||||||
|
@ -497,7 +474,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return null;
|
return null;
|
||||||
m_log.Debug("[HGInventory]: GetItem " + item.ID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(item.Owner);
|
string invURL = GetInventoryServiceURL(item.Owner);
|
||||||
|
|
||||||
|
@ -514,7 +491,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
m_log.Debug("[HGInventory]: GetFolder " + folder.ID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||||
|
|
||||||
|
@ -538,7 +515,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||||
{
|
{
|
||||||
m_log.Debug("[HGInventory]: GetAssetPermissions " + assetID);
|
m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
|
||||||
|
|
||||||
string invURL = GetInventoryServiceURL(userID);
|
string invURL = GetInventoryServiceURL(userID);
|
||||||
|
|
||||||
|
@ -575,44 +552,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return connector;
|
return connector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private UUID GetSessionID(UUID userID)
|
|
||||||
{
|
|
||||||
ScenePresence sp = null;
|
|
||||||
if (m_Scene.TryGetScenePresence(userID, out sp))
|
|
||||||
{
|
|
||||||
return sp.ControllingClient.SessionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scene presence for {0} not found", userID);
|
|
||||||
return UUID.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsForeignUser(UUID userID, out string inventoryURL)
|
|
||||||
{
|
|
||||||
inventoryURL = string.Empty;
|
|
||||||
UserAccount account = null;
|
|
||||||
if (m_Scene.UserAccountService != null)
|
|
||||||
account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
|
|
||||||
|
|
||||||
if (account == null) // foreign user
|
|
||||||
{
|
|
||||||
ScenePresence sp = null;
|
|
||||||
m_Scene.TryGetScenePresence(userID, out sp);
|
|
||||||
if (sp != null)
|
|
||||||
{
|
|
||||||
AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
|
||||||
if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
|
|
||||||
{
|
|
||||||
inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
|
|
||||||
inventoryURL = inventoryURL.Trim(new char[] { '/' });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache;
|
protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache;
|
||||||
|
|
||||||
// A cache of userIDs --> ServiceURLs, for HGBroker only
|
// A cache of userIDs --> ServiceURLs, for HGBroker only
|
||||||
protected Dictionary<UUID, string> m_InventoryURLs;
|
protected Dictionary<UUID, string> m_InventoryURLs =
|
||||||
|
new Dictionary<UUID, string>();
|
||||||
|
|
||||||
public virtual void Init(IConfigSource source, BaseInventoryConnector connector)
|
public virtual void Init(IConfigSource source, BaseInventoryConnector connector)
|
||||||
{
|
{
|
||||||
|
|
|
@ -172,11 +172,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return m_RemoteConnector.GetFolderForType(userID, type);
|
return m_RemoteConnector.GetFolderForType(userID, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
|
|
||||||
{
|
|
||||||
return m_RemoteConnector.GetSystemFolders(userID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
return m_RemoteConnector.GetFolderContent(userID, folderID);
|
return m_RemoteConnector.GetFolderContent(userID, folderID);
|
||||||
|
@ -267,9 +262,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public InventoryItemBase GetItem(InventoryItemBase item)
|
public InventoryItemBase GetItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (m_RemoteConnector == null)
|
||||||
|
m_log.DebugFormat("[XINVENTORY CONNECTOR]: connector stub is null!!!");
|
||||||
return m_RemoteConnector.GetItem(item);
|
return m_RemoteConnector.GetItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||||
|
|
||||||
m_PresenceDetector = new PresenceDetector(this);
|
m_PresenceDetector = new PresenceDetector(this);
|
||||||
|
|
||||||
m_log.Info("[INVENTORY CONNECTOR]: Remote presence enabled");
|
m_log.Info("[REMOTE PRESENCE CONNECTOR]: Remote presence enabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net;
|
|
||||||
using System.Reflection;
|
|
||||||
using log4net;
|
|
||||||
using Nini.Config;
|
|
||||||
using Nwc.XmlRpc;
|
|
||||||
using OpenSim.Server.Base;
|
|
||||||
using OpenSim.Server.Handlers.Inventory;
|
|
||||||
using OpenSim.Services.Interfaces;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
|
||||||
using OpenSim.Server.Handlers.Base;
|
|
||||||
using OpenMetaverse;
|
|
||||||
|
|
||||||
namespace OpenSim.Server.Handlers.Hypergrid
|
|
||||||
{
|
|
||||||
public class HGInventoryServiceInConnector : InventoryServiceInConnector
|
|
||||||
{
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
//private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs
|
|
||||||
//private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME);
|
|
||||||
|
|
||||||
private IUserAgentService m_UserAgentService;
|
|
||||||
|
|
||||||
public HGInventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
|
|
||||||
base(config, server, configName)
|
|
||||||
{
|
|
||||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
|
||||||
if (serverConfig == null)
|
|
||||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
|
||||||
|
|
||||||
string userAgentService = serverConfig.GetString("UserAgentService", string.Empty);
|
|
||||||
string m_userserver_url = serverConfig.GetString("UserAgentURI", String.Empty);
|
|
||||||
if (m_userserver_url != string.Empty)
|
|
||||||
{
|
|
||||||
Object[] args = new Object[] { m_userserver_url };
|
|
||||||
m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(userAgentService, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
AddHttpHandlers(server);
|
|
||||||
m_log.Debug("[HG INVENTORY HANDLER]: handlers initialized");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check that the source of an inventory request for a particular agent is a current session belonging to
|
|
||||||
/// that agent.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="session_id"></param>
|
|
||||||
/// <param name="avatar_id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override bool CheckAuthSession(string session_id, string avatar_id)
|
|
||||||
{
|
|
||||||
//m_log.InfoFormat("[HG INVENTORY IN CONNECTOR]: checking authed session {0} {1}", session_id, avatar_id);
|
|
||||||
// This doesn't work
|
|
||||||
|
|
||||||
// if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
|
|
||||||
// {
|
|
||||||
// //cache miss, ask userserver
|
|
||||||
// m_UserAgentService.VerifyAgent(session_id, ???);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// // cache hits
|
|
||||||
// m_log.Info("[HG INVENTORY IN CONNECTOR]: got authed session from cache");
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// m_log.Warn("[HG INVENTORY IN CONNECTOR]: unknown session_id, request rejected");
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -144,8 +144,6 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
return HandleGetActiveGestures(request);
|
return HandleGetActiveGestures(request);
|
||||||
case "GETASSETPERMISSIONS":
|
case "GETASSETPERMISSIONS":
|
||||||
return HandleGetAssetPermissions(request);
|
return HandleGetAssetPermissions(request);
|
||||||
case "GETSYSTEMFOLDERS":
|
|
||||||
return HandleGetSystemFolders(request);
|
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method);
|
m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method);
|
||||||
}
|
}
|
||||||
|
@ -575,29 +573,6 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
return encoding.GetBytes(xmlString);
|
return encoding.GetBytes(xmlString);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] HandleGetSystemFolders(Dictionary<string, object> request)
|
|
||||||
{
|
|
||||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
|
||||||
UUID principal = UUID.Zero;
|
|
||||||
UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
|
|
||||||
|
|
||||||
Dictionary<AssetType, InventoryFolderBase> sfolders = GetSystemFolders(principal);
|
|
||||||
//m_log.DebugFormat("[XXX]: SystemFolders got {0} folders", sfolders.Count);
|
|
||||||
|
|
||||||
Dictionary<string, object> folders = new Dictionary<string, object>();
|
|
||||||
int i = 0;
|
|
||||||
foreach (KeyValuePair<AssetType, InventoryFolderBase> kvp in sfolders)
|
|
||||||
{
|
|
||||||
folders["folder_" + i.ToString()] = EncodeFolder(kvp.Value);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
result["FOLDERS"] = folders;
|
|
||||||
|
|
||||||
string xmlString = ServerUtils.BuildXmlResponse(result);
|
|
||||||
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
|
||||||
UTF8Encoding encoding = new UTF8Encoding();
|
|
||||||
return encoding.GetBytes(xmlString);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dictionary<string, object> EncodeFolder(InventoryFolderBase f)
|
private Dictionary<string, object> EncodeFolder(InventoryFolderBase f)
|
||||||
{
|
{
|
||||||
|
@ -683,30 +658,5 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Extra
|
|
||||||
private Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
|
|
||||||
{
|
|
||||||
InventoryFolderBase root = m_InventoryService.GetRootFolder(userID);
|
|
||||||
if (root != null)
|
|
||||||
{
|
|
||||||
InventoryCollection content = m_InventoryService.GetFolderContent(userID, root.ID);
|
|
||||||
if (content != null)
|
|
||||||
{
|
|
||||||
Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>();
|
|
||||||
foreach (InventoryFolderBase folder in content.Folders)
|
|
||||||
{
|
|
||||||
if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
|
|
||||||
folders[(AssetType)folder.Type] = folder;
|
|
||||||
}
|
|
||||||
// Put the root folder there, as type Folder
|
|
||||||
folders[AssetType.Folder] = root;
|
|
||||||
return folders;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_log.WarnFormat("[XINVENTORY SERVICE]: System folders for {0} not found", userID);
|
|
||||||
return new Dictionary<AssetType, InventoryFolderBase>();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,30 +158,31 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
|
public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
|
||||||
{
|
{
|
||||||
Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
|
|
||||||
new Dictionary<string,object> {
|
|
||||||
{ "PRINCIPAL", principalID.ToString() },
|
|
||||||
{ "FOLDER", folderID.ToString() }
|
|
||||||
});
|
|
||||||
|
|
||||||
if (ret == null)
|
|
||||||
return null;
|
|
||||||
if (ret.Count == 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
|
|
||||||
InventoryCollection inventory = new InventoryCollection();
|
InventoryCollection inventory = new InventoryCollection();
|
||||||
inventory.Folders = new List<InventoryFolderBase>();
|
|
||||||
inventory.Items = new List<InventoryItemBase>();
|
|
||||||
inventory.UserID = principalID;
|
|
||||||
|
|
||||||
Dictionary<string,object> folders =
|
|
||||||
(Dictionary<string,object>)ret["FOLDERS"];
|
|
||||||
Dictionary<string,object> items =
|
|
||||||
(Dictionary<string,object>)ret["ITEMS"];
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
|
||||||
|
new Dictionary<string,object> {
|
||||||
|
{ "PRINCIPAL", principalID.ToString() },
|
||||||
|
{ "FOLDER", folderID.ToString() }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret == null)
|
||||||
|
return null;
|
||||||
|
if (ret.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
inventory.Folders = new List<InventoryFolderBase>();
|
||||||
|
inventory.Items = new List<InventoryItemBase>();
|
||||||
|
inventory.UserID = principalID;
|
||||||
|
|
||||||
|
Dictionary<string,object> folders =
|
||||||
|
(Dictionary<string,object>)ret["FOLDERS"];
|
||||||
|
Dictionary<string,object> items =
|
||||||
|
(Dictionary<string,object>)ret["ITEMS"];
|
||||||
|
|
||||||
foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
|
foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
|
||||||
inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
|
inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
|
||||||
foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
|
foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
|
||||||
|
@ -189,7 +190,7 @@ namespace OpenSim.Services.Connectors
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping content list: {0}", e.Message);
|
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolderContent: {0}", e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return inventory;
|
return inventory;
|
||||||
|
@ -408,32 +409,50 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
public InventoryItemBase GetItem(InventoryItemBase item)
|
public InventoryItemBase GetItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
Dictionary<string,object> ret = MakeRequest("GETITEM",
|
try
|
||||||
new Dictionary<string,object> {
|
{
|
||||||
|
Dictionary<string, object> ret = MakeRequest("GETITEM",
|
||||||
|
new Dictionary<string, object> {
|
||||||
{ "ID", item.ID.ToString() }
|
{ "ID", item.ID.ToString() }
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ret == null)
|
if (ret == null)
|
||||||
return null;
|
return null;
|
||||||
if (ret.Count == 0)
|
if (ret.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return BuildItem((Dictionary<string, object>)ret["item"]);
|
return BuildItem((Dictionary<string, object>)ret["item"]);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetItem: {0}", e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
Dictionary<string,object> ret = MakeRequest("GETFOLDER",
|
try
|
||||||
new Dictionary<string,object> {
|
{
|
||||||
|
Dictionary<string, object> ret = MakeRequest("GETFOLDER",
|
||||||
|
new Dictionary<string, object> {
|
||||||
{ "ID", folder.ID.ToString() }
|
{ "ID", folder.ID.ToString() }
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ret == null)
|
if (ret == null)
|
||||||
return null;
|
return null;
|
||||||
if (ret.Count == 0)
|
if (ret.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return BuildFolder((Dictionary<string, object>)ret["folder"]);
|
return BuildFolder((Dictionary<string, object>)ret["folder"]);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolder: {0}", e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryItemBase> GetActiveGestures(UUID principalID)
|
public List<InventoryItemBase> GetActiveGestures(UUID principalID)
|
||||||
|
@ -468,36 +487,6 @@ namespace OpenSim.Services.Connectors
|
||||||
return int.Parse(ret["RESULT"].ToString());
|
return int.Parse(ret["RESULT"].ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
|
|
||||||
{
|
|
||||||
Dictionary<string, object> ret = MakeRequest("GETSYSTEMFOLDERS",
|
|
||||||
new Dictionary<string, object> {
|
|
||||||
{ "PRINCIPAL", userID.ToString() },
|
|
||||||
});
|
|
||||||
|
|
||||||
if (ret == null)
|
|
||||||
return new Dictionary<AssetType,InventoryFolderBase>();
|
|
||||||
|
|
||||||
Dictionary<AssetType, InventoryFolderBase> sfolders = new Dictionary<AssetType, InventoryFolderBase>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"];
|
|
||||||
|
|
||||||
foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
|
|
||||||
{
|
|
||||||
InventoryFolderBase folder = BuildFolder((Dictionary<string, object>)o);
|
|
||||||
sfolders.Add((AssetType)folder.Type, folder);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: exception {0}", e.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return sfolders;
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are either obsolete or unused
|
// These are either obsolete or unused
|
||||||
//
|
//
|
||||||
|
|
|
@ -329,7 +329,7 @@ namespace OpenSim.Services.Connectors
|
||||||
reqString);
|
reqString);
|
||||||
if (reply == null || (reply != null && reply == string.Empty))
|
if (reply == null || (reply != null && reply == string.Empty))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply");
|
m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,11 +112,15 @@
|
||||||
;storage_plugin = "OpenSim.Data.Null.dll"
|
;storage_plugin = "OpenSim.Data.Null.dll"
|
||||||
|
|
||||||
; --- To use sqlite as region storage:
|
; --- To use sqlite as region storage:
|
||||||
; PLEASE NOTE: If you use want to use SQLite with Mono 2.6 and above, you must use the SQLiteNG plugin rather than the existing SQLite one
|
;
|
||||||
; do this by commenting out the OpenSim.Data.SQLite.dll line below and uncommenting the OpenSim.Data.SQLiteNG.dll one
|
; PLEASE NOTE: Unfortunately, the current SQLite database plugin (necessary to use SQLite with Mono on Linux) is
|
||||||
|
; not compatible with the sqlite3 library installed on Mac OSX. If you're using Mono 2.4 you can still use the old sqlite
|
||||||
|
; library by uncommenting the SQLiteLegacy.dll storage plugin (and commenting out SQLite.dll). Unfortunately, the older library
|
||||||
|
; will not work with Mono 2.6 on Mac OSX so you will either need to replace the OSX sqlite3 system library or use MySQL instead
|
||||||
|
;
|
||||||
; You will also need to do the same thing in config-include/StandaloneCommon.ini if you are running in standalone mode
|
; You will also need to do the same thing in config-include/StandaloneCommon.ini if you are running in standalone mode
|
||||||
storage_plugin = "OpenSim.Data.SQLite.dll"
|
storage_plugin = "OpenSim.Data.SQLite.dll"
|
||||||
; storage_plugin = "OpenSim.Data.SQLiteNG.dll"
|
;storage_plugin = "OpenSim.Data.SQLiteLegacy.dll"
|
||||||
storage_connection_string="URI=file:OpenSim.db,version=3";
|
storage_connection_string="URI=file:OpenSim.db,version=3";
|
||||||
|
|
||||||
; --- To use MySQL storage, supply your own connection string (this is only an example):
|
; --- To use MySQL storage, supply your own connection string (this is only an example):
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
; SQLite
|
; SQLite
|
||||||
; Uncomment this line if you want to use sqlite storage with Mono 2.4
|
|
||||||
Include-Storage = "config-include/storage/SQLiteStandalone.ini";
|
Include-Storage = "config-include/storage/SQLiteStandalone.ini";
|
||||||
|
|
||||||
; If you want to use sqlite with Mono 2.6 and above, uncomment this line instead.
|
; Unfortunately the current SQLite database plugin is not compatible with Mac OSX. You can still use the older
|
||||||
; Don't forget to do the same thing for the storage_plugin setting in OpenSim.ini
|
; legacy sqlite library if you are using Mono 2.4. Please see the notes in OpenSim.ini (search for sqlite)
|
||||||
; Include-Storage = "config-include/storage/SQLiteNGStandalone.ini";
|
; for more details
|
||||||
|
;Include-Storage = "config-include/storage/SQLiteLegacyStandalone.ini";
|
||||||
|
|
||||||
; MySql
|
; MySql
|
||||||
; Uncomment these lines if you want to use mysql storage
|
; Uncomment these lines if you want to use mysql storage
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
; These are the initialization settings for running OpenSim Standalone with an SQLite database
|
; These are the initialization settings for running OpenSim Standalone with an SQLite database
|
||||||
|
|
||||||
[DatabaseService]
|
[DatabaseService]
|
||||||
StorageProvider = "OpenSim.Data.SQLiteNG.dll"
|
StorageProvider = "OpenSim.Data.SQLiteLegacy.dll"
|
||||||
|
|
||||||
[AvatarService]
|
[AvatarService]
|
||||||
ConnectionString = "URI=file:avatars.db,version=3"
|
ConnectionString = "URI=file:avatars.db,version=3"
|
|
@ -2208,7 +2208,7 @@
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
<Project frameworkVersion="v3_5" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library">
|
<Project frameworkVersion="v3_5" name="OpenSim.Data.SQLiteLegacy" path="OpenSim/Data/SQLiteLegacy" type="Library">
|
||||||
<Configuration name="Debug">
|
<Configuration name="Debug">
|
||||||
<Options>
|
<Options>
|
||||||
<OutputPath>../../../bin/</OutputPath>
|
<OutputPath>../../../bin/</OutputPath>
|
||||||
|
@ -2245,7 +2245,7 @@
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
<Project frameworkVersion="v3_5" name="OpenSim.Data.SQLiteNG" path="OpenSim/Data/SQLiteNG" type="Library">
|
<Project frameworkVersion="v3_5" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library">
|
||||||
<Configuration name="Debug">
|
<Configuration name="Debug">
|
||||||
<Options>
|
<Options>
|
||||||
<OutputPath>../../../bin/</OutputPath>
|
<OutputPath>../../../bin/</OutputPath>
|
||||||
|
|
Loading…
Reference in New Issue