refactor: Pull up Assembly of the SQLite classes as a protected property, so that it can be overwritten in subclasses. That way extensions can decide in which assembly migration resources should be looked up. This is a refactor similar to commit 9923a2ff10 for MySQL -- no functional changes.

bulletsim
Marck 2011-06-30 20:05:02 +02:00
parent f5ddf37112
commit dd2564d7ec
6 changed files with 32 additions and 11 deletions

View File

@ -57,6 +57,11 @@ namespace OpenSim.Data.SQLite
private SqliteConnection m_conn; private SqliteConnection m_conn;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
override public void Dispose() override public void Dispose()
{ {
if (m_conn != null) if (m_conn != null)
@ -83,8 +88,7 @@ namespace OpenSim.Data.SQLite
m_conn = new SqliteConnection(dbconnect); m_conn = new SqliteConnection(dbconnect);
m_conn.Open(); m_conn.Open();
Assembly assem = GetType().Assembly; Migration m = new Migration(m_conn, Assembly, "AssetStore");
Migration m = new Migration(m_conn, assem, "AssetStore");
m.Update(); m.Update();
return; return;

View File

@ -53,6 +53,11 @@ namespace OpenSim.Data.SQLite
protected static SqliteConnection m_Connection; protected static SqliteConnection m_Connection;
private static bool m_initialized = false; private static bool m_initialized = false;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public SQLiteAuthenticationData(string connectionString, string realm) public SQLiteAuthenticationData(string connectionString, string realm)
: base(connectionString) : base(connectionString)
{ {
@ -63,7 +68,7 @@ namespace OpenSim.Data.SQLite
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"); Migration m = new Migration(m_Connection, Assembly, "AuthStore");
m.Update(); m.Update();
m_initialized = true; m_initialized = true;

View File

@ -53,6 +53,11 @@ namespace OpenSim.Data.SQLite
private Dictionary<string, FieldInfo> m_FieldMap = private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>(); new Dictionary<string, FieldInfo>();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public SQLiteEstateStore() public SQLiteEstateStore()
{ {
} }
@ -71,8 +76,7 @@ namespace OpenSim.Data.SQLite
m_connection = new SqliteConnection(m_connectionString); m_connection = new SqliteConnection(m_connectionString);
m_connection.Open(); m_connection.Open();
Assembly assem = GetType().Assembly; Migration m = new Migration(m_connection, Assembly, "EstateStore");
Migration m = new Migration(m_connection, assem, "EstateStore");
m.Update(); m.Update();
//m_connection.Close(); //m_connection.Close();

View File

@ -55,6 +55,11 @@ namespace OpenSim.Data.SQLite
protected static SqliteConnection m_Connection; protected static SqliteConnection m_Connection;
private static bool m_initialized; private static bool m_initialized;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public SQLiteGenericTableHandler(string connectionString, public SQLiteGenericTableHandler(string connectionString,
string realm, string storeName) : base(connectionString) string realm, string storeName) : base(connectionString)
{ {
@ -68,13 +73,12 @@ namespace OpenSim.Data.SQLite
if (storeName != String.Empty) if (storeName != String.Empty)
{ {
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, Assembly, storeName);
Migration m = new Migration(m_Connection, assem, storeName); Migration m = new Migration(m_Connection, Assembly, storeName);
m.Update(); m.Update();
//newConnection.Close(); //newConnection.Close();
//newConnection.Dispose(); //newConnection.Dispose();

View File

@ -74,6 +74,11 @@ namespace OpenSim.Data.SQLite
private String m_connectionString; private String m_connectionString;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public SQLiteSimulationData() public SQLiteSimulationData()
{ {
} }
@ -132,8 +137,7 @@ namespace OpenSim.Data.SQLite
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
// This actually does the roll forward assembly stuff // This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly; Migration m = new Migration(m_conn, Assembly, "RegionStore");
Migration m = new Migration(m_conn, assem, "RegionStore");
m.Update(); m.Update();
lock (ds) lock (ds)

View File

@ -41,7 +41,7 @@ using OpenSim.Framework;
namespace OpenSim.Data.SQLite namespace OpenSim.Data.SQLite
{ {
/// <summary> /// <summary>
/// A MySQL Interface for the Asset Server /// A SQLite Interface for the Asset Server
/// </summary> /// </summary>
public class SQLiteXInventoryData : IXInventoryData public class SQLiteXInventoryData : IXInventoryData
{ {