diff options
author | Homer Horwitz | 2008-09-18 20:10:09 +0000 |
---|---|---|
committer | Homer Horwitz | 2008-09-18 20:10:09 +0000 |
commit | 1c08f46ec3397f4e4fd5897107c0df89bec70d84 (patch) | |
tree | 9c6896ead729fcf0f0a9357f4a232ce2ad1d6106 /OpenSim | |
parent | * Apply http://opensimulator.org/mantis/view.php?id=2212 (diff) | |
download | opensim-SC-1c08f46ec3397f4e4fd5897107c0df89bec70d84.zip opensim-SC-1c08f46ec3397f4e4fd5897107c0df89bec70d84.tar.gz opensim-SC-1c08f46ec3397f4e4fd5897107c0df89bec70d84.tar.bz2 opensim-SC-1c08f46ec3397f4e4fd5897107c0df89bec70d84.tar.xz |
- 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)
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLRegionData.cs | 5 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateRegionData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullDataStore.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAssetData.cs | 9 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 33 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 40 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserData.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs | 5 |
9 files changed, 115 insertions, 10 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 8b808d3..ae94252 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs | |||
@@ -156,6 +156,11 @@ namespace OpenSim.Data.MSSQL | |||
156 | 156 | ||
157 | //After this we have a empty fully configured DataSet. | 157 | //After this we have a empty fully configured DataSet. |
158 | } | 158 | } |
159 | |||
160 | /// <summary> | ||
161 | /// Dispose the database | ||
162 | /// </summary> | ||
163 | public void Dispose() {} | ||
159 | 164 | ||
160 | /// <summary> | 165 | /// <summary> |
161 | /// Loads the objects present in the region. | 166 | /// Loads the objects present in the region. |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 9c36d49..284c970 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -203,6 +203,8 @@ namespace OpenSim.Data.MySQL | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | public void Dispose() {} | ||
207 | |||
206 | /// <summary> | 208 | /// <summary> |
207 | /// Get the wait_timeout value for our connection | 209 | /// Get the wait_timeout value for our connection |
208 | /// </summary> | 210 | /// </summary> |
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs index 07bf05c..ecb29fe 100644 --- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs +++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs | |||
@@ -105,6 +105,8 @@ namespace OpenSim.Data.NHibernate | |||
105 | * | 105 | * |
106 | **********************************************************************/ | 106 | **********************************************************************/ |
107 | 107 | ||
108 | public void Dispose() {} | ||
109 | |||
108 | public void StoreRegionSettings(RegionSettings rs) | 110 | public void StoreRegionSettings(RegionSettings rs) |
109 | { | 111 | { |
110 | } | 112 | } |
diff --git a/OpenSim/Data/Null/NullDataStore.cs b/OpenSim/Data/Null/NullDataStore.cs index aea03d6..94ad4af 100644 --- a/OpenSim/Data/Null/NullDataStore.cs +++ b/OpenSim/Data/Null/NullDataStore.cs | |||
@@ -43,6 +43,10 @@ namespace OpenSim.Data.Null | |||
43 | return; | 43 | return; |
44 | } | 44 | } |
45 | 45 | ||
46 | public void Dispose() | ||
47 | { | ||
48 | } | ||
49 | |||
46 | public void StoreRegionSettings(RegionSettings rs) | 50 | public void StoreRegionSettings(RegionSettings rs) |
47 | { | 51 | { |
48 | } | 52 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 8b14f09..17af2b0 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -56,7 +56,14 @@ namespace OpenSim.Data.SQLite | |||
56 | 56 | ||
57 | private SqliteConnection m_conn; | 57 | private SqliteConnection m_conn; |
58 | 58 | ||
59 | override public void Dispose() { } | 59 | override public void Dispose() |
60 | { | ||
61 | if (m_conn != null) | ||
62 | { | ||
63 | m_conn.Close(); | ||
64 | m_conn = null; | ||
65 | } | ||
66 | } | ||
60 | 67 | ||
61 | /// <summary> | 68 | /// <summary> |
62 | /// <list type="bullet"> | 69 | /// <list type="bullet"> |
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index ca7e612..49d351a 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Data.SQLite | |||
46 | private const string invItemsSelect = "select * from inventoryitems"; | 46 | private const string invItemsSelect = "select * from inventoryitems"; |
47 | private const string invFoldersSelect = "select * from inventoryfolders"; | 47 | private const string invFoldersSelect = "select * from inventoryfolders"; |
48 | 48 | ||
49 | private SqliteConnection conn; | ||
49 | private DataSet ds; | 50 | private DataSet ds; |
50 | private SqliteDataAdapter invItemsDa; | 51 | private SqliteDataAdapter invItemsDa; |
51 | private SqliteDataAdapter invFoldersDa; | 52 | private SqliteDataAdapter invFoldersDa; |
@@ -71,7 +72,7 @@ namespace OpenSim.Data.SQLite | |||
71 | dbconnect = "URI=file:inventoryStore.db,version=3"; | 72 | dbconnect = "URI=file:inventoryStore.db,version=3"; |
72 | } | 73 | } |
73 | m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect); | 74 | m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect); |
74 | SqliteConnection conn = new SqliteConnection(dbconnect); | 75 | conn = new SqliteConnection(dbconnect); |
75 | 76 | ||
76 | conn.Open(); | 77 | conn.Open(); |
77 | 78 | ||
@@ -102,6 +103,29 @@ namespace OpenSim.Data.SQLite | |||
102 | } | 103 | } |
103 | 104 | ||
104 | /// <summary> | 105 | /// <summary> |
106 | /// Closes the inventory interface | ||
107 | /// </summary> | ||
108 | public void Dispose() | ||
109 | { | ||
110 | if(conn != null) { | ||
111 | conn.Close(); | ||
112 | conn = null; | ||
113 | } | ||
114 | if(invItemsDa != null) { | ||
115 | invItemsDa.Dispose(); | ||
116 | invItemsDa = null; | ||
117 | } | ||
118 | if(invFoldersDa != null) { | ||
119 | invFoldersDa.Dispose(); | ||
120 | invFoldersDa = null; | ||
121 | } | ||
122 | if(ds != null) { | ||
123 | ds.Dispose(); | ||
124 | ds = null; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | /// <summary> | ||
105 | /// | 129 | /// |
106 | /// </summary> | 130 | /// </summary> |
107 | /// <param name="row"></param> | 131 | /// <param name="row"></param> |
@@ -278,13 +302,6 @@ namespace OpenSim.Data.SQLite | |||
278 | } | 302 | } |
279 | 303 | ||
280 | /// <summary> | 304 | /// <summary> |
281 | /// Closes the inventory interface | ||
282 | /// </summary> | ||
283 | public void Dispose() | ||
284 | { | ||
285 | } | ||
286 | |||
287 | /// <summary> | ||
288 | /// The name of this DB provider | 305 | /// The name of this DB provider |
289 | /// </summary> | 306 | /// </summary> |
290 | /// <returns>Name of DB provider</returns> | 307 | /// <returns>Name of DB provider</returns> |
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 36b3d2f..f71535f 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -203,6 +203,46 @@ namespace OpenSim.Data.SQLite | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | public void Dispose() | ||
207 | { | ||
208 | if(m_conn != null) { | ||
209 | m_conn.Close(); | ||
210 | m_conn = null; | ||
211 | } | ||
212 | if(ds != null) { | ||
213 | ds.Dispose(); | ||
214 | ds = null; | ||
215 | } | ||
216 | if(primDa != null) { | ||
217 | primDa.Dispose(); | ||
218 | primDa = null; | ||
219 | } | ||
220 | if(shapeDa != null) { | ||
221 | shapeDa.Dispose(); | ||
222 | shapeDa = null; | ||
223 | } | ||
224 | if(itemsDa != null) { | ||
225 | itemsDa.Dispose(); | ||
226 | itemsDa = null; | ||
227 | } | ||
228 | if(terrainDa != null) { | ||
229 | terrainDa.Dispose(); | ||
230 | terrainDa = null; | ||
231 | } | ||
232 | if(landDa != null) { | ||
233 | landDa.Dispose(); | ||
234 | landDa = null; | ||
235 | } | ||
236 | if(landAccessListDa != null) { | ||
237 | landAccessListDa.Dispose(); | ||
238 | landAccessListDa = null; | ||
239 | } | ||
240 | if(regionSettingsDa != null) { | ||
241 | regionSettingsDa.Dispose(); | ||
242 | regionSettingsDa = null; | ||
243 | } | ||
244 | } | ||
245 | |||
206 | public void StoreRegionSettings(RegionSettings rs) | 246 | public void StoreRegionSettings(RegionSettings rs) |
207 | { | 247 | { |
208 | lock (ds) | 248 | lock (ds) |
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index 2c1e3c3..a238ebf 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs | |||
@@ -122,7 +122,30 @@ namespace OpenSim.Data.SQLite | |||
122 | return; | 122 | return; |
123 | } | 123 | } |
124 | 124 | ||
125 | public override void Dispose () {} | 125 | public override void Dispose () |
126 | { | ||
127 | if(g_conn != null) { | ||
128 | g_conn.Close(); | ||
129 | g_conn = null; | ||
130 | } | ||
131 | if(ds != null) { | ||
132 | ds.Dispose(); | ||
133 | ds = null; | ||
134 | } | ||
135 | if(da != null) { | ||
136 | da.Dispose(); | ||
137 | da = null; | ||
138 | } | ||
139 | if(daf != null) { | ||
140 | daf.Dispose(); | ||
141 | daf = null; | ||
142 | } | ||
143 | if(dua != null) { | ||
144 | dua.Dispose(); | ||
145 | dua = null; | ||
146 | } | ||
147 | aplist = null; | ||
148 | } | ||
126 | 149 | ||
127 | /// <summary> | 150 | /// <summary> |
128 | /// see IUserDataPlugin, | 151 | /// see IUserDataPlugin, |
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs index 5f10ec5..0ee4933 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs | |||
@@ -42,6 +42,11 @@ namespace OpenSim.Region.Environment.Interfaces | |||
42 | void Initialise(string filename); | 42 | void Initialise(string filename); |
43 | 43 | ||
44 | /// <summary> | 44 | /// <summary> |
45 | /// Dispose the database | ||
46 | /// </summary> | ||
47 | void Dispose(); | ||
48 | |||
49 | /// <summary> | ||
45 | /// Stores all object's details apart from inventory | 50 | /// Stores all object's details apart from inventory |
46 | /// </summary> | 51 | /// </summary> |
47 | /// <param name="obj"></param> | 52 | /// <param name="obj"></param> |