diff options
author | lbsa71 | 2007-12-27 21:41:48 +0000 |
---|---|---|
committer | lbsa71 | 2007-12-27 21:41:48 +0000 |
commit | efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch) | |
tree | bf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Region/Storage | |
parent | * removed always true if (diff) | |
download | opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2 opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz |
* Optimized usings
* shortened references
* Removed redundant 'this'
* Normalized EOF
Diffstat (limited to 'OpenSim/Region/Storage')
3 files changed, 326 insertions, 294 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs index 60aeb83..5818583 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs | |||
@@ -33,8 +33,8 @@ using System.Data.SqlClient; | |||
33 | using System.IO; | 33 | using System.IO; |
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Data; | ||
37 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Data; | ||
38 | using OpenSim.Region.Environment.Interfaces; | 38 | using OpenSim.Region.Environment.Interfaces; |
39 | using OpenSim.Region.Environment.LandManagement; | 39 | using OpenSim.Region.Environment.LandManagement; |
40 | using OpenSim.Region.Environment.Scenes; | 40 | using OpenSim.Region.Environment.Scenes; |
@@ -62,7 +62,9 @@ namespace OpenSim.DataStore.MSSQL | |||
62 | string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); | 62 | string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); |
63 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | 63 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); |
64 | 64 | ||
65 | string connectionString = "Data Source=" + settingDataSource + ";Initial Catalog=" + settingInitialCatalog + ";Persist Security Info=" + settingPersistSecurityInfo + ";User ID=" + settingUserId + ";Password=" + settingPassword + ";"; | 65 | string connectionString = "Data Source=" + settingDataSource + ";Initial Catalog=" + settingInitialCatalog + |
66 | ";Persist Security Info=" + settingPersistSecurityInfo + ";User ID=" + | ||
67 | settingUserId + ";Password=" + settingPassword + ";"; | ||
66 | 68 | ||
67 | ds = new DataSet(); | 69 | ds = new DataSet(); |
68 | 70 | ||
@@ -85,11 +87,12 @@ namespace OpenSim.DataStore.MSSQL | |||
85 | // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema"); | 87 | // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema"); |
86 | TestTables(conn); | 88 | TestTables(conn); |
87 | 89 | ||
88 | lock(ds) { | 90 | lock (ds) |
91 | { | ||
89 | ds.Tables.Add(createPrimTable()); | 92 | ds.Tables.Add(createPrimTable()); |
90 | setupPrimCommands(primDa, conn); | 93 | setupPrimCommands(primDa, conn); |
91 | primDa.Fill(ds.Tables["prims"]); | 94 | primDa.Fill(ds.Tables["prims"]); |
92 | 95 | ||
93 | ds.Tables.Add(createShapeTable()); | 96 | ds.Tables.Add(createShapeTable()); |
94 | setupShapeCommands(shapeDa, conn); | 97 | setupShapeCommands(shapeDa, conn); |
95 | 98 | ||
@@ -122,7 +125,8 @@ namespace OpenSim.DataStore.MSSQL | |||
122 | 125 | ||
123 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) | 126 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) |
124 | { | 127 | { |
125 | lock (ds) { | 128 | lock (ds) |
129 | { | ||
126 | foreach (SceneObjectPart prim in obj.Children.Values) | 130 | foreach (SceneObjectPart prim in obj.Children.Values) |
127 | { | 131 | { |
128 | MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); | 132 | MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); |
@@ -140,11 +144,12 @@ namespace OpenSim.DataStore.MSSQL | |||
140 | DataTable shapes = ds.Tables["primshapes"]; | 144 | DataTable shapes = ds.Tables["primshapes"]; |
141 | 145 | ||
142 | string selectExp = "SceneGroupID = '" + obj.ToString() + "'"; | 146 | string selectExp = "SceneGroupID = '" + obj.ToString() + "'"; |
143 | lock (ds) { | 147 | lock (ds) |
148 | { | ||
144 | DataRow[] primRows = prims.Select(selectExp); | 149 | DataRow[] primRows = prims.Select(selectExp); |
145 | foreach (DataRow row in primRows) | 150 | foreach (DataRow row in primRows) |
146 | { | 151 | { |
147 | LLUUID uuid = new LLUUID((string)row["UUID"]); | 152 | LLUUID uuid = new LLUUID((string) row["UUID"]); |
148 | DataRow shapeRow = shapes.Rows.Find(uuid); | 153 | DataRow shapeRow = shapes.Rows.Find(uuid); |
149 | if (shapeRow != null) | 154 | if (shapeRow != null) |
150 | { | 155 | { |
@@ -153,7 +158,7 @@ namespace OpenSim.DataStore.MSSQL | |||
153 | row.Delete(); | 158 | row.Delete(); |
154 | } | 159 | } |
155 | } | 160 | } |
156 | 161 | ||
157 | Commit(); | 162 | Commit(); |
158 | } | 163 | } |
159 | 164 | ||
@@ -169,16 +174,18 @@ namespace OpenSim.DataStore.MSSQL | |||
169 | string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; | 174 | string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; |
170 | string orderByParent = "ParentID ASC"; | 175 | string orderByParent = "ParentID ASC"; |
171 | 176 | ||
172 | lock (ds) { | 177 | lock (ds) |
178 | { | ||
173 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); | 179 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); |
174 | MainLog.Instance.Verbose("DATASTORE", "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | 180 | MainLog.Instance.Verbose("DATASTORE", |
175 | 181 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | |
182 | |||
176 | foreach (DataRow primRow in primsForRegion) | 183 | foreach (DataRow primRow in primsForRegion) |
177 | { | 184 | { |
178 | try | 185 | try |
179 | { | 186 | { |
180 | string uuid = (string)primRow["UUID"]; | 187 | string uuid = (string) primRow["UUID"]; |
181 | string objID = (string)primRow["SceneGroupID"]; | 188 | string objID = (string) primRow["SceneGroupID"]; |
182 | if (uuid == objID) //is new SceneObjectGroup ? | 189 | if (uuid == objID) //is new SceneObjectGroup ? |
183 | { | 190 | { |
184 | SceneObjectGroup group = new SceneObjectGroup(); | 191 | SceneObjectGroup group = new SceneObjectGroup(); |
@@ -190,12 +197,13 @@ namespace OpenSim.DataStore.MSSQL | |||
190 | } | 197 | } |
191 | else | 198 | else |
192 | { | 199 | { |
193 | MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); | 200 | MainLog.Instance.Notice( |
201 | "No shape found for prim in storage, so setting default box shape"); | ||
194 | prim.Shape = BoxShape.Default; | 202 | prim.Shape = BoxShape.Default; |
195 | } | 203 | } |
196 | group.AddPart(prim); | 204 | group.AddPart(prim); |
197 | group.RootPart = prim; | 205 | group.RootPart = prim; |
198 | 206 | ||
199 | createdObjects.Add(group.UUID, group); | 207 | createdObjects.Add(group.UUID, group); |
200 | retvals.Add(group); | 208 | retvals.Add(group); |
201 | } | 209 | } |
@@ -209,7 +217,8 @@ namespace OpenSim.DataStore.MSSQL | |||
209 | } | 217 | } |
210 | else | 218 | else |
211 | { | 219 | { |
212 | MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); | 220 | MainLog.Instance.Notice( |
221 | "No shape found for prim in storage, so setting default box shape"); | ||
213 | prim.Shape = BoxShape.Default; | 222 | prim.Shape = BoxShape.Default; |
214 | } | 223 | } |
215 | createdObjects[new LLUUID(objID)].AddPart(prim); | 224 | createdObjects[new LLUUID(objID)].AddPart(prim); |
@@ -249,7 +258,7 @@ namespace OpenSim.DataStore.MSSQL | |||
249 | 258 | ||
250 | public double[,] LoadTerrain(LLUUID regionID) | 259 | public double[,] LoadTerrain(LLUUID regionID) |
251 | { | 260 | { |
252 | double[,] terret = new double[256, 256]; | 261 | double[,] terret = new double[256,256]; |
253 | terret.Initialize(); | 262 | terret.Initialize(); |
254 | 263 | ||
255 | DataTable terrain = ds.Tables["terrain"]; | 264 | DataTable terrain = ds.Tables["terrain"]; |
@@ -264,16 +273,16 @@ namespace OpenSim.DataStore.MSSQL | |||
264 | { | 273 | { |
265 | DataRow row = rows[0]; | 274 | DataRow row = rows[0]; |
266 | 275 | ||
267 | byte[] heightmap = (byte[])row["Heightfield"]; | 276 | byte[] heightmap = (byte[]) row["Heightfield"]; |
268 | for (int x = 0; x < 256; x++) | 277 | for (int x = 0; x < 256; x++) |
269 | { | 278 | { |
270 | for (int y = 0; y < 256; y++) | 279 | for (int y = 0; y < 256; y++) |
271 | { | 280 | { |
272 | terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8); | 281 | terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8); |
273 | } | 282 | } |
274 | } | 283 | } |
275 | 284 | ||
276 | rev = (int)row["Revision"]; | 285 | rev = (int) row["Revision"]; |
277 | } | 286 | } |
278 | else | 287 | else |
279 | { | 288 | { |
@@ -290,22 +299,21 @@ namespace OpenSim.DataStore.MSSQL | |||
290 | 299 | ||
291 | public void RemoveLandObject(LLUUID globalID) | 300 | public void RemoveLandObject(LLUUID globalID) |
292 | { | 301 | { |
293 | |||
294 | } | 302 | } |
295 | 303 | ||
296 | public void StoreLandObject(Land parcel, LLUUID regionUUID) | 304 | public void StoreLandObject(Land parcel, LLUUID regionUUID) |
297 | { | 305 | { |
298 | |||
299 | } | 306 | } |
300 | 307 | ||
301 | public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) | 308 | public List<LandData> LoadLandObjects(LLUUID regionUUID) |
302 | { | 309 | { |
303 | return new List<LandData>(); | 310 | return new List<LandData>(); |
304 | } | 311 | } |
305 | 312 | ||
306 | public void Commit() | 313 | public void Commit() |
307 | { | 314 | { |
308 | lock (ds) { | 315 | lock (ds) |
316 | { | ||
309 | primDa.Update(ds, "prims"); | 317 | primDa.Update(ds, "prims"); |
310 | shapeDa.Update(ds, "primshapes"); | 318 | shapeDa.Update(ds, "primshapes"); |
311 | terrainDa.Update(ds, "terrain"); | 319 | terrainDa.Update(ds, "terrain"); |
@@ -326,7 +334,7 @@ namespace OpenSim.DataStore.MSSQL | |||
326 | * | 334 | * |
327 | **********************************************************************/ | 335 | **********************************************************************/ |
328 | 336 | ||
329 | private void createCol(DataTable dt, string name, System.Type type) | 337 | private void createCol(DataTable dt, string name, Type type) |
330 | { | 338 | { |
331 | DataColumn col = new DataColumn(name, type); | 339 | DataColumn col = new DataColumn(name, type); |
332 | dt.Columns.Add(col); | 340 | dt.Columns.Add(col); |
@@ -336,9 +344,9 @@ namespace OpenSim.DataStore.MSSQL | |||
336 | { | 344 | { |
337 | DataTable terrain = new DataTable("terrain"); | 345 | DataTable terrain = new DataTable("terrain"); |
338 | 346 | ||
339 | createCol(terrain, "RegionUUID", typeof(String)); | 347 | createCol(terrain, "RegionUUID", typeof (String)); |
340 | createCol(terrain, "Revision", typeof(Int32)); | 348 | createCol(terrain, "Revision", typeof (Int32)); |
341 | createCol(terrain, "Heightfield", typeof(Byte[])); | 349 | createCol(terrain, "Heightfield", typeof (Byte[])); |
342 | 350 | ||
343 | return terrain; | 351 | return terrain; |
344 | } | 352 | } |
@@ -347,62 +355,62 @@ namespace OpenSim.DataStore.MSSQL | |||
347 | { | 355 | { |
348 | DataTable prims = new DataTable("prims"); | 356 | DataTable prims = new DataTable("prims"); |
349 | 357 | ||
350 | createCol(prims, "UUID", typeof(System.String)); | 358 | createCol(prims, "UUID", typeof (String)); |
351 | createCol(prims, "RegionUUID", typeof(System.String)); | 359 | createCol(prims, "RegionUUID", typeof (String)); |
352 | createCol(prims, "ParentID", typeof(System.Int32)); | 360 | createCol(prims, "ParentID", typeof (Int32)); |
353 | createCol(prims, "CreationDate", typeof(System.Int32)); | 361 | createCol(prims, "CreationDate", typeof (Int32)); |
354 | createCol(prims, "Name", typeof(System.String)); | 362 | createCol(prims, "Name", typeof (String)); |
355 | createCol(prims, "SceneGroupID", typeof(System.String)); | 363 | createCol(prims, "SceneGroupID", typeof (String)); |
356 | // various text fields | 364 | // various text fields |
357 | createCol(prims, "Text", typeof(System.String)); | 365 | createCol(prims, "Text", typeof (String)); |
358 | createCol(prims, "Description", typeof(System.String)); | 366 | createCol(prims, "Description", typeof (String)); |
359 | createCol(prims, "SitName", typeof(System.String)); | 367 | createCol(prims, "SitName", typeof (String)); |
360 | createCol(prims, "TouchName", typeof(System.String)); | 368 | createCol(prims, "TouchName", typeof (String)); |
361 | // permissions | 369 | // permissions |
362 | createCol(prims, "ObjectFlags", typeof(System.Int32)); | 370 | createCol(prims, "ObjectFlags", typeof (Int32)); |
363 | createCol(prims, "CreatorID", typeof(System.String)); | 371 | createCol(prims, "CreatorID", typeof (String)); |
364 | createCol(prims, "OwnerID", typeof(System.String)); | 372 | createCol(prims, "OwnerID", typeof (String)); |
365 | createCol(prims, "GroupID", typeof(System.String)); | 373 | createCol(prims, "GroupID", typeof (String)); |
366 | createCol(prims, "LastOwnerID", typeof(System.String)); | 374 | createCol(prims, "LastOwnerID", typeof (String)); |
367 | createCol(prims, "OwnerMask", typeof(System.Int32)); | 375 | createCol(prims, "OwnerMask", typeof (Int32)); |
368 | createCol(prims, "NextOwnerMask", typeof(System.Int32)); | 376 | createCol(prims, "NextOwnerMask", typeof (Int32)); |
369 | createCol(prims, "GroupMask", typeof(System.Int32)); | 377 | createCol(prims, "GroupMask", typeof (Int32)); |
370 | createCol(prims, "EveryoneMask", typeof(System.Int32)); | 378 | createCol(prims, "EveryoneMask", typeof (Int32)); |
371 | createCol(prims, "BaseMask", typeof(System.Int32)); | 379 | createCol(prims, "BaseMask", typeof (Int32)); |
372 | // vectors | 380 | // vectors |
373 | createCol(prims, "PositionX", typeof(System.Double)); | 381 | createCol(prims, "PositionX", typeof (Double)); |
374 | createCol(prims, "PositionY", typeof(System.Double)); | 382 | createCol(prims, "PositionY", typeof (Double)); |
375 | createCol(prims, "PositionZ", typeof(System.Double)); | 383 | createCol(prims, "PositionZ", typeof (Double)); |
376 | createCol(prims, "GroupPositionX", typeof(System.Double)); | 384 | createCol(prims, "GroupPositionX", typeof (Double)); |
377 | createCol(prims, "GroupPositionY", typeof(System.Double)); | 385 | createCol(prims, "GroupPositionY", typeof (Double)); |
378 | createCol(prims, "GroupPositionZ", typeof(System.Double)); | 386 | createCol(prims, "GroupPositionZ", typeof (Double)); |
379 | createCol(prims, "VelocityX", typeof(System.Double)); | 387 | createCol(prims, "VelocityX", typeof (Double)); |
380 | createCol(prims, "VelocityY", typeof(System.Double)); | 388 | createCol(prims, "VelocityY", typeof (Double)); |
381 | createCol(prims, "VelocityZ", typeof(System.Double)); | 389 | createCol(prims, "VelocityZ", typeof (Double)); |
382 | createCol(prims, "AngularVelocityX", typeof(System.Double)); | 390 | createCol(prims, "AngularVelocityX", typeof (Double)); |
383 | createCol(prims, "AngularVelocityY", typeof(System.Double)); | 391 | createCol(prims, "AngularVelocityY", typeof (Double)); |
384 | createCol(prims, "AngularVelocityZ", typeof(System.Double)); | 392 | createCol(prims, "AngularVelocityZ", typeof (Double)); |
385 | createCol(prims, "AccelerationX", typeof(System.Double)); | 393 | createCol(prims, "AccelerationX", typeof (Double)); |
386 | createCol(prims, "AccelerationY", typeof(System.Double)); | 394 | createCol(prims, "AccelerationY", typeof (Double)); |
387 | createCol(prims, "AccelerationZ", typeof(System.Double)); | 395 | createCol(prims, "AccelerationZ", typeof (Double)); |
388 | // quaternions | 396 | // quaternions |
389 | createCol(prims, "RotationX", typeof(System.Double)); | 397 | createCol(prims, "RotationX", typeof (Double)); |
390 | createCol(prims, "RotationY", typeof(System.Double)); | 398 | createCol(prims, "RotationY", typeof (Double)); |
391 | createCol(prims, "RotationZ", typeof(System.Double)); | 399 | createCol(prims, "RotationZ", typeof (Double)); |
392 | createCol(prims, "RotationW", typeof(System.Double)); | 400 | createCol(prims, "RotationW", typeof (Double)); |
393 | 401 | ||
394 | // sit target | 402 | // sit target |
395 | createCol(prims, "SitTargetOffsetX", typeof(System.Double)); | 403 | createCol(prims, "SitTargetOffsetX", typeof (Double)); |
396 | createCol(prims, "SitTargetOffsetY", typeof(System.Double)); | 404 | createCol(prims, "SitTargetOffsetY", typeof (Double)); |
397 | createCol(prims, "SitTargetOffsetZ", typeof(System.Double)); | 405 | createCol(prims, "SitTargetOffsetZ", typeof (Double)); |
398 | 406 | ||
399 | createCol(prims, "SitTargetOrientW", typeof(System.Double)); | 407 | createCol(prims, "SitTargetOrientW", typeof (Double)); |
400 | createCol(prims, "SitTargetOrientX", typeof(System.Double)); | 408 | createCol(prims, "SitTargetOrientX", typeof (Double)); |
401 | createCol(prims, "SitTargetOrientY", typeof(System.Double)); | 409 | createCol(prims, "SitTargetOrientY", typeof (Double)); |
402 | createCol(prims, "SitTargetOrientZ", typeof(System.Double)); | 410 | createCol(prims, "SitTargetOrientZ", typeof (Double)); |
403 | 411 | ||
404 | // Add in contraints | 412 | // Add in contraints |
405 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; | 413 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; |
406 | 414 | ||
407 | return prims; | 415 | return prims; |
408 | } | 416 | } |
@@ -410,40 +418,40 @@ namespace OpenSim.DataStore.MSSQL | |||
410 | private DataTable createShapeTable() | 418 | private DataTable createShapeTable() |
411 | { | 419 | { |
412 | DataTable shapes = new DataTable("primshapes"); | 420 | DataTable shapes = new DataTable("primshapes"); |
413 | createCol(shapes, "UUID", typeof(System.String)); | 421 | createCol(shapes, "UUID", typeof (String)); |
414 | // shape is an enum | 422 | // shape is an enum |
415 | createCol(shapes, "Shape", typeof(System.Int32)); | 423 | createCol(shapes, "Shape", typeof (Int32)); |
416 | // vectors | 424 | // vectors |
417 | createCol(shapes, "ScaleX", typeof(System.Double)); | 425 | createCol(shapes, "ScaleX", typeof (Double)); |
418 | createCol(shapes, "ScaleY", typeof(System.Double)); | 426 | createCol(shapes, "ScaleY", typeof (Double)); |
419 | createCol(shapes, "ScaleZ", typeof(System.Double)); | 427 | createCol(shapes, "ScaleZ", typeof (Double)); |
420 | // paths | 428 | // paths |
421 | createCol(shapes, "PCode", typeof(System.Int32)); | 429 | createCol(shapes, "PCode", typeof (Int32)); |
422 | createCol(shapes, "PathBegin", typeof(System.Int32)); | 430 | createCol(shapes, "PathBegin", typeof (Int32)); |
423 | createCol(shapes, "PathEnd", typeof(System.Int32)); | 431 | createCol(shapes, "PathEnd", typeof (Int32)); |
424 | createCol(shapes, "PathScaleX", typeof(System.Int32)); | 432 | createCol(shapes, "PathScaleX", typeof (Int32)); |
425 | createCol(shapes, "PathScaleY", typeof(System.Int32)); | 433 | createCol(shapes, "PathScaleY", typeof (Int32)); |
426 | createCol(shapes, "PathShearX", typeof(System.Int32)); | 434 | createCol(shapes, "PathShearX", typeof (Int32)); |
427 | createCol(shapes, "PathShearY", typeof(System.Int32)); | 435 | createCol(shapes, "PathShearY", typeof (Int32)); |
428 | createCol(shapes, "PathSkew", typeof(System.Int32)); | 436 | createCol(shapes, "PathSkew", typeof (Int32)); |
429 | createCol(shapes, "PathCurve", typeof(System.Int32)); | 437 | createCol(shapes, "PathCurve", typeof (Int32)); |
430 | createCol(shapes, "PathRadiusOffset", typeof(System.Int32)); | 438 | createCol(shapes, "PathRadiusOffset", typeof (Int32)); |
431 | createCol(shapes, "PathRevolutions", typeof(System.Int32)); | 439 | createCol(shapes, "PathRevolutions", typeof (Int32)); |
432 | createCol(shapes, "PathTaperX", typeof(System.Int32)); | 440 | createCol(shapes, "PathTaperX", typeof (Int32)); |
433 | createCol(shapes, "PathTaperY", typeof(System.Int32)); | 441 | createCol(shapes, "PathTaperY", typeof (Int32)); |
434 | createCol(shapes, "PathTwist", typeof(System.Int32)); | 442 | createCol(shapes, "PathTwist", typeof (Int32)); |
435 | createCol(shapes, "PathTwistBegin", typeof(System.Int32)); | 443 | createCol(shapes, "PathTwistBegin", typeof (Int32)); |
436 | // profile | 444 | // profile |
437 | createCol(shapes, "ProfileBegin", typeof(System.Int32)); | 445 | createCol(shapes, "ProfileBegin", typeof (Int32)); |
438 | createCol(shapes, "ProfileEnd", typeof(System.Int32)); | 446 | createCol(shapes, "ProfileEnd", typeof (Int32)); |
439 | createCol(shapes, "ProfileCurve", typeof(System.Int32)); | 447 | createCol(shapes, "ProfileCurve", typeof (Int32)); |
440 | createCol(shapes, "ProfileHollow", typeof(System.Int32)); | 448 | createCol(shapes, "ProfileHollow", typeof (Int32)); |
441 | // text TODO: this isn't right, but I'm not sure the right | 449 | // text TODO: this isn't right, but I'm not sure the right |
442 | // way to specify this as a blob atm | 450 | // way to specify this as a blob atm |
443 | createCol(shapes, "Texture", typeof(System.Byte[])); | 451 | createCol(shapes, "Texture", typeof (Byte[])); |
444 | createCol(shapes, "ExtraParams", typeof(System.Byte[])); | 452 | createCol(shapes, "ExtraParams", typeof (Byte[])); |
445 | 453 | ||
446 | shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; | 454 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; |
447 | 455 | ||
448 | return shapes; | 456 | return shapes; |
449 | } | 457 | } |
@@ -462,23 +470,23 @@ namespace OpenSim.DataStore.MSSQL | |||
462 | // interesting has to be done to actually get these values | 470 | // interesting has to be done to actually get these values |
463 | // back out. Not enough time to figure it out yet. | 471 | // back out. Not enough time to figure it out yet. |
464 | SceneObjectPart prim = new SceneObjectPart(); | 472 | SceneObjectPart prim = new SceneObjectPart(); |
465 | prim.UUID = new LLUUID((String)row["UUID"]); | 473 | prim.UUID = new LLUUID((String) row["UUID"]); |
466 | // explicit conversion of integers is required, which sort | 474 | // explicit conversion of integers is required, which sort |
467 | // of sucks. No idea if there is a shortcut here or not. | 475 | // of sucks. No idea if there is a shortcut here or not. |
468 | prim.ParentID = Convert.ToUInt32(row["ParentID"]); | 476 | prim.ParentID = Convert.ToUInt32(row["ParentID"]); |
469 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); | 477 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); |
470 | prim.Name = (String)row["Name"]; | 478 | prim.Name = (String) row["Name"]; |
471 | // various text fields | 479 | // various text fields |
472 | prim.Text = (String)row["Text"]; | 480 | prim.Text = (String) row["Text"]; |
473 | prim.Description = (String)row["Description"]; | 481 | prim.Description = (String) row["Description"]; |
474 | prim.SitName = (String)row["SitName"]; | 482 | prim.SitName = (String) row["SitName"]; |
475 | prim.TouchName = (String)row["TouchName"]; | 483 | prim.TouchName = (String) row["TouchName"]; |
476 | // permissions | 484 | // permissions |
477 | prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); | 485 | prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); |
478 | prim.CreatorID = new LLUUID((String)row["CreatorID"]); | 486 | prim.CreatorID = new LLUUID((String) row["CreatorID"]); |
479 | prim.OwnerID = new LLUUID((String)row["OwnerID"]); | 487 | prim.OwnerID = new LLUUID((String) row["OwnerID"]); |
480 | prim.GroupID = new LLUUID((String)row["GroupID"]); | 488 | prim.GroupID = new LLUUID((String) row["GroupID"]); |
481 | prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); | 489 | prim.LastOwnerID = new LLUUID((String) row["LastOwnerID"]); |
482 | prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); | 490 | prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); |
483 | prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); | 491 | prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); |
484 | prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); | 492 | prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); |
@@ -521,15 +529,19 @@ namespace OpenSim.DataStore.MSSQL | |||
521 | try | 529 | try |
522 | { | 530 | { |
523 | prim.SetSitTargetLL(new LLVector3( | 531 | prim.SetSitTargetLL(new LLVector3( |
524 | Convert.ToSingle(row["SitTargetOffsetX"]), | 532 | Convert.ToSingle(row["SitTargetOffsetX"]), |
525 | Convert.ToSingle(row["SitTargetOffsetY"]), | 533 | Convert.ToSingle(row["SitTargetOffsetY"]), |
526 | Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( | 534 | Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( |
527 | Convert.ToSingle(row["SitTargetOrientX"]), | 535 | Convert.ToSingle( |
528 | Convert.ToSingle(row["SitTargetOrientY"]), | 536 | row["SitTargetOrientX"]), |
529 | Convert.ToSingle(row["SitTargetOrientZ"]), | 537 | Convert.ToSingle( |
530 | Convert.ToSingle(row["SitTargetOrientW"]))); | 538 | row["SitTargetOrientY"]), |
539 | Convert.ToSingle( | ||
540 | row["SitTargetOrientZ"]), | ||
541 | Convert.ToSingle( | ||
542 | row["SitTargetOrientW"]))); | ||
531 | } | 543 | } |
532 | catch (System.InvalidCastException) | 544 | catch (InvalidCastException) |
533 | { | 545 | { |
534 | // Database table was created before we got here and now has null values :P | 546 | // Database table was created before we got here and now has null values :P |
535 | } | 547 | } |
@@ -598,11 +610,10 @@ namespace OpenSim.DataStore.MSSQL | |||
598 | row["SitTargetOrientY"] = sitTargetOrient.Y; | 610 | row["SitTargetOrientY"] = sitTargetOrient.Y; |
599 | row["SitTargetOrientZ"] = sitTargetOrient.Z; | 611 | row["SitTargetOrientZ"] = sitTargetOrient.Z; |
600 | } | 612 | } |
601 | catch (System.Exception) | 613 | catch (Exception) |
602 | { | 614 | { |
603 | // TODO: Add Sit Target Rows! | 615 | // TODO: Add Sit Target Rows! |
604 | } | 616 | } |
605 | |||
606 | } | 617 | } |
607 | 618 | ||
608 | private PrimitiveBaseShape buildShape(DataRow row) | 619 | private PrimitiveBaseShape buildShape(DataRow row) |
@@ -634,14 +645,14 @@ namespace OpenSim.DataStore.MSSQL | |||
634 | s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); | 645 | s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); |
635 | s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); | 646 | s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); |
636 | s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); | 647 | s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); |
637 | 648 | ||
638 | // text TODO: this isn't right] = but I'm not sure the right | 649 | // text TODO: this isn't right] = but I'm not sure the right |
639 | // way to specify this as a blob atm | 650 | // way to specify this as a blob atm |
640 | byte[] textureEntry = (byte[])row["Texture"]; | 651 | byte[] textureEntry = (byte[]) row["Texture"]; |
641 | s.TextureEntry = textureEntry; | 652 | s.TextureEntry = textureEntry; |
642 | |||
643 | 653 | ||
644 | s.ExtraParams = (byte[])row["ExtraParams"]; | 654 | |
655 | s.ExtraParams = (byte[]) row["ExtraParams"]; | ||
645 | // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); | 656 | // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); |
646 | // string texture = encoding.GetString((Byte[])row["Texture"]); | 657 | // string texture = encoding.GetString((Byte[])row["Texture"]); |
647 | // if (!texture.StartsWith("<")) | 658 | // if (!texture.StartsWith("<")) |
@@ -774,7 +785,7 @@ namespace OpenSim.DataStore.MSSQL | |||
774 | sql += ") values (@"; | 785 | sql += ") values (@"; |
775 | sql += String.Join(", @", cols); | 786 | sql += String.Join(", @", cols); |
776 | sql += ")"; | 787 | sql += ")"; |
777 | SqlCommand cmd = new SqlCommand(sql); | 788 | SqlCommand cmd = new SqlCommand(sql); |
778 | // this provides the binding for all our parameters, so | 789 | // this provides the binding for all our parameters, so |
779 | // much less code than it used to be | 790 | // much less code than it used to be |
780 | foreach (DataColumn col in dt.Columns) | 791 | foreach (DataColumn col in dt.Columns) |
@@ -791,14 +802,15 @@ namespace OpenSim.DataStore.MSSQL | |||
791 | foreach (DataColumn col in dt.Columns) | 802 | foreach (DataColumn col in dt.Columns) |
792 | { | 803 | { |
793 | if (subsql.Length > 0) | 804 | if (subsql.Length > 0) |
794 | { // a map function would rock so much here | 805 | { |
806 | // a map function would rock so much here | ||
795 | subsql += ", "; | 807 | subsql += ", "; |
796 | } | 808 | } |
797 | subsql += col.ColumnName + "= @" + col.ColumnName; | 809 | subsql += col.ColumnName + "= @" + col.ColumnName; |
798 | } | 810 | } |
799 | sql += subsql; | 811 | sql += subsql; |
800 | sql += " where " + pk; | 812 | sql += " where " + pk; |
801 | SqlCommand cmd = new SqlCommand(sql); | 813 | SqlCommand cmd = new SqlCommand(sql); |
802 | // this provides the binding for all our parameters, so | 814 | // this provides the binding for all our parameters, so |
803 | // much less code than it used to be | 815 | // much less code than it used to be |
804 | 816 | ||
@@ -817,7 +829,8 @@ namespace OpenSim.DataStore.MSSQL | |||
817 | foreach (DataColumn col in dt.Columns) | 829 | foreach (DataColumn col in dt.Columns) |
818 | { | 830 | { |
819 | if (subsql.Length > 0) | 831 | if (subsql.Length > 0) |
820 | { // a map function would rock so much here | 832 | { |
833 | // a map function would rock so much here | ||
821 | subsql += ",\n"; | 834 | subsql += ",\n"; |
822 | } | 835 | } |
823 | subsql += col.ColumnName + " " + SqlType(col.DataType); | 836 | subsql += col.ColumnName + " " + SqlType(col.DataType); |
@@ -828,7 +841,7 @@ namespace OpenSim.DataStore.MSSQL | |||
828 | } | 841 | } |
829 | sql += subsql; | 842 | sql += subsql; |
830 | sql += ")"; | 843 | sql += ")"; |
831 | 844 | ||
832 | return sql; | 845 | return sql; |
833 | } | 846 | } |
834 | 847 | ||
@@ -837,7 +850,7 @@ namespace OpenSim.DataStore.MSSQL | |||
837 | row["RegionUUID"] = regionUUID; | 850 | row["RegionUUID"] = regionUUID; |
838 | row["Revision"] = rev; | 851 | row["Revision"] = rev; |
839 | 852 | ||
840 | MemoryStream str = new MemoryStream(65536 * sizeof(double)); | 853 | MemoryStream str = new MemoryStream(65536*sizeof (double)); |
841 | BinaryWriter bw = new BinaryWriter(str); | 854 | BinaryWriter bw = new BinaryWriter(str); |
842 | 855 | ||
843 | // TODO: COMPATIBILITY - Add byte-order conversions | 856 | // TODO: COMPATIBILITY - Add byte-order conversions |
@@ -868,7 +881,7 @@ namespace OpenSim.DataStore.MSSQL | |||
868 | /// for us. | 881 | /// for us. |
869 | ///</summary> | 882 | ///</summary> |
870 | ///<returns>a built Sql parameter</returns> | 883 | ///<returns>a built Sql parameter</returns> |
871 | private SqlParameter createSqlParameter(string name, System.Type type) | 884 | private SqlParameter createSqlParameter(string name, Type type) |
872 | { | 885 | { |
873 | SqlParameter param = new SqlParameter(); | 886 | SqlParameter param = new SqlParameter(); |
874 | param.ParameterName = "@" + name; | 887 | param.ParameterName = "@" + name; |
@@ -887,7 +900,7 @@ namespace OpenSim.DataStore.MSSQL | |||
887 | da.UpdateCommand.Connection = conn; | 900 | da.UpdateCommand.Connection = conn; |
888 | 901 | ||
889 | SqlCommand delete = new SqlCommand("delete from prims where UUID = @UUID"); | 902 | SqlCommand delete = new SqlCommand("delete from prims where UUID = @UUID"); |
890 | delete.Parameters.Add(createSqlParameter("UUID", typeof(System.String))); | 903 | delete.Parameters.Add(createSqlParameter("UUID", typeof (String))); |
891 | delete.Connection = conn; | 904 | delete.Connection = conn; |
892 | da.DeleteCommand = delete; | 905 | da.DeleteCommand = delete; |
893 | } | 906 | } |
@@ -901,7 +914,7 @@ namespace OpenSim.DataStore.MSSQL | |||
901 | da.UpdateCommand.Connection = conn; | 914 | da.UpdateCommand.Connection = conn; |
902 | 915 | ||
903 | SqlCommand delete = new SqlCommand("delete from primshapes where UUID = @UUID"); | 916 | SqlCommand delete = new SqlCommand("delete from primshapes where UUID = @UUID"); |
904 | delete.Parameters.Add(createSqlParameter("UUID", typeof(System.String))); | 917 | delete.Parameters.Add(createSqlParameter("UUID", typeof (String))); |
905 | delete.Connection = conn; | 918 | delete.Connection = conn; |
906 | da.DeleteCommand = delete; | 919 | da.DeleteCommand = delete; |
907 | } | 920 | } |
@@ -957,14 +970,13 @@ namespace OpenSim.DataStore.MSSQL | |||
957 | 970 | ||
958 | private bool TestTables(SqlConnection conn) | 971 | private bool TestTables(SqlConnection conn) |
959 | { | 972 | { |
960 | |||
961 | SqlCommand primSelectCmd = new SqlCommand(primSelect, conn); | 973 | SqlCommand primSelectCmd = new SqlCommand(primSelect, conn); |
962 | SqlDataAdapter pDa = new SqlDataAdapter(primSelectCmd); | 974 | SqlDataAdapter pDa = new SqlDataAdapter(primSelectCmd); |
963 | SqlCommand shapeSelectCmd = new SqlCommand(shapeSelect, conn); | 975 | SqlCommand shapeSelectCmd = new SqlCommand(shapeSelect, conn); |
964 | SqlDataAdapter sDa = new SqlDataAdapter(shapeSelectCmd); | 976 | SqlDataAdapter sDa = new SqlDataAdapter(shapeSelectCmd); |
965 | SqlCommand terrainSelectCmd = new SqlCommand(terrainSelect, conn); | 977 | SqlCommand terrainSelectCmd = new SqlCommand(terrainSelect, conn); |
966 | SqlDataAdapter tDa = new SqlDataAdapter(terrainSelectCmd); | 978 | SqlDataAdapter tDa = new SqlDataAdapter(terrainSelectCmd); |
967 | 979 | ||
968 | DataSet tmpDS = new DataSet(); | 980 | DataSet tmpDS = new DataSet(); |
969 | try | 981 | try |
970 | { | 982 | { |
@@ -978,7 +990,7 @@ namespace OpenSim.DataStore.MSSQL | |||
978 | InitDB(conn); | 990 | InitDB(conn); |
979 | } | 991 | } |
980 | 992 | ||
981 | try | 993 | try |
982 | { | 994 | { |
983 | if (tmpDS.Tables == null || tmpDS.Tables.Count == 0) | 995 | if (tmpDS.Tables == null || tmpDS.Tables.Count == 0) |
984 | { | 996 | { |
@@ -986,11 +998,10 @@ namespace OpenSim.DataStore.MSSQL | |||
986 | sDa.Fill(tmpDS, "primshapes"); | 998 | sDa.Fill(tmpDS, "primshapes"); |
987 | tDa.Fill(tmpDS, "terrain"); | 999 | tDa.Fill(tmpDS, "terrain"); |
988 | } | 1000 | } |
989 | |||
990 | } | 1001 | } |
991 | catch (SqlException e) | 1002 | catch (SqlException e) |
992 | { | 1003 | { |
993 | MainLog.Instance.Verbose("DATASTORE", e.ToString()); | 1004 | MainLog.Instance.Verbose("DATASTORE", e.ToString()); |
994 | } | 1005 | } |
995 | 1006 | ||
996 | foreach (DataColumn col in createPrimTable().Columns) | 1007 | foreach (DataColumn col in createPrimTable().Columns) |
@@ -1028,19 +1039,19 @@ namespace OpenSim.DataStore.MSSQL | |||
1028 | 1039 | ||
1029 | private DbType dbtypeFromType(Type type) | 1040 | private DbType dbtypeFromType(Type type) |
1030 | { | 1041 | { |
1031 | if (type == typeof(System.String)) | 1042 | if (type == typeof (String)) |
1032 | { | 1043 | { |
1033 | return DbType.String; | 1044 | return DbType.String; |
1034 | } | 1045 | } |
1035 | else if (type == typeof(System.Int32)) | 1046 | else if (type == typeof (Int32)) |
1036 | { | 1047 | { |
1037 | return DbType.Int32; | 1048 | return DbType.Int32; |
1038 | } | 1049 | } |
1039 | else if (type == typeof(System.Double)) | 1050 | else if (type == typeof (Double)) |
1040 | { | 1051 | { |
1041 | return DbType.Double; | 1052 | return DbType.Double; |
1042 | } | 1053 | } |
1043 | else if (type == typeof(System.Byte[])) | 1054 | else if (type == typeof (Byte[])) |
1044 | { | 1055 | { |
1045 | return DbType.Binary; | 1056 | return DbType.Binary; |
1046 | } | 1057 | } |
@@ -1054,19 +1065,19 @@ namespace OpenSim.DataStore.MSSQL | |||
1054 | // slightly differently. | 1065 | // slightly differently. |
1055 | private string SqlType(Type type) | 1066 | private string SqlType(Type type) |
1056 | { | 1067 | { |
1057 | if (type == typeof(System.String)) | 1068 | if (type == typeof (String)) |
1058 | { | 1069 | { |
1059 | return "varchar(255)"; | 1070 | return "varchar(255)"; |
1060 | } | 1071 | } |
1061 | else if (type == typeof(System.Int32)) | 1072 | else if (type == typeof (Int32)) |
1062 | { | 1073 | { |
1063 | return "integer"; | 1074 | return "integer"; |
1064 | } | 1075 | } |
1065 | else if (type == typeof(System.Double)) | 1076 | else if (type == typeof (Double)) |
1066 | { | 1077 | { |
1067 | return "float"; | 1078 | return "float"; |
1068 | } | 1079 | } |
1069 | else if (type == typeof(System.Byte[])) | 1080 | else if (type == typeof (Byte[])) |
1070 | { | 1081 | { |
1071 | return "image"; | 1082 | return "image"; |
1072 | } | 1083 | } |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index c885310..065d37d 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
59 | private SqliteConnection m_conn; | 59 | private SqliteConnection m_conn; |
60 | 60 | ||
61 | private String m_connectionString; | 61 | private String m_connectionString; |
62 | 62 | ||
63 | private bool persistPrimInventories; | 63 | private bool persistPrimInventories; |
64 | 64 | ||
65 | /*********************************************************************** | 65 | /*********************************************************************** |
@@ -71,7 +71,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
71 | // see IRegionDataStore | 71 | // see IRegionDataStore |
72 | public void Initialise(string connectionString, bool persistPrimInventories) | 72 | public void Initialise(string connectionString, bool persistPrimInventories) |
73 | { | 73 | { |
74 | m_connectionString = connectionString; | 74 | m_connectionString = connectionString; |
75 | this.persistPrimInventories = persistPrimInventories; | 75 | this.persistPrimInventories = persistPrimInventories; |
76 | 76 | ||
77 | ds = new DataSet(); | 77 | ds = new DataSet(); |
@@ -182,20 +182,20 @@ namespace OpenSim.DataStore.MonoSqlite | |||
182 | { | 182 | { |
183 | foreach (SceneObjectPart prim in obj.Children.Values) | 183 | foreach (SceneObjectPart prim in obj.Children.Values) |
184 | { | 184 | { |
185 | if ((prim.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) | 185 | if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) |
186 | { | 186 | { |
187 | MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); | 187 | MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); |
188 | addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); | 188 | addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); |
189 | } | 189 | } |
190 | else if (Stopped(prim)) | 190 | else if (Stopped(prim)) |
191 | { | 191 | { |
192 | MainLog.Instance.Verbose("DATASTORE", "Adding stopped obj: " + obj.UUID + " to region: " + regionUUID); | 192 | MainLog.Instance.Verbose("DATASTORE", |
193 | "Adding stopped obj: " + obj.UUID + " to region: " + regionUUID); | ||
193 | addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); | 194 | addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); |
194 | } | 195 | } |
195 | else | 196 | else |
196 | { | 197 | { |
197 | // MainLog.Instance.Verbose("DATASTORE", "Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); | 198 | // MainLog.Instance.Verbose("DATASTORE", "Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); |
198 | |||
199 | } | 199 | } |
200 | } | 200 | } |
201 | } | 201 | } |
@@ -307,18 +307,19 @@ namespace OpenSim.DataStore.MonoSqlite | |||
307 | 307 | ||
308 | public void StoreTerrain(double[,] ter, LLUUID regionID) | 308 | public void StoreTerrain(double[,] ter, LLUUID regionID) |
309 | { | 309 | { |
310 | lock (ds) { | 310 | lock (ds) |
311 | { | ||
311 | int revision = Util.UnixTimeSinceEpoch(); | 312 | int revision = Util.UnixTimeSinceEpoch(); |
312 | 313 | ||
313 | // the following is an work around for .NET. The perf | 314 | // the following is an work around for .NET. The perf |
314 | // issues associated with it aren't as bad as you think. | 315 | // issues associated with it aren't as bad as you think. |
315 | SqliteConnection conn = new SqliteConnection(m_connectionString); | 316 | SqliteConnection conn = new SqliteConnection(m_connectionString); |
316 | conn.Open(); | 317 | conn.Open(); |
317 | MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); | 318 | MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); |
318 | String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + | 319 | String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + |
319 | " values(:RegionUUID, :Revision, :Heightfield)"; | 320 | " values(:RegionUUID, :Revision, :Heightfield)"; |
320 | 321 | ||
321 | using(SqliteCommand cmd = new SqliteCommand(sql, conn)) | 322 | using (SqliteCommand cmd = new SqliteCommand(sql, conn)) |
322 | { | 323 | { |
323 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); | 324 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); |
324 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); | 325 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); |
@@ -333,7 +334,10 @@ namespace OpenSim.DataStore.MonoSqlite | |||
333 | // revisions in the database, as this old | 334 | // revisions in the database, as this old |
334 | // implementation is a DOS attack waiting to happen. | 335 | // implementation is a DOS attack waiting to happen. |
335 | 336 | ||
336 | using(SqliteCommand cmd = new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision < :Revision", conn)) | 337 | using ( |
338 | SqliteCommand cmd = | ||
339 | new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision < :Revision", | ||
340 | conn)) | ||
337 | { | 341 | { |
338 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); | 342 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); |
339 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); | 343 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); |
@@ -345,21 +349,22 @@ namespace OpenSim.DataStore.MonoSqlite | |||
345 | 349 | ||
346 | public double[,] LoadTerrain(LLUUID regionID) | 350 | public double[,] LoadTerrain(LLUUID regionID) |
347 | { | 351 | { |
348 | lock (ds) { | 352 | lock (ds) |
353 | { | ||
349 | double[,] terret = new double[256,256]; | 354 | double[,] terret = new double[256,256]; |
350 | terret.Initialize(); | 355 | terret.Initialize(); |
351 | // the following is an work around for .NET. The perf | 356 | // the following is an work around for .NET. The perf |
352 | // issues associated with it aren't as bad as you think. | 357 | // issues associated with it aren't as bad as you think. |
353 | SqliteConnection conn = new SqliteConnection(m_connectionString); | 358 | SqliteConnection conn = new SqliteConnection(m_connectionString); |
354 | conn.Open(); | 359 | conn.Open(); |
355 | String sql = "select RegionUUID, Revision, Heightfield from terrain" + | 360 | String sql = "select RegionUUID, Revision, Heightfield from terrain" + |
356 | " where RegionUUID=:RegionUUID order by Revision desc"; | 361 | " where RegionUUID=:RegionUUID order by Revision desc"; |
357 | 362 | ||
358 | 363 | ||
359 | using (SqliteCommand cmd = new SqliteCommand(sql, conn)) | 364 | using (SqliteCommand cmd = new SqliteCommand(sql, conn)) |
360 | { | 365 | { |
361 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); | 366 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); |
362 | 367 | ||
363 | using (IDataReader row = cmd.ExecuteReader()) | 368 | using (IDataReader row = cmd.ExecuteReader()) |
364 | { | 369 | { |
365 | int rev = 0; | 370 | int rev = 0; |
@@ -374,7 +379,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
374 | terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8); | 379 | terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8); |
375 | } | 380 | } |
376 | } | 381 | } |
377 | rev = (int)row["Revision"]; | 382 | rev = (int) row["Revision"]; |
378 | } | 383 | } |
379 | else | 384 | else |
380 | { | 385 | { |
@@ -382,7 +387,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
382 | conn.Close(); | 387 | conn.Close(); |
383 | return null; | 388 | return null; |
384 | } | 389 | } |
385 | 390 | ||
386 | MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); | 391 | MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); |
387 | } | 392 | } |
388 | } | 393 | } |
@@ -434,7 +439,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
434 | fillLandRow(landRow, parcel.landData, regionUUID); | 439 | fillLandRow(landRow, parcel.landData, regionUUID); |
435 | } | 440 | } |
436 | 441 | ||
437 | using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", conn)) | 442 | using ( |
443 | SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", conn)) | ||
438 | { | 444 | { |
439 | cmd.Parameters.Add(new SqliteParameter(":LandUUID", Util.ToRawUuidString(parcel.landData.globalID))); | 445 | cmd.Parameters.Add(new SqliteParameter(":LandUUID", Util.ToRawUuidString(parcel.landData.globalID))); |
440 | cmd.ExecuteNonQuery(); | 446 | cmd.ExecuteNonQuery(); |
@@ -447,16 +453,15 @@ namespace OpenSim.DataStore.MonoSqlite | |||
447 | landaccesslist.Rows.Add(newAccessRow); | 453 | landaccesslist.Rows.Add(newAccessRow); |
448 | } | 454 | } |
449 | conn.Close(); | 455 | conn.Close(); |
450 | |||
451 | } | 456 | } |
452 | 457 | ||
453 | Commit(); | 458 | Commit(); |
454 | } | 459 | } |
455 | 460 | ||
456 | public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) | 461 | public List<LandData> LoadLandObjects(LLUUID regionUUID) |
457 | { | 462 | { |
458 | List<LandData> landDataForRegion = new List<LandData>(); | 463 | List<LandData> landDataForRegion = new List<LandData>(); |
459 | lock(ds) | 464 | lock (ds) |
460 | { | 465 | { |
461 | DataTable land = ds.Tables["land"]; | 466 | DataTable land = ds.Tables["land"]; |
462 | DataTable landaccesslist = ds.Tables["landaccesslist"]; | 467 | DataTable landaccesslist = ds.Tables["landaccesslist"]; |
@@ -570,14 +575,14 @@ namespace OpenSim.DataStore.MonoSqlite | |||
570 | createCol(prims, "RotationW", typeof (Double)); | 575 | createCol(prims, "RotationW", typeof (Double)); |
571 | 576 | ||
572 | // sit target | 577 | // sit target |
573 | createCol(prims, "SitTargetOffsetX", typeof(Double)); | 578 | createCol(prims, "SitTargetOffsetX", typeof (Double)); |
574 | createCol(prims, "SitTargetOffsetY", typeof(Double)); | 579 | createCol(prims, "SitTargetOffsetY", typeof (Double)); |
575 | createCol(prims, "SitTargetOffsetZ", typeof(Double)); | 580 | createCol(prims, "SitTargetOffsetZ", typeof (Double)); |
576 | 581 | ||
577 | createCol(prims, "SitTargetOrientW", typeof(Double)); | 582 | createCol(prims, "SitTargetOrientW", typeof (Double)); |
578 | createCol(prims, "SitTargetOrientX", typeof(Double)); | 583 | createCol(prims, "SitTargetOrientX", typeof (Double)); |
579 | createCol(prims, "SitTargetOrientY", typeof(Double)); | 584 | createCol(prims, "SitTargetOrientY", typeof (Double)); |
580 | createCol(prims, "SitTargetOrientZ", typeof(Double)); | 585 | createCol(prims, "SitTargetOrientZ", typeof (Double)); |
581 | 586 | ||
582 | // Add in contraints | 587 | // Add in contraints |
583 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; | 588 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; |
@@ -621,11 +626,11 @@ namespace OpenSim.DataStore.MonoSqlite | |||
621 | createCol(shapes, "Texture", typeof (Byte[])); | 626 | createCol(shapes, "Texture", typeof (Byte[])); |
622 | createCol(shapes, "ExtraParams", typeof (Byte[])); | 627 | createCol(shapes, "ExtraParams", typeof (Byte[])); |
623 | 628 | ||
624 | shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; | 629 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; |
625 | 630 | ||
626 | return shapes; | 631 | return shapes; |
627 | } | 632 | } |
628 | 633 | ||
629 | private DataTable createItemsTable() | 634 | private DataTable createItemsTable() |
630 | { | 635 | { |
631 | DataTable items = new DataTable("primitems"); | 636 | DataTable items = new DataTable("primitems"); |
@@ -635,10 +640,10 @@ namespace OpenSim.DataStore.MonoSqlite | |||
635 | createCol(items, "assetID", typeof (String)); | 640 | createCol(items, "assetID", typeof (String)); |
636 | createCol(items, "assetType", typeof (Int32)); | 641 | createCol(items, "assetType", typeof (Int32)); |
637 | createCol(items, "parentFolderID", typeof (String)); | 642 | createCol(items, "parentFolderID", typeof (String)); |
638 | 643 | ||
639 | createCol(items, "name", typeof (String)); | 644 | createCol(items, "name", typeof (String)); |
640 | createCol(items, "description", typeof (String)); | 645 | createCol(items, "description", typeof (String)); |
641 | 646 | ||
642 | createCol(items, "creationDate", typeof (Int64)); | 647 | createCol(items, "creationDate", typeof (Int64)); |
643 | createCol(items, "creatorID", typeof (String)); | 648 | createCol(items, "creatorID", typeof (String)); |
644 | createCol(items, "ownerID", typeof (String)); | 649 | createCol(items, "ownerID", typeof (String)); |
@@ -651,50 +656,50 @@ namespace OpenSim.DataStore.MonoSqlite | |||
651 | createCol(items, "everyonePermissions", typeof (Int32)); | 656 | createCol(items, "everyonePermissions", typeof (Int32)); |
652 | createCol(items, "groupPermissions", typeof (Int32)); | 657 | createCol(items, "groupPermissions", typeof (Int32)); |
653 | 658 | ||
654 | items.PrimaryKey = new DataColumn[] { items.Columns["UUID"] }; | 659 | items.PrimaryKey = new DataColumn[] {items.Columns["UUID"]}; |
655 | 660 | ||
656 | return items; | 661 | return items; |
657 | } | 662 | } |
658 | 663 | ||
659 | private DataTable createLandTable() | 664 | private DataTable createLandTable() |
660 | { | 665 | { |
661 | DataTable land = new DataTable("land"); | 666 | DataTable land = new DataTable("land"); |
662 | createCol(land, "UUID", typeof(String)); | 667 | createCol(land, "UUID", typeof (String)); |
663 | createCol(land, "RegionUUID", typeof(String)); | 668 | createCol(land, "RegionUUID", typeof (String)); |
664 | createCol(land, "LocalLandID", typeof(UInt32)); | 669 | createCol(land, "LocalLandID", typeof (UInt32)); |
665 | 670 | ||
666 | // Bitmap is a byte[512] | 671 | // Bitmap is a byte[512] |
667 | createCol(land, "Bitmap", typeof(Byte[])); | 672 | createCol(land, "Bitmap", typeof (Byte[])); |
668 | 673 | ||
669 | createCol(land, "Name", typeof(String)); | 674 | createCol(land, "Name", typeof (String)); |
670 | createCol(land, "Desc", typeof(String)); | 675 | createCol(land, "Desc", typeof (String)); |
671 | createCol(land, "OwnerUUID", typeof(String)); | 676 | createCol(land, "OwnerUUID", typeof (String)); |
672 | createCol(land, "IsGroupOwned", typeof(Boolean)); | 677 | createCol(land, "IsGroupOwned", typeof (Boolean)); |
673 | createCol(land, "Area", typeof(Int32)); | 678 | createCol(land, "Area", typeof (Int32)); |
674 | createCol(land, "AuctionID", typeof(Int32)); //Unemplemented | 679 | createCol(land, "AuctionID", typeof (Int32)); //Unemplemented |
675 | createCol(land, "Category", typeof(Int32)); //Enum libsecondlife.Parcel.ParcelCategory | 680 | createCol(land, "Category", typeof (Int32)); //Enum libsecondlife.Parcel.ParcelCategory |
676 | createCol(land, "ClaimDate", typeof(Int32)); | 681 | createCol(land, "ClaimDate", typeof (Int32)); |
677 | createCol(land, "ClaimPrice", typeof(Int32)); | 682 | createCol(land, "ClaimPrice", typeof (Int32)); |
678 | createCol(land, "GroupUUID", typeof(string)); | 683 | createCol(land, "GroupUUID", typeof (string)); |
679 | createCol(land, "SalePrice", typeof(Int32)); | 684 | createCol(land, "SalePrice", typeof (Int32)); |
680 | createCol(land, "LandStatus", typeof(Int32)); //Enum. libsecondlife.Parcel.ParcelStatus | 685 | createCol(land, "LandStatus", typeof (Int32)); //Enum. libsecondlife.Parcel.ParcelStatus |
681 | createCol(land, "LandFlags", typeof(UInt32)); | 686 | createCol(land, "LandFlags", typeof (UInt32)); |
682 | createCol(land, "LandingType", typeof(Byte)); | 687 | createCol(land, "LandingType", typeof (Byte)); |
683 | createCol(land, "MediaAutoScale", typeof(Byte)); | 688 | createCol(land, "MediaAutoScale", typeof (Byte)); |
684 | createCol(land, "MediaTextureUUID", typeof(String)); | 689 | createCol(land, "MediaTextureUUID", typeof (String)); |
685 | createCol(land, "MediaURL", typeof(String)); | 690 | createCol(land, "MediaURL", typeof (String)); |
686 | createCol(land, "MusicURL", typeof(String)); | 691 | createCol(land, "MusicURL", typeof (String)); |
687 | createCol(land, "PassHours", typeof(Double)); | 692 | createCol(land, "PassHours", typeof (Double)); |
688 | createCol(land, "PassPrice", typeof(UInt32)); | 693 | createCol(land, "PassPrice", typeof (UInt32)); |
689 | createCol(land, "SnapshotUUID", typeof(String)); | 694 | createCol(land, "SnapshotUUID", typeof (String)); |
690 | createCol(land, "UserLocationX", typeof(Double)); | 695 | createCol(land, "UserLocationX", typeof (Double)); |
691 | createCol(land, "UserLocationY", typeof(Double)); | 696 | createCol(land, "UserLocationY", typeof (Double)); |
692 | createCol(land, "UserLocationZ", typeof(Double)); | 697 | createCol(land, "UserLocationZ", typeof (Double)); |
693 | createCol(land, "UserLookAtX", typeof(Double)); | 698 | createCol(land, "UserLookAtX", typeof (Double)); |
694 | createCol(land, "UserLookAtY", typeof(Double)); | 699 | createCol(land, "UserLookAtY", typeof (Double)); |
695 | createCol(land, "UserLookAtZ", typeof(Double)); | 700 | createCol(land, "UserLookAtZ", typeof (Double)); |
696 | 701 | ||
697 | land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; | 702 | land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; |
698 | 703 | ||
699 | return land; | 704 | return land; |
700 | } | 705 | } |
@@ -702,9 +707,9 @@ namespace OpenSim.DataStore.MonoSqlite | |||
702 | private DataTable createLandAccessListTable() | 707 | private DataTable createLandAccessListTable() |
703 | { | 708 | { |
704 | DataTable landaccess = new DataTable("landaccesslist"); | 709 | DataTable landaccess = new DataTable("landaccesslist"); |
705 | createCol(landaccess, "LandUUID", typeof(String)); | 710 | createCol(landaccess, "LandUUID", typeof (String)); |
706 | createCol(landaccess, "AccessUUID", typeof(String)); | 711 | createCol(landaccess, "AccessUUID", typeof (String)); |
707 | createCol(landaccess, "Flags", typeof(UInt32)); | 712 | createCol(landaccess, "Flags", typeof (UInt32)); |
708 | 713 | ||
709 | return landaccess; | 714 | return landaccess; |
710 | } | 715 | } |
@@ -782,35 +787,43 @@ namespace OpenSim.DataStore.MonoSqlite | |||
782 | try | 787 | try |
783 | { | 788 | { |
784 | prim.SetSitTargetLL(new LLVector3( | 789 | prim.SetSitTargetLL(new LLVector3( |
785 | Convert.ToSingle(row["SitTargetOffsetX"]), | 790 | Convert.ToSingle(row["SitTargetOffsetX"]), |
786 | Convert.ToSingle(row["SitTargetOffsetY"]), | 791 | Convert.ToSingle(row["SitTargetOffsetY"]), |
787 | Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( | 792 | Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( |
788 | Convert.ToSingle(row["SitTargetOrientX"]), | 793 | Convert.ToSingle( |
789 | Convert.ToSingle(row["SitTargetOrientY"]), | 794 | row["SitTargetOrientX"]), |
790 | Convert.ToSingle(row["SitTargetOrientZ"]), | 795 | Convert.ToSingle( |
791 | Convert.ToSingle(row["SitTargetOrientW"]))); | 796 | row["SitTargetOrientY"]), |
797 | Convert.ToSingle( | ||
798 | row["SitTargetOrientZ"]), | ||
799 | Convert.ToSingle( | ||
800 | row["SitTargetOrientW"]))); | ||
792 | } | 801 | } |
793 | catch (System.InvalidCastException) | 802 | catch (InvalidCastException) |
794 | { | 803 | { |
795 | // Database table was created before we got here and now has null values :P | 804 | // Database table was created before we got here and now has null values :P |
796 | m_conn.Open(); | 805 | m_conn.Open(); |
797 | SqliteCommand cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetX float NOT NULL default 0;", m_conn); | 806 | SqliteCommand cmd = |
807 | new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetX float NOT NULL default 0;", m_conn); | ||
798 | cmd.ExecuteNonQuery(); | 808 | cmd.ExecuteNonQuery(); |
799 | cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetY float NOT NULL default 0;", m_conn); | 809 | cmd = |
810 | new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetY float NOT NULL default 0;", m_conn); | ||
800 | cmd.ExecuteNonQuery(); | 811 | cmd.ExecuteNonQuery(); |
801 | cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetZ float NOT NULL default 0;", m_conn); | 812 | cmd = |
813 | new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetZ float NOT NULL default 0;", m_conn); | ||
802 | cmd.ExecuteNonQuery(); | 814 | cmd.ExecuteNonQuery(); |
803 | cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientW float NOT NULL default 0;", m_conn); | 815 | cmd = |
816 | new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientW float NOT NULL default 0;", m_conn); | ||
804 | cmd.ExecuteNonQuery(); | 817 | cmd.ExecuteNonQuery(); |
805 | cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientX float NOT NULL default 0;", m_conn); | 818 | cmd = |
819 | new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientX float NOT NULL default 0;", m_conn); | ||
806 | cmd.ExecuteNonQuery(); | 820 | cmd.ExecuteNonQuery(); |
807 | cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientY float NOT NULL default 0;", m_conn); | 821 | cmd = |
822 | new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientY float NOT NULL default 0;", m_conn); | ||
808 | cmd.ExecuteNonQuery(); | 823 | cmd.ExecuteNonQuery(); |
809 | cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientZ float NOT NULL default 0;", m_conn); | 824 | cmd = |
825 | new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientZ float NOT NULL default 0;", m_conn); | ||
810 | cmd.ExecuteNonQuery(); | 826 | cmd.ExecuteNonQuery(); |
811 | |||
812 | |||
813 | |||
814 | } | 827 | } |
815 | 828 | ||
816 | return prim; | 829 | return prim; |
@@ -820,36 +833,42 @@ namespace OpenSim.DataStore.MonoSqlite | |||
820 | { | 833 | { |
821 | LandData newData = new LandData(); | 834 | LandData newData = new LandData(); |
822 | 835 | ||
823 | newData.globalID = new LLUUID((String)row["UUID"]); | 836 | newData.globalID = new LLUUID((String) row["UUID"]); |
824 | newData.localID= Convert.ToInt32(row["LocalLandID"]); | 837 | newData.localID = Convert.ToInt32(row["LocalLandID"]); |
825 | 838 | ||
826 | // Bitmap is a byte[512] | 839 | // Bitmap is a byte[512] |
827 | newData.landBitmapByteArray = (Byte[]) row["Bitmap"]; | 840 | newData.landBitmapByteArray = (Byte[]) row["Bitmap"]; |
828 | 841 | ||
829 | newData.landName= (String) row["Name"]; | 842 | newData.landName = (String) row["Name"]; |
830 | newData.landDesc= (String) row["Desc"]; | 843 | newData.landDesc = (String) row["Desc"]; |
831 | newData.ownerID= (String) row["OwnerUUID"]; | 844 | newData.ownerID = (String) row["OwnerUUID"]; |
832 | newData.isGroupOwned= (Boolean) row["IsGroupOwned"]; | 845 | newData.isGroupOwned = (Boolean) row["IsGroupOwned"]; |
833 | newData.area= Convert.ToInt32(row["Area"]); | 846 | newData.area = Convert.ToInt32(row["Area"]); |
834 | newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented | 847 | newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented |
835 | newData.category= (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]); //Enum libsecondlife.Parcel.ParcelCategory | 848 | newData.category = (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]); |
836 | newData.claimDate= Convert.ToInt32(row["ClaimDate"]); | 849 | //Enum libsecondlife.Parcel.ParcelCategory |
837 | newData.claimPrice= Convert.ToInt32(row["ClaimPrice"]); | 850 | newData.claimDate = Convert.ToInt32(row["ClaimDate"]); |
838 | newData.groupID= new LLUUID((String)row["GroupUUID"]); | 851 | newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]); |
852 | newData.groupID = new LLUUID((String) row["GroupUUID"]); | ||
839 | newData.salePrice = Convert.ToInt32(row["SalePrice"]); | 853 | newData.salePrice = Convert.ToInt32(row["SalePrice"]); |
840 | newData.landStatus= (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]); //Enum. libsecondlife.Parcel.ParcelStatus | 854 | newData.landStatus = (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]); |
841 | newData.landFlags= Convert.ToUInt32(row["LandFlags"]); | 855 | //Enum. libsecondlife.Parcel.ParcelStatus |
842 | newData.landingType= (Byte) row["LandingType"]; | 856 | newData.landFlags = Convert.ToUInt32(row["LandFlags"]); |
843 | newData.mediaAutoScale= (Byte) row["MediaAutoScale"]; | 857 | newData.landingType = (Byte) row["LandingType"]; |
844 | newData.mediaID= new LLUUID((String)row["MediaTextureUUID"]); | 858 | newData.mediaAutoScale = (Byte) row["MediaAutoScale"]; |
845 | newData.mediaURL= (String) row["MediaURL"]; | 859 | newData.mediaID = new LLUUID((String) row["MediaTextureUUID"]); |
846 | newData.musicURL= (String) row["MusicURL"]; | 860 | newData.mediaURL = (String) row["MediaURL"]; |
847 | newData.passHours= Convert.ToSingle(row["PassHours"]); | 861 | newData.musicURL = (String) row["MusicURL"]; |
848 | newData.passPrice= Convert.ToInt32(row["PassPrice"]); | 862 | newData.passHours = Convert.ToSingle(row["PassHours"]); |
849 | newData.snapshotID= (String) row["SnapshotUUID"]; | 863 | newData.passPrice = Convert.ToInt32(row["PassPrice"]); |
850 | 864 | newData.snapshotID = (String) row["SnapshotUUID"]; | |
851 | newData.userLocation = new LLVector3(Convert.ToSingle(row["UserLocationX"]),Convert.ToSingle(row["UserLocationY"]), Convert.ToSingle(row["UserLocationZ"])); | 865 | |
852 | newData.userLookAt = new LLVector3(Convert.ToSingle(row["UserLookAtX"]),Convert.ToSingle(row["UserLookAtY"]), Convert.ToSingle(row["UserLookAtZ"])); | 866 | newData.userLocation = |
867 | new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), | ||
868 | Convert.ToSingle(row["UserLocationZ"])); | ||
869 | newData.userLookAt = | ||
870 | new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), | ||
871 | Convert.ToSingle(row["UserLookAtZ"])); | ||
853 | newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); | 872 | newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); |
854 | 873 | ||
855 | return newData; | 874 | return newData; |
@@ -858,13 +877,13 @@ namespace OpenSim.DataStore.MonoSqlite | |||
858 | private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) | 877 | private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) |
859 | { | 878 | { |
860 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 879 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
861 | entry.AgentID = new LLUUID((string)row["AccessUUID"]); | 880 | entry.AgentID = new LLUUID((string) row["AccessUUID"]); |
862 | entry.Flags = (ParcelManager.AccessList)row["Flags"]; | 881 | entry.Flags = (ParcelManager.AccessList) row["Flags"]; |
863 | entry.Time = new DateTime(); | 882 | entry.Time = new DateTime(); |
864 | return entry; | 883 | return entry; |
865 | } | 884 | } |
866 | 885 | ||
867 | private Array serializeTerrain(double[,] val) | 886 | private Array serializeTerrain(double[,] val) |
868 | { | 887 | { |
869 | MemoryStream str = new MemoryStream(65536*sizeof (double)); | 888 | MemoryStream str = new MemoryStream(65536*sizeof (double)); |
870 | BinaryWriter bw = new BinaryWriter(str); | 889 | BinaryWriter bw = new BinaryWriter(str); |
@@ -900,7 +919,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
900 | row["ParentID"] = prim.ParentID; | 919 | row["ParentID"] = prim.ParentID; |
901 | row["CreationDate"] = prim.CreationDate; | 920 | row["CreationDate"] = prim.CreationDate; |
902 | row["Name"] = prim.Name; | 921 | row["Name"] = prim.Name; |
903 | row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); // the UUID of the root part for this SceneObjectGroup | 922 | row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); |
923 | // the UUID of the root part for this SceneObjectGroup | ||
904 | // various text fields | 924 | // various text fields |
905 | row["Text"] = prim.Text; | 925 | row["Text"] = prim.Text; |
906 | row["Description"] = prim.Description; | 926 | row["Description"] = prim.Description; |
@@ -1028,10 +1048,10 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1028 | s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); | 1048 | s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); |
1029 | // text TODO: this isn't right] = but I'm not sure the right | 1049 | // text TODO: this isn't right] = but I'm not sure the right |
1030 | // way to specify this as a blob atm | 1050 | // way to specify this as a blob atm |
1031 | 1051 | ||
1032 | byte[] textureEntry = (byte[])row["Texture"]; | 1052 | byte[] textureEntry = (byte[]) row["Texture"]; |
1033 | s.TextureEntry = textureEntry; | 1053 | s.TextureEntry = textureEntry; |
1034 | 1054 | ||
1035 | 1055 | ||
1036 | s.ExtraParams = (byte[]) row["ExtraParams"]; | 1056 | s.ExtraParams = (byte[]) row["ExtraParams"]; |
1037 | // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); | 1057 | // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); |
@@ -1278,6 +1298,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1278 | da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); | 1298 | da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); |
1279 | da.InsertCommand.Connection = conn; | 1299 | da.InsertCommand.Connection = conn; |
1280 | } | 1300 | } |
1301 | |||
1281 | private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) | 1302 | private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) |
1282 | { | 1303 | { |
1283 | da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); | 1304 | da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); |
@@ -1331,7 +1352,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1331 | { | 1352 | { |
1332 | MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists"); | 1353 | MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists"); |
1333 | } | 1354 | } |
1334 | 1355 | ||
1335 | if (persistPrimInventories) | 1356 | if (persistPrimInventories) |
1336 | { | 1357 | { |
1337 | try | 1358 | try |
@@ -1341,7 +1362,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1341 | catch (SqliteSyntaxException) | 1362 | catch (SqliteSyntaxException) |
1342 | { | 1363 | { |
1343 | MainLog.Instance.Warn("SQLITE", "Primitives Inventory Table Already Exists"); | 1364 | MainLog.Instance.Warn("SQLITE", "Primitives Inventory Table Already Exists"); |
1344 | } | 1365 | } |
1345 | } | 1366 | } |
1346 | 1367 | ||
1347 | try | 1368 | try |
@@ -1377,32 +1398,31 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1377 | { | 1398 | { |
1378 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); | 1399 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); |
1379 | SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd); | 1400 | SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd); |
1380 | 1401 | ||
1381 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); | 1402 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); |
1382 | SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd); | 1403 | SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd); |
1383 | 1404 | ||
1384 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, conn); | 1405 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, conn); |
1385 | SqliteDataAdapter iDa = new SqliteDataAdapter(itemsSelectCmd); | 1406 | SqliteDataAdapter iDa = new SqliteDataAdapter(itemsSelectCmd); |
1386 | 1407 | ||
1387 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn); | 1408 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn); |
1388 | SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd); | 1409 | SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd); |
1389 | 1410 | ||
1390 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn); | 1411 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn); |
1391 | SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd); | 1412 | SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd); |
1392 | 1413 | ||
1393 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn); | 1414 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn); |
1394 | SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd); | 1415 | SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd); |
1395 | 1416 | ||
1396 | DataSet tmpDS = new DataSet(); | 1417 | DataSet tmpDS = new DataSet(); |
1397 | try | 1418 | try |
1398 | { | 1419 | { |
1399 | |||
1400 | pDa.Fill(tmpDS, "prims"); | 1420 | pDa.Fill(tmpDS, "prims"); |
1401 | sDa.Fill(tmpDS, "primshapes"); | 1421 | sDa.Fill(tmpDS, "primshapes"); |
1402 | 1422 | ||
1403 | if (persistPrimInventories) | 1423 | if (persistPrimInventories) |
1404 | iDa.Fill(tmpDS, "primitems"); | 1424 | iDa.Fill(tmpDS, "primitems"); |
1405 | 1425 | ||
1406 | tDa.Fill(tmpDS, "terrain"); | 1426 | tDa.Fill(tmpDS, "terrain"); |
1407 | lDa.Fill(tmpDS, "land"); | 1427 | lDa.Fill(tmpDS, "land"); |
1408 | lalDa.Fill(tmpDS, "landaccesslist"); | 1428 | lalDa.Fill(tmpDS, "landaccesslist"); |
@@ -1415,13 +1435,13 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1415 | 1435 | ||
1416 | pDa.Fill(tmpDS, "prims"); | 1436 | pDa.Fill(tmpDS, "prims"); |
1417 | sDa.Fill(tmpDS, "primshapes"); | 1437 | sDa.Fill(tmpDS, "primshapes"); |
1418 | 1438 | ||
1419 | if (persistPrimInventories) | 1439 | if (persistPrimInventories) |
1420 | iDa.Fill(tmpDS, "primitems"); | 1440 | iDa.Fill(tmpDS, "primitems"); |
1421 | 1441 | ||
1422 | tDa.Fill(tmpDS, "terrain"); | 1442 | tDa.Fill(tmpDS, "terrain"); |
1423 | lDa.Fill(tmpDS, "land"); | 1443 | lDa.Fill(tmpDS, "land"); |
1424 | lalDa.Fill(tmpDS,"landaccesslist"); | 1444 | lalDa.Fill(tmpDS, "landaccesslist"); |
1425 | 1445 | ||
1426 | foreach (DataColumn col in createPrimTable().Columns) | 1446 | foreach (DataColumn col in createPrimTable().Columns) |
1427 | { | 1447 | { |
@@ -1431,7 +1451,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1431 | return false; | 1451 | return false; |
1432 | } | 1452 | } |
1433 | } | 1453 | } |
1434 | 1454 | ||
1435 | foreach (DataColumn col in createShapeTable().Columns) | 1455 | foreach (DataColumn col in createShapeTable().Columns) |
1436 | { | 1456 | { |
1437 | if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) | 1457 | if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) |
@@ -1440,9 +1460,9 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1440 | return false; | 1460 | return false; |
1441 | } | 1461 | } |
1442 | } | 1462 | } |
1443 | 1463 | ||
1444 | // TODO Not restoring prim inventories quite yet | 1464 | // TODO Not restoring prim inventories quite yet |
1445 | 1465 | ||
1446 | foreach (DataColumn col in createTerrainTable().Columns) | 1466 | foreach (DataColumn col in createTerrainTable().Columns) |
1447 | { | 1467 | { |
1448 | if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) | 1468 | if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) |
@@ -1451,7 +1471,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1451 | return false; | 1471 | return false; |
1452 | } | 1472 | } |
1453 | } | 1473 | } |
1454 | 1474 | ||
1455 | foreach (DataColumn col in createLandTable().Columns) | 1475 | foreach (DataColumn col in createLandTable().Columns) |
1456 | { | 1476 | { |
1457 | if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) | 1477 | if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) |
@@ -1460,7 +1480,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1460 | return false; | 1480 | return false; |
1461 | } | 1481 | } |
1462 | } | 1482 | } |
1463 | 1483 | ||
1464 | foreach (DataColumn col in createLandAccessListTable().Columns) | 1484 | foreach (DataColumn col in createLandAccessListTable().Columns) |
1465 | { | 1485 | { |
1466 | if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) | 1486 | if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) |
@@ -1469,7 +1489,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1469 | return false; | 1489 | return false; |
1470 | } | 1490 | } |
1471 | } | 1491 | } |
1472 | 1492 | ||
1473 | return true; | 1493 | return true; |
1474 | } | 1494 | } |
1475 | 1495 | ||
@@ -1526,7 +1546,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1526 | else if (type == typeof (Int64)) | 1546 | else if (type == typeof (Int64)) |
1527 | { | 1547 | { |
1528 | return "integer"; | 1548 | return "integer"; |
1529 | } | 1549 | } |
1530 | else if (type == typeof (Double)) | 1550 | else if (type == typeof (Double)) |
1531 | { | 1551 | { |
1532 | return "float"; | 1552 | return "float"; |
@@ -1541,4 +1561,4 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1541 | } | 1561 | } |
1542 | } | 1562 | } |
1543 | } | 1563 | } |
1544 | } | 1564 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index da05018..035c3ba 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.Environment.Interfaces; |
32 | using OpenSim.Region.Environment.LandManagement; | 33 | using OpenSim.Region.Environment.LandManagement; |
33 | using OpenSim.Region.Environment.Scenes; | 34 | using OpenSim.Region.Environment.Scenes; |
@@ -71,9 +72,9 @@ namespace OpenSim.DataStore.NullStorage | |||
71 | { | 72 | { |
72 | } | 73 | } |
73 | 74 | ||
74 | public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) | 75 | public List<LandData> LoadLandObjects(LLUUID regionUUID) |
75 | { | 76 | { |
76 | return new List<Framework.LandData>(); | 77 | return new List<LandData>(); |
77 | } | 78 | } |
78 | 79 | ||
79 | public void Shutdown() | 80 | public void Shutdown() |