- Add Dispose method to IRegionDataStore

- Add necessary dummy Dispose-methods where they are missing
- Implement the SQLite Dispose-methods
(currently only used for unit tests, in the next commit)
0.6.0-stable
Homer Horwitz 2008-09-18 20:10:09 +00:00
parent 48978ba3e0
commit 1c08f46ec3
9 changed files with 115 additions and 10 deletions

View File

@ -156,6 +156,11 @@ namespace OpenSim.Data.MSSQL
//After this we have a empty fully configured DataSet.
}
/// <summary>
/// Dispose the database
/// </summary>
public void Dispose() {}
/// <summary>
/// Loads the objects present in the region.

View File

@ -203,6 +203,8 @@ namespace OpenSim.Data.MySQL
}
}
public void Dispose() {}
/// <summary>
/// Get the wait_timeout value for our connection
/// </summary>

View File

@ -105,6 +105,8 @@ namespace OpenSim.Data.NHibernate
*
**********************************************************************/
public void Dispose() {}
public void StoreRegionSettings(RegionSettings rs)
{
}

View File

@ -43,6 +43,10 @@ namespace OpenSim.Data.Null
return;
}
public void Dispose()
{
}
public void StoreRegionSettings(RegionSettings rs)
{
}

View File

@ -56,7 +56,14 @@ namespace OpenSim.Data.SQLite
private SqliteConnection m_conn;
override public void Dispose() { }
override public void Dispose()
{
if (m_conn != null)
{
m_conn.Close();
m_conn = null;
}
}
/// <summary>
/// <list type="bullet">

View File

@ -46,6 +46,7 @@ namespace OpenSim.Data.SQLite
private const string invItemsSelect = "select * from inventoryitems";
private const string invFoldersSelect = "select * from inventoryfolders";
private SqliteConnection conn;
private DataSet ds;
private SqliteDataAdapter invItemsDa;
private SqliteDataAdapter invFoldersDa;
@ -71,7 +72,7 @@ namespace OpenSim.Data.SQLite
dbconnect = "URI=file:inventoryStore.db,version=3";
}
m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect);
SqliteConnection conn = new SqliteConnection(dbconnect);
conn = new SqliteConnection(dbconnect);
conn.Open();
@ -101,6 +102,29 @@ namespace OpenSim.Data.SQLite
ds.AcceptChanges();
}
/// <summary>
/// Closes the inventory interface
/// </summary>
public void Dispose()
{
if(conn != null) {
conn.Close();
conn = null;
}
if(invItemsDa != null) {
invItemsDa.Dispose();
invItemsDa = null;
}
if(invFoldersDa != null) {
invFoldersDa.Dispose();
invFoldersDa = null;
}
if(ds != null) {
ds.Dispose();
ds = null;
}
}
/// <summary>
///
/// </summary>
@ -277,13 +301,6 @@ namespace OpenSim.Data.SQLite
// TODO: DataSet commit
}
/// <summary>
/// Closes the inventory interface
/// </summary>
public void Dispose()
{
}
/// <summary>
/// The name of this DB provider
/// </summary>

View File

@ -203,6 +203,46 @@ namespace OpenSim.Data.SQLite
}
}
public void Dispose()
{
if(m_conn != null) {
m_conn.Close();
m_conn = null;
}
if(ds != null) {
ds.Dispose();
ds = null;
}
if(primDa != null) {
primDa.Dispose();
primDa = null;
}
if(shapeDa != null) {
shapeDa.Dispose();
shapeDa = null;
}
if(itemsDa != null) {
itemsDa.Dispose();
itemsDa = null;
}
if(terrainDa != null) {
terrainDa.Dispose();
terrainDa = null;
}
if(landDa != null) {
landDa.Dispose();
landDa = null;
}
if(landAccessListDa != null) {
landAccessListDa.Dispose();
landAccessListDa = null;
}
if(regionSettingsDa != null) {
regionSettingsDa.Dispose();
regionSettingsDa = null;
}
}
public void StoreRegionSettings(RegionSettings rs)
{
lock (ds)

View File

@ -122,7 +122,30 @@ namespace OpenSim.Data.SQLite
return;
}
public override void Dispose () {}
public override void Dispose ()
{
if(g_conn != null) {
g_conn.Close();
g_conn = null;
}
if(ds != null) {
ds.Dispose();
ds = null;
}
if(da != null) {
da.Dispose();
da = null;
}
if(daf != null) {
daf.Dispose();
daf = null;
}
if(dua != null) {
dua.Dispose();
dua = null;
}
aplist = null;
}
/// <summary>
/// see IUserDataPlugin,

View File

@ -41,6 +41,11 @@ namespace OpenSim.Region.Environment.Interfaces
/// a connection string for the database</param>
void Initialise(string filename);
/// <summary>
/// Dispose the database
/// </summary>
void Dispose();
/// <summary>
/// Stores all object's details apart from inventory
/// </summary>