diff options
author | Justin Clark-Casey (justincc) | 2012-11-14 04:45:59 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-11-14 04:45:59 +0000 |
commit | 94da908813e42c328572bc5da2ddc41b6664b59c (patch) | |
tree | 1a3e1ffaadb34cac64c798f5cc06eadf612c6af9 /OpenSim/Data/SQLite/SQLiteXInventoryData.cs | |
parent | If no ISimulationDataStore or IEstateDataStore implementations could be loade... (diff) | |
download | opensim-SC_OLD-94da908813e42c328572bc5da2ddc41b6664b59c.zip opensim-SC_OLD-94da908813e42c328572bc5da2ddc41b6664b59c.tar.gz opensim-SC_OLD-94da908813e42c328572bc5da2ddc41b6664b59c.tar.bz2 opensim-SC_OLD-94da908813e42c328572bc5da2ddc41b6664b59c.tar.xz |
More consistently dispose of SqliteCommand in OpenSim.Data.SQLite where possible.
Not doing SQLiteInventoryStore since this is no longer used and should disappear in the future.
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteXInventoryData.cs')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index 75f8c87..8eb1a63 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs | |||
@@ -139,35 +139,41 @@ namespace OpenSim.Data.SQLite | |||
139 | 139 | ||
140 | public bool MoveItem(string id, string newParent) | 140 | public bool MoveItem(string id, string newParent) |
141 | { | 141 | { |
142 | SqliteCommand cmd = new SqliteCommand(); | 142 | using (SqliteCommand cmd = new SqliteCommand()) |
143 | 143 | { | |
144 | cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm); | 144 | cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm); |
145 | cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent)); | 145 | cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent)); |
146 | cmd.Parameters.Add(new SqliteParameter(":InventoryID", id)); | 146 | cmd.Parameters.Add(new SqliteParameter(":InventoryID", id)); |
147 | 147 | ||
148 | return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true; | 148 | return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true; |
149 | } | ||
149 | } | 150 | } |
150 | 151 | ||
151 | public XInventoryItem[] GetActiveGestures(UUID principalID) | 152 | public XInventoryItem[] GetActiveGestures(UUID principalID) |
152 | { | 153 | { |
153 | SqliteCommand cmd = new SqliteCommand(); | 154 | using (SqliteCommand cmd = new SqliteCommand()) |
154 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm); | 155 | { |
156 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm); | ||
155 | 157 | ||
156 | cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString())); | 158 | cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString())); |
157 | cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture)); | 159 | cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture)); |
158 | 160 | ||
159 | return DoQuery(cmd); | 161 | return DoQuery(cmd); |
162 | } | ||
160 | } | 163 | } |
161 | 164 | ||
162 | public int GetAssetPermissions(UUID principalID, UUID assetID) | 165 | public int GetAssetPermissions(UUID principalID, UUID assetID) |
163 | { | 166 | { |
164 | SqliteCommand cmd = new SqliteCommand(); | 167 | IDataReader reader; |
165 | 168 | ||
166 | cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm); | 169 | using (SqliteCommand cmd = new SqliteCommand()) |
167 | cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString())); | 170 | { |
168 | cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString())); | 171 | cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm); |
172 | cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString())); | ||
173 | cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString())); | ||
169 | 174 | ||
170 | IDataReader reader = ExecuteReader(cmd, m_Connection); | 175 | reader = ExecuteReader(cmd, m_Connection); |
176 | } | ||
171 | 177 | ||
172 | int perms = 0; | 178 | int perms = 0; |
173 | 179 | ||
@@ -192,13 +198,14 @@ namespace OpenSim.Data.SQLite | |||
192 | 198 | ||
193 | public bool MoveFolder(string id, string newParentFolderID) | 199 | public bool MoveFolder(string id, string newParentFolderID) |
194 | { | 200 | { |
195 | SqliteCommand cmd = new SqliteCommand(); | 201 | using (SqliteCommand cmd = new SqliteCommand()) |
196 | 202 | { | |
197 | cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where folderID = :FolderID", m_Realm); | 203 | cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where folderID = :FolderID", m_Realm); |
198 | cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParentFolderID)); | 204 | cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParentFolderID)); |
199 | cmd.Parameters.Add(new SqliteParameter(":FolderID", id)); | 205 | cmd.Parameters.Add(new SqliteParameter(":FolderID", id)); |
200 | 206 | ||
201 | return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true; | 207 | return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true; |
208 | } | ||
202 | } | 209 | } |
203 | } | 210 | } |
204 | } \ No newline at end of file | 211 | } \ No newline at end of file |