diff options
author | lbsa71 | 2009-04-13 20:04:18 +0000 |
---|---|---|
committer | lbsa71 | 2009-04-13 20:04:18 +0000 |
commit | 29355de6ee01b1f44f32ea45b9c06f636ae9a241 (patch) | |
tree | 677fb0c71117a6feaa5891f5c7ceacdd8d2069a6 /OpenSim/Data/MSSQL/MSSQLAssetData.cs | |
parent | * Remove null reference exception in the J2KDecoderModule's J2K repair routin... (diff) | |
download | opensim-SC_OLD-29355de6ee01b1f44f32ea45b9c06f636ae9a241.zip opensim-SC_OLD-29355de6ee01b1f44f32ea45b9c06f636ae9a241.tar.gz opensim-SC_OLD-29355de6ee01b1f44f32ea45b9c06f636ae9a241.tar.bz2 opensim-SC_OLD-29355de6ee01b1f44f32ea45b9c06f636ae9a241.tar.xz |
* Some more experimental work on distributed assets. Nothing hotwired yet.
* Introduced preprocess step in FetchAsset (Might revert this later)
* Some minor CCC
* Added actual implementation of GetUserProfile( uri ) and the corresponding handler to OGS1.
* Introduced non-functioning GetUserUri( userProfile) awaiting user server wireup (this might move elsewhere)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 54578bc..927b02b 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -43,11 +43,11 @@ namespace OpenSim.Data.MSSQL | |||
43 | private const string _migrationStore = "AssetStore"; | 43 | private const string _migrationStore = "AssetStore"; |
44 | 44 | ||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | private long TicksToEpoch; | 46 | private long m_ticksToEpoch; |
47 | /// <summary> | 47 | /// <summary> |
48 | /// Database manager | 48 | /// Database manager |
49 | /// </summary> | 49 | /// </summary> |
50 | private MSSQLManager database; | 50 | private MSSQLManager m_database; |
51 | 51 | ||
52 | #region IPlugin Members | 52 | #region IPlugin Members |
53 | 53 | ||
@@ -72,11 +72,11 @@ namespace OpenSim.Data.MSSQL | |||
72 | /// <param name="connectionString">connect string</param> | 72 | /// <param name="connectionString">connect string</param> |
73 | override public void Initialise(string connectionString) | 73 | override public void Initialise(string connectionString) |
74 | { | 74 | { |
75 | TicksToEpoch = new System.DateTime(1970, 1, 1).Ticks; | 75 | m_ticksToEpoch = new System.DateTime(1970, 1, 1).Ticks; |
76 | 76 | ||
77 | if (!string.IsNullOrEmpty(connectionString)) | 77 | if (!string.IsNullOrEmpty(connectionString)) |
78 | { | 78 | { |
79 | database = new MSSQLManager(connectionString); | 79 | m_database = new MSSQLManager(connectionString); |
80 | } | 80 | } |
81 | else | 81 | else |
82 | { | 82 | { |
@@ -88,13 +88,13 @@ namespace OpenSim.Data.MSSQL | |||
88 | string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id"); | 88 | string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id"); |
89 | string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password"); | 89 | string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password"); |
90 | 90 | ||
91 | database = | 91 | m_database = |
92 | new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, | 92 | new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, |
93 | settingPassword); | 93 | settingPassword); |
94 | } | 94 | } |
95 | 95 | ||
96 | //New migration to check for DB changes | 96 | //New migration to check for DB changes |
97 | database.CheckMigration(_migrationStore); | 97 | m_database.CheckMigration(_migrationStore); |
98 | } | 98 | } |
99 | 99 | ||
100 | /// <summary> | 100 | /// <summary> |
@@ -102,7 +102,7 @@ namespace OpenSim.Data.MSSQL | |||
102 | /// </summary> | 102 | /// </summary> |
103 | override public string Version | 103 | override public string Version |
104 | { | 104 | { |
105 | get { return database.getVersion(); } | 105 | get { return m_database.getVersion(); } |
106 | } | 106 | } |
107 | 107 | ||
108 | /// <summary> | 108 | /// <summary> |
@@ -118,15 +118,15 @@ namespace OpenSim.Data.MSSQL | |||
118 | #region IAssetDataPlugin Members | 118 | #region IAssetDataPlugin Members |
119 | 119 | ||
120 | /// <summary> | 120 | /// <summary> |
121 | /// Fetch Asset from database | 121 | /// Fetch Asset from m_database |
122 | /// </summary> | 122 | /// </summary> |
123 | /// <param name="assetID">the asset UUID</param> | 123 | /// <param name="assetID">the asset UUID</param> |
124 | /// <returns></returns> | 124 | /// <returns></returns> |
125 | override public AssetBase FetchAsset(UUID assetID) | 125 | override protected AssetBase FetchStoredAsset(UUID assetID) |
126 | { | 126 | { |
127 | using (AutoClosingSqlCommand command = database.Query("SELECT * FROM assets WHERE id = @id")) | 127 | using (AutoClosingSqlCommand command = m_database.Query("SELECT * FROM assets WHERE id = @id")) |
128 | { | 128 | { |
129 | command.Parameters.Add(database.CreateParameter("id", assetID)); | 129 | command.Parameters.Add(m_database.CreateParameter("id", assetID)); |
130 | using (IDataReader reader = command.ExecuteReader()) | 130 | using (IDataReader reader = command.ExecuteReader()) |
131 | { | 131 | { |
132 | if (reader.Read()) | 132 | if (reader.Read()) |
@@ -148,7 +148,7 @@ namespace OpenSim.Data.MSSQL | |||
148 | } | 148 | } |
149 | 149 | ||
150 | /// <summary> | 150 | /// <summary> |
151 | /// Create asset in database | 151 | /// Create asset in m_database |
152 | /// </summary> | 152 | /// </summary> |
153 | /// <param name="asset">the asset</param> | 153 | /// <param name="asset">the asset</param> |
154 | override public void CreateAsset(AssetBase asset) | 154 | override public void CreateAsset(AssetBase asset) |
@@ -158,33 +158,33 @@ namespace OpenSim.Data.MSSQL | |||
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | 160 | ||
161 | using (AutoClosingSqlCommand command = database.Query( | 161 | using (AutoClosingSqlCommand command = m_database.Query( |
162 | "INSERT INTO assets ([id], [name], [description], [assetType], [local], [temporary], [create_time], [access_time], [data])" + | 162 | "INSERT INTO assets ([id], [name], [description], [assetType], [local], [temporary], [create_time], [access_time], [data])" + |
163 | " VALUES " + | 163 | " VALUES " + |
164 | "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)")) | 164 | "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)")) |
165 | { | 165 | { |
166 | int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); | 166 | int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000); |
167 | command.Parameters.Add(database.CreateParameter("id", asset.FullID)); | 167 | command.Parameters.Add(m_database.CreateParameter("id", asset.FullID)); |
168 | command.Parameters.Add(database.CreateParameter("name", asset.Name)); | 168 | command.Parameters.Add(m_database.CreateParameter("name", asset.Name)); |
169 | command.Parameters.Add(database.CreateParameter("description", asset.Description)); | 169 | command.Parameters.Add(m_database.CreateParameter("description", asset.Description)); |
170 | command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); | 170 | command.Parameters.Add(m_database.CreateParameter("assetType", asset.Type)); |
171 | command.Parameters.Add(database.CreateParameter("local", asset.Local)); | 171 | command.Parameters.Add(m_database.CreateParameter("local", asset.Local)); |
172 | command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); | 172 | command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary)); |
173 | command.Parameters.Add(database.CreateParameter("access_time", now)); | 173 | command.Parameters.Add(m_database.CreateParameter("access_time", now)); |
174 | command.Parameters.Add(database.CreateParameter("create_time", now)); | 174 | command.Parameters.Add(m_database.CreateParameter("create_time", now)); |
175 | command.Parameters.Add(database.CreateParameter("data", asset.Data)); | 175 | command.Parameters.Add(m_database.CreateParameter("data", asset.Data)); |
176 | 176 | ||
177 | command.ExecuteNonQuery(); | 177 | command.ExecuteNonQuery(); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | 180 | ||
181 | /// <summary> | 181 | /// <summary> |
182 | /// Update asset in database | 182 | /// Update asset in m_database |
183 | /// </summary> | 183 | /// </summary> |
184 | /// <param name="asset">the asset</param> | 184 | /// <param name="asset">the asset</param> |
185 | override public void UpdateAsset(AssetBase asset) | 185 | override public void UpdateAsset(AssetBase asset) |
186 | { | 186 | { |
187 | using (AutoClosingSqlCommand command = database.Query("UPDATE assets set id = @id, " + | 187 | using (AutoClosingSqlCommand command = m_database.Query("UPDATE assets set id = @id, " + |
188 | "name = @name, " + | 188 | "name = @name, " + |
189 | "description = @description," + | 189 | "description = @description," + |
190 | "assetType = @assetType," + | 190 | "assetType = @assetType," + |
@@ -193,14 +193,14 @@ namespace OpenSim.Data.MSSQL | |||
193 | "data = @data where " + | 193 | "data = @data where " + |
194 | "id = @keyId;")) | 194 | "id = @keyId;")) |
195 | { | 195 | { |
196 | command.Parameters.Add(database.CreateParameter("id", asset.FullID)); | 196 | command.Parameters.Add(m_database.CreateParameter("id", asset.FullID)); |
197 | command.Parameters.Add(database.CreateParameter("name", asset.Name)); | 197 | command.Parameters.Add(m_database.CreateParameter("name", asset.Name)); |
198 | command.Parameters.Add(database.CreateParameter("description", asset.Description)); | 198 | command.Parameters.Add(m_database.CreateParameter("description", asset.Description)); |
199 | command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); | 199 | command.Parameters.Add(m_database.CreateParameter("assetType", asset.Type)); |
200 | command.Parameters.Add(database.CreateParameter("local", asset.Local)); | 200 | command.Parameters.Add(m_database.CreateParameter("local", asset.Local)); |
201 | command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); | 201 | command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary)); |
202 | command.Parameters.Add(database.CreateParameter("data", asset.Data)); | 202 | command.Parameters.Add(m_database.CreateParameter("data", asset.Data)); |
203 | command.Parameters.Add(database.CreateParameter("@keyId", asset.FullID)); | 203 | command.Parameters.Add(m_database.CreateParameter("@keyId", asset.FullID)); |
204 | 204 | ||
205 | try | 205 | try |
206 | { | 206 | { |
@@ -216,9 +216,9 @@ namespace OpenSim.Data.MSSQL | |||
216 | // Commented out since currently unused - this probably should be called in FetchAsset() | 216 | // Commented out since currently unused - this probably should be called in FetchAsset() |
217 | // private void UpdateAccessTime(AssetBase asset) | 217 | // private void UpdateAccessTime(AssetBase asset) |
218 | // { | 218 | // { |
219 | // using (AutoClosingSqlCommand cmd = database.Query("UPDATE assets SET access_time = @access_time WHERE id=@id")) | 219 | // using (AutoClosingSqlCommand cmd = m_database.Query("UPDATE assets SET access_time = @access_time WHERE id=@id")) |
220 | // { | 220 | // { |
221 | // int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); | 221 | // int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000); |
222 | // cmd.Parameters.AddWithValue("@id", asset.FullID.ToString()); | 222 | // cmd.Parameters.AddWithValue("@id", asset.FullID.ToString()); |
223 | // cmd.Parameters.AddWithValue("@access_time", now); | 223 | // cmd.Parameters.AddWithValue("@access_time", now); |
224 | // try | 224 | // try |
@@ -233,7 +233,7 @@ namespace OpenSim.Data.MSSQL | |||
233 | // } | 233 | // } |
234 | 234 | ||
235 | /// <summary> | 235 | /// <summary> |
236 | /// Check if asset exist in database | 236 | /// Check if asset exist in m_database |
237 | /// </summary> | 237 | /// </summary> |
238 | /// <param name="uuid"></param> | 238 | /// <param name="uuid"></param> |
239 | /// <returns>true if exist.</returns> | 239 | /// <returns>true if exist.</returns> |
@@ -258,10 +258,10 @@ namespace OpenSim.Data.MSSQL | |||
258 | { | 258 | { |
259 | List<AssetMetadata> retList = new List<AssetMetadata>(count); | 259 | List<AssetMetadata> retList = new List<AssetMetadata>(count); |
260 | 260 | ||
261 | using (AutoClosingSqlCommand command = database.Query("SELECT (name,description,assetType,temporary,id), Row = ROW_NUMBER() OVER (ORDER BY (some column to order by)) WHERE Row >= @Start AND Row < @Start + @Count")) | 261 | using (AutoClosingSqlCommand command = m_database.Query("SELECT (name,description,assetType,temporary,id), Row = ROW_NUMBER() OVER (ORDER BY (some column to order by)) WHERE Row >= @Start AND Row < @Start + @Count")) |
262 | { | 262 | { |
263 | command.Parameters.Add(database.CreateParameter("start", start)); | 263 | command.Parameters.Add(m_database.CreateParameter("start", start)); |
264 | command.Parameters.Add(database.CreateParameter("count", count)); | 264 | command.Parameters.Add(m_database.CreateParameter("count", count)); |
265 | 265 | ||
266 | using (IDataReader reader = command.ExecuteReader()) | 266 | using (IDataReader reader = command.ExecuteReader()) |
267 | { | 267 | { |