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/Data/SQLite | |
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 '')
-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 |
4 files changed, 97 insertions, 10 deletions
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, |