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/Framework/Data.MySQL/MySQLDataStore.cs | |
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/Framework/Data.MySQL/MySQLDataStore.cs')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | 404 |
1 files changed, 210 insertions, 194 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index c48c88f..fcf8c6f 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | |||
@@ -31,15 +31,12 @@ using System.Collections.Generic; | |||
31 | using System.Data; | 31 | using System.Data; |
32 | using System.Diagnostics; | 32 | using System.Diagnostics; |
33 | using System.IO; | 33 | using System.IO; |
34 | using System.Text; | ||
35 | using libsecondlife; | 34 | using libsecondlife; |
36 | using MySql.Data.MySqlClient; | 35 | using MySql.Data.MySqlClient; |
37 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
38 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
39 | using OpenSim.Region.Environment.LandManagement; | 38 | using OpenSim.Region.Environment.LandManagement; |
40 | using OpenSim.Region.Environment.Scenes; | 39 | using OpenSim.Region.Environment.Scenes; |
41 | using System.Data.SqlClient; | ||
42 | using System.Data.Common; | ||
43 | 40 | ||
44 | namespace OpenSim.Framework.Data.MySQL | 41 | namespace OpenSim.Framework.Data.MySQL |
45 | { | 42 | { |
@@ -130,7 +127,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
130 | { | 127 | { |
131 | foreach (SceneObjectPart prim in obj.Children.Values) | 128 | foreach (SceneObjectPart prim in obj.Children.Values) |
132 | { | 129 | { |
133 | if ((prim.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) | 130 | if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) |
134 | { | 131 | { |
135 | MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); | 132 | MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); |
136 | addPrim(prim, obj.UUID, regionUUID); | 133 | addPrim(prim, obj.UUID, regionUUID); |
@@ -156,7 +153,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
156 | DataRow[] primRows = prims.Select(selectExp); | 153 | DataRow[] primRows = prims.Select(selectExp); |
157 | foreach (DataRow row in primRows) | 154 | foreach (DataRow row in primRows) |
158 | { | 155 | { |
159 | LLUUID uuid = new LLUUID((string)row["UUID"]); | 156 | LLUUID uuid = new LLUUID((string) row["UUID"]); |
160 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid)); | 157 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid)); |
161 | if (shapeRow != null) | 158 | if (shapeRow != null) |
162 | { | 159 | { |
@@ -191,8 +188,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
191 | { | 188 | { |
192 | try | 189 | try |
193 | { | 190 | { |
194 | string uuid = (string)primRow["UUID"]; | 191 | string uuid = (string) primRow["UUID"]; |
195 | string objID = (string)primRow["SceneGroupID"]; | 192 | string objID = (string) primRow["SceneGroupID"]; |
196 | if (uuid == objID) //is new SceneObjectGroup ? | 193 | if (uuid == objID) //is new SceneObjectGroup ? |
197 | { | 194 | { |
198 | SceneObjectGroup group = new SceneObjectGroup(); | 195 | SceneObjectGroup group = new SceneObjectGroup(); |
@@ -255,10 +252,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
255 | lock (m_dataSet) | 252 | lock (m_dataSet) |
256 | { | 253 | { |
257 | MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" + | 254 | MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" + |
258 | " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection); | 255 | " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection); |
259 | using (cmd) | 256 | using (cmd) |
260 | { | 257 | { |
261 | |||
262 | cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); | 258 | cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); |
263 | cmd.Parameters.Add(new MySqlParameter("?Revision", revision)); | 259 | cmd.Parameters.Add(new MySqlParameter("?Revision", revision)); |
264 | cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter))); | 260 | cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter))); |
@@ -269,7 +265,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
269 | 265 | ||
270 | public double[,] LoadTerrain(LLUUID regionID) | 266 | public double[,] LoadTerrain(LLUUID regionID) |
271 | { | 267 | { |
272 | double[,] terret = new double[256, 256]; | 268 | double[,] terret = new double[256,256]; |
273 | terret.Initialize(); | 269 | terret.Initialize(); |
274 | 270 | ||
275 | MySqlCommand cmd = new MySqlCommand( | 271 | MySqlCommand cmd = new MySqlCommand( |
@@ -278,7 +274,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
278 | , m_connection); | 274 | , m_connection); |
279 | 275 | ||
280 | MySqlParameter param = new MySqlParameter(); | 276 | MySqlParameter param = new MySqlParameter(); |
281 | cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); | 277 | cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); |
282 | 278 | ||
283 | if (m_connection.State != ConnectionState.Open) | 279 | if (m_connection.State != ConnectionState.Open) |
284 | { | 280 | { |
@@ -290,15 +286,15 @@ namespace OpenSim.Framework.Data.MySQL | |||
290 | int rev = 0; | 286 | int rev = 0; |
291 | if (row.Read()) | 287 | if (row.Read()) |
292 | { | 288 | { |
293 | byte[] heightmap = (byte[])row["Heightfield"]; | 289 | byte[] heightmap = (byte[]) row["Heightfield"]; |
294 | for (int x = 0; x < 256; x++) | 290 | for (int x = 0; x < 256; x++) |
295 | { | 291 | { |
296 | for (int y = 0; y < 256; y++) | 292 | for (int y = 0; y < 256; y++) |
297 | { | 293 | { |
298 | terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8); | 294 | terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8); |
299 | } | 295 | } |
300 | } | 296 | } |
301 | rev = (int)row["Revision"]; | 297 | rev = (int) row["Revision"]; |
302 | } | 298 | } |
303 | else | 299 | else |
304 | { | 300 | { |
@@ -322,7 +318,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
322 | cmd.ExecuteNonQuery(); | 318 | cmd.ExecuteNonQuery(); |
323 | } | 319 | } |
324 | 320 | ||
325 | using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?UUID", m_connection)) | 321 | using ( |
322 | MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?UUID", m_connection) | ||
323 | ) | ||
326 | { | 324 | { |
327 | cmd.Parameters.Add(new MySqlParameter("?UUID", Util.ToRawUuidString(globalID))); | 325 | cmd.Parameters.Add(new MySqlParameter("?UUID", Util.ToRawUuidString(globalID))); |
328 | cmd.ExecuteNonQuery(); | 326 | cmd.ExecuteNonQuery(); |
@@ -336,7 +334,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
336 | { | 334 | { |
337 | DataTable land = m_landTable; | 335 | DataTable land = m_landTable; |
338 | DataTable landaccesslist = m_landAccessListTable; | 336 | DataTable landaccesslist = m_landAccessListTable; |
339 | 337 | ||
340 | DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.globalID)); | 338 | DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.globalID)); |
341 | if (landRow == null) | 339 | if (landRow == null) |
342 | { | 340 | { |
@@ -349,7 +347,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
349 | fillLandRow(landRow, parcel.landData, regionUUID); | 347 | fillLandRow(landRow, parcel.landData, regionUUID); |
350 | } | 348 | } |
351 | 349 | ||
352 | using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection)) | 350 | using ( |
351 | MySqlCommand cmd = | ||
352 | new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection)) | ||
353 | { | 353 | { |
354 | cmd.Parameters.Add(new MySqlParameter("?LandUUID", Util.ToRawUuidString(parcel.landData.globalID))); | 354 | cmd.Parameters.Add(new MySqlParameter("?LandUUID", Util.ToRawUuidString(parcel.landData.globalID))); |
355 | cmd.ExecuteNonQuery(); | 355 | cmd.ExecuteNonQuery(); |
@@ -361,13 +361,12 @@ namespace OpenSim.Framework.Data.MySQL | |||
361 | fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID); | 361 | fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID); |
362 | landaccesslist.Rows.Add(newAccessRow); | 362 | landaccesslist.Rows.Add(newAccessRow); |
363 | } | 363 | } |
364 | |||
365 | } | 364 | } |
366 | 365 | ||
367 | Commit(); | 366 | Commit(); |
368 | } | 367 | } |
369 | 368 | ||
370 | public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) | 369 | public List<LandData> LoadLandObjects(LLUUID regionUUID) |
371 | { | 370 | { |
372 | List<LandData> landDataForRegion = new List<LandData>(); | 371 | List<LandData> landDataForRegion = new List<LandData>(); |
373 | lock (m_dataSet) | 372 | lock (m_dataSet) |
@@ -403,7 +402,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
403 | foreach (DataRow row in table.Rows) | 402 | foreach (DataRow row in table.Rows) |
404 | { | 403 | { |
405 | //--- Display the original values, if there are any. | 404 | //--- Display the original values, if there are any. |
406 | if (row.HasVersion(System.Data.DataRowVersion.Original)) | 405 | if (row.HasVersion(DataRowVersion.Original)) |
407 | { | 406 | { |
408 | Debug.Write("Original Row Values ===> "); | 407 | Debug.Write("Original Row Values ===> "); |
409 | foreach (DataColumn column in table.Columns) | 408 | foreach (DataColumn column in table.Columns) |
@@ -412,7 +411,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
412 | Debug.WriteLine(""); | 411 | Debug.WriteLine(""); |
413 | } | 412 | } |
414 | //--- Display the current values, if there are any. | 413 | //--- Display the current values, if there are any. |
415 | if (row.HasVersion(System.Data.DataRowVersion.Current)) | 414 | if (row.HasVersion(DataRowVersion.Current)) |
416 | { | 415 | { |
417 | Debug.Write("Current Row Values ====> "); | 416 | Debug.Write("Current Row Values ====> "); |
418 | foreach (DataColumn column in table.Columns) | 417 | foreach (DataColumn column in table.Columns) |
@@ -470,9 +469,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
470 | { | 469 | { |
471 | DataTable terrain = new DataTable("terrain"); | 470 | DataTable terrain = new DataTable("terrain"); |
472 | 471 | ||
473 | createCol(terrain, "RegionUUID", typeof(String)); | 472 | createCol(terrain, "RegionUUID", typeof (String)); |
474 | createCol(terrain, "Revision", typeof(Int32)); | 473 | createCol(terrain, "Revision", typeof (Int32)); |
475 | DataColumn heightField = createCol(terrain, "Heightfield", typeof(Byte[])); | 474 | DataColumn heightField = createCol(terrain, "Heightfield", typeof (Byte[])); |
476 | return terrain; | 475 | return terrain; |
477 | } | 476 | } |
478 | 477 | ||
@@ -480,62 +479,62 @@ namespace OpenSim.Framework.Data.MySQL | |||
480 | { | 479 | { |
481 | DataTable prims = new DataTable("prims"); | 480 | DataTable prims = new DataTable("prims"); |
482 | 481 | ||
483 | createCol(prims, "UUID", typeof(String)); | 482 | createCol(prims, "UUID", typeof (String)); |
484 | createCol(prims, "RegionUUID", typeof(String)); | 483 | createCol(prims, "RegionUUID", typeof (String)); |
485 | createCol(prims, "ParentID", typeof(Int32)); | 484 | createCol(prims, "ParentID", typeof (Int32)); |
486 | createCol(prims, "CreationDate", typeof(Int32)); | 485 | createCol(prims, "CreationDate", typeof (Int32)); |
487 | createCol(prims, "Name", typeof(String)); | 486 | createCol(prims, "Name", typeof (String)); |
488 | createCol(prims, "SceneGroupID", typeof(String)); | 487 | createCol(prims, "SceneGroupID", typeof (String)); |
489 | // various text fields | 488 | // various text fields |
490 | createCol(prims, "Text", typeof(String)); | 489 | createCol(prims, "Text", typeof (String)); |
491 | createCol(prims, "Description", typeof(String)); | 490 | createCol(prims, "Description", typeof (String)); |
492 | createCol(prims, "SitName", typeof(String)); | 491 | createCol(prims, "SitName", typeof (String)); |
493 | createCol(prims, "TouchName", typeof(String)); | 492 | createCol(prims, "TouchName", typeof (String)); |
494 | // permissions | 493 | // permissions |
495 | createCol(prims, "ObjectFlags", typeof(Int32)); | 494 | createCol(prims, "ObjectFlags", typeof (Int32)); |
496 | createCol(prims, "CreatorID", typeof(String)); | 495 | createCol(prims, "CreatorID", typeof (String)); |
497 | createCol(prims, "OwnerID", typeof(String)); | 496 | createCol(prims, "OwnerID", typeof (String)); |
498 | createCol(prims, "GroupID", typeof(String)); | 497 | createCol(prims, "GroupID", typeof (String)); |
499 | createCol(prims, "LastOwnerID", typeof(String)); | 498 | createCol(prims, "LastOwnerID", typeof (String)); |
500 | createCol(prims, "OwnerMask", typeof(Int32)); | 499 | createCol(prims, "OwnerMask", typeof (Int32)); |
501 | createCol(prims, "NextOwnerMask", typeof(Int32)); | 500 | createCol(prims, "NextOwnerMask", typeof (Int32)); |
502 | createCol(prims, "GroupMask", typeof(Int32)); | 501 | createCol(prims, "GroupMask", typeof (Int32)); |
503 | createCol(prims, "EveryoneMask", typeof(Int32)); | 502 | createCol(prims, "EveryoneMask", typeof (Int32)); |
504 | createCol(prims, "BaseMask", typeof(Int32)); | 503 | createCol(prims, "BaseMask", typeof (Int32)); |
505 | // vectors | 504 | // vectors |
506 | createCol(prims, "PositionX", typeof(Double)); | 505 | createCol(prims, "PositionX", typeof (Double)); |
507 | createCol(prims, "PositionY", typeof(Double)); | 506 | createCol(prims, "PositionY", typeof (Double)); |
508 | createCol(prims, "PositionZ", typeof(Double)); | 507 | createCol(prims, "PositionZ", typeof (Double)); |
509 | createCol(prims, "GroupPositionX", typeof(Double)); | 508 | createCol(prims, "GroupPositionX", typeof (Double)); |
510 | createCol(prims, "GroupPositionY", typeof(Double)); | 509 | createCol(prims, "GroupPositionY", typeof (Double)); |
511 | createCol(prims, "GroupPositionZ", typeof(Double)); | 510 | createCol(prims, "GroupPositionZ", typeof (Double)); |
512 | createCol(prims, "VelocityX", typeof(Double)); | 511 | createCol(prims, "VelocityX", typeof (Double)); |
513 | createCol(prims, "VelocityY", typeof(Double)); | 512 | createCol(prims, "VelocityY", typeof (Double)); |
514 | createCol(prims, "VelocityZ", typeof(Double)); | 513 | createCol(prims, "VelocityZ", typeof (Double)); |
515 | createCol(prims, "AngularVelocityX", typeof(Double)); | 514 | createCol(prims, "AngularVelocityX", typeof (Double)); |
516 | createCol(prims, "AngularVelocityY", typeof(Double)); | 515 | createCol(prims, "AngularVelocityY", typeof (Double)); |
517 | createCol(prims, "AngularVelocityZ", typeof(Double)); | 516 | createCol(prims, "AngularVelocityZ", typeof (Double)); |
518 | createCol(prims, "AccelerationX", typeof(Double)); | 517 | createCol(prims, "AccelerationX", typeof (Double)); |
519 | createCol(prims, "AccelerationY", typeof(Double)); | 518 | createCol(prims, "AccelerationY", typeof (Double)); |
520 | createCol(prims, "AccelerationZ", typeof(Double)); | 519 | createCol(prims, "AccelerationZ", typeof (Double)); |
521 | // quaternions | 520 | // quaternions |
522 | createCol(prims, "RotationX", typeof(Double)); | 521 | createCol(prims, "RotationX", typeof (Double)); |
523 | createCol(prims, "RotationY", typeof(Double)); | 522 | createCol(prims, "RotationY", typeof (Double)); |
524 | createCol(prims, "RotationZ", typeof(Double)); | 523 | createCol(prims, "RotationZ", typeof (Double)); |
525 | createCol(prims, "RotationW", typeof(Double)); | 524 | createCol(prims, "RotationW", typeof (Double)); |
526 | // sit target | 525 | // sit target |
527 | createCol(prims, "SitTargetOffsetX", typeof(Double)); | 526 | createCol(prims, "SitTargetOffsetX", typeof (Double)); |
528 | createCol(prims, "SitTargetOffsetY", typeof(Double)); | 527 | createCol(prims, "SitTargetOffsetY", typeof (Double)); |
529 | createCol(prims, "SitTargetOffsetZ", typeof(Double)); | 528 | createCol(prims, "SitTargetOffsetZ", typeof (Double)); |
530 | 529 | ||
531 | createCol(prims, "SitTargetOrientW", typeof(Double)); | 530 | createCol(prims, "SitTargetOrientW", typeof (Double)); |
532 | createCol(prims, "SitTargetOrientX", typeof(Double)); | 531 | createCol(prims, "SitTargetOrientX", typeof (Double)); |
533 | createCol(prims, "SitTargetOrientY", typeof(Double)); | 532 | createCol(prims, "SitTargetOrientY", typeof (Double)); |
534 | createCol(prims, "SitTargetOrientZ", typeof(Double)); | 533 | createCol(prims, "SitTargetOrientZ", typeof (Double)); |
535 | 534 | ||
536 | 535 | ||
537 | // Add in contraints | 536 | // Add in contraints |
538 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; | 537 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; |
539 | 538 | ||
540 | return prims; | 539 | return prims; |
541 | } | 540 | } |
@@ -543,42 +542,42 @@ namespace OpenSim.Framework.Data.MySQL | |||
543 | private DataTable createLandTable() | 542 | private DataTable createLandTable() |
544 | { | 543 | { |
545 | DataTable land = new DataTable("land"); | 544 | DataTable land = new DataTable("land"); |
546 | createCol(land, "UUID", typeof(String)); | 545 | createCol(land, "UUID", typeof (String)); |
547 | createCol(land, "RegionUUID", typeof(String)); | 546 | createCol(land, "RegionUUID", typeof (String)); |
548 | createCol(land, "LocalLandID", typeof(Int32)); | 547 | createCol(land, "LocalLandID", typeof (Int32)); |
549 | 548 | ||
550 | // Bitmap is a byte[512] | 549 | // Bitmap is a byte[512] |
551 | createCol(land, "Bitmap", typeof(Byte[])); | 550 | createCol(land, "Bitmap", typeof (Byte[])); |
552 | 551 | ||
553 | createCol(land, "Name", typeof(String)); | 552 | createCol(land, "Name", typeof (String)); |
554 | createCol(land, "Description", typeof(String)); | 553 | createCol(land, "Description", typeof (String)); |
555 | createCol(land, "OwnerUUID", typeof(String)); | 554 | createCol(land, "OwnerUUID", typeof (String)); |
556 | createCol(land, "IsGroupOwned", typeof(Int32)); | 555 | createCol(land, "IsGroupOwned", typeof (Int32)); |
557 | createCol(land, "Area", typeof(Int32)); | 556 | createCol(land, "Area", typeof (Int32)); |
558 | createCol(land, "AuctionID", typeof(Int32)); //Unemplemented | 557 | createCol(land, "AuctionID", typeof (Int32)); //Unemplemented |
559 | createCol(land, "Category", typeof(Int32)); //Enum libsecondlife.Parcel.ParcelCategory | 558 | createCol(land, "Category", typeof (Int32)); //Enum libsecondlife.Parcel.ParcelCategory |
560 | createCol(land, "ClaimDate", typeof(Int32)); | 559 | createCol(land, "ClaimDate", typeof (Int32)); |
561 | createCol(land, "ClaimPrice", typeof(Int32)); | 560 | createCol(land, "ClaimPrice", typeof (Int32)); |
562 | createCol(land, "GroupUUID", typeof(String)); | 561 | createCol(land, "GroupUUID", typeof (String)); |
563 | createCol(land, "SalePrice", typeof(Int32)); | 562 | createCol(land, "SalePrice", typeof (Int32)); |
564 | createCol(land, "LandStatus", typeof(Int32)); //Enum. libsecondlife.Parcel.ParcelStatus | 563 | createCol(land, "LandStatus", typeof (Int32)); //Enum. libsecondlife.Parcel.ParcelStatus |
565 | createCol(land, "LandFlags", typeof(Int32)); | 564 | createCol(land, "LandFlags", typeof (Int32)); |
566 | createCol(land, "LandingType", typeof(Int32)); | 565 | createCol(land, "LandingType", typeof (Int32)); |
567 | createCol(land, "MediaAutoScale", typeof(Int32)); | 566 | createCol(land, "MediaAutoScale", typeof (Int32)); |
568 | createCol(land, "MediaTextureUUID", typeof(String)); | 567 | createCol(land, "MediaTextureUUID", typeof (String)); |
569 | createCol(land, "MediaURL", typeof(String)); | 568 | createCol(land, "MediaURL", typeof (String)); |
570 | createCol(land, "MusicURL", typeof(String)); | 569 | createCol(land, "MusicURL", typeof (String)); |
571 | createCol(land, "PassHours", typeof(Double)); | 570 | createCol(land, "PassHours", typeof (Double)); |
572 | createCol(land, "PassPrice", typeof(Int32)); | 571 | createCol(land, "PassPrice", typeof (Int32)); |
573 | createCol(land, "SnapshotUUID", typeof(String)); | 572 | createCol(land, "SnapshotUUID", typeof (String)); |
574 | createCol(land, "UserLocationX", typeof(Double)); | 573 | createCol(land, "UserLocationX", typeof (Double)); |
575 | createCol(land, "UserLocationY", typeof(Double)); | 574 | createCol(land, "UserLocationY", typeof (Double)); |
576 | createCol(land, "UserLocationZ", typeof(Double)); | 575 | createCol(land, "UserLocationZ", typeof (Double)); |
577 | createCol(land, "UserLookAtX", typeof(Double)); | 576 | createCol(land, "UserLookAtX", typeof (Double)); |
578 | createCol(land, "UserLookAtY", typeof(Double)); | 577 | createCol(land, "UserLookAtY", typeof (Double)); |
579 | createCol(land, "UserLookAtZ", typeof(Double)); | 578 | createCol(land, "UserLookAtZ", typeof (Double)); |
580 | 579 | ||
581 | land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; | 580 | land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; |
582 | 581 | ||
583 | return land; | 582 | return land; |
584 | } | 583 | } |
@@ -586,9 +585,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
586 | private DataTable createLandAccessListTable() | 585 | private DataTable createLandAccessListTable() |
587 | { | 586 | { |
588 | DataTable landaccess = new DataTable("landaccesslist"); | 587 | DataTable landaccess = new DataTable("landaccesslist"); |
589 | createCol(landaccess, "LandUUID", typeof(String)); | 588 | createCol(landaccess, "LandUUID", typeof (String)); |
590 | createCol(landaccess, "AccessUUID", typeof(String)); | 589 | createCol(landaccess, "AccessUUID", typeof (String)); |
591 | createCol(landaccess, "Flags", typeof(Int32)); | 590 | createCol(landaccess, "Flags", typeof (Int32)); |
592 | 591 | ||
593 | return landaccess; | 592 | return landaccess; |
594 | } | 593 | } |
@@ -596,38 +595,38 @@ namespace OpenSim.Framework.Data.MySQL | |||
596 | private DataTable createShapeTable() | 595 | private DataTable createShapeTable() |
597 | { | 596 | { |
598 | DataTable shapes = new DataTable("primshapes"); | 597 | DataTable shapes = new DataTable("primshapes"); |
599 | createCol(shapes, "UUID", typeof(String)); | 598 | createCol(shapes, "UUID", typeof (String)); |
600 | // shape is an enum | 599 | // shape is an enum |
601 | createCol(shapes, "Shape", typeof(Int32)); | 600 | createCol(shapes, "Shape", typeof (Int32)); |
602 | // vectors | 601 | // vectors |
603 | createCol(shapes, "ScaleX", typeof(Double)); | 602 | createCol(shapes, "ScaleX", typeof (Double)); |
604 | createCol(shapes, "ScaleY", typeof(Double)); | 603 | createCol(shapes, "ScaleY", typeof (Double)); |
605 | createCol(shapes, "ScaleZ", typeof(Double)); | 604 | createCol(shapes, "ScaleZ", typeof (Double)); |
606 | // paths | 605 | // paths |
607 | createCol(shapes, "PCode", typeof(Int32)); | 606 | createCol(shapes, "PCode", typeof (Int32)); |
608 | createCol(shapes, "PathBegin", typeof(Int32)); | 607 | createCol(shapes, "PathBegin", typeof (Int32)); |
609 | createCol(shapes, "PathEnd", typeof(Int32)); | 608 | createCol(shapes, "PathEnd", typeof (Int32)); |
610 | createCol(shapes, "PathScaleX", typeof(Int32)); | 609 | createCol(shapes, "PathScaleX", typeof (Int32)); |
611 | createCol(shapes, "PathScaleY", typeof(Int32)); | 610 | createCol(shapes, "PathScaleY", typeof (Int32)); |
612 | createCol(shapes, "PathShearX", typeof(Int32)); | 611 | createCol(shapes, "PathShearX", typeof (Int32)); |
613 | createCol(shapes, "PathShearY", typeof(Int32)); | 612 | createCol(shapes, "PathShearY", typeof (Int32)); |
614 | createCol(shapes, "PathSkew", typeof(Int32)); | 613 | createCol(shapes, "PathSkew", typeof (Int32)); |
615 | createCol(shapes, "PathCurve", typeof(Int32)); | 614 | createCol(shapes, "PathCurve", typeof (Int32)); |
616 | createCol(shapes, "PathRadiusOffset", typeof(Int32)); | 615 | createCol(shapes, "PathRadiusOffset", typeof (Int32)); |
617 | createCol(shapes, "PathRevolutions", typeof(Int32)); | 616 | createCol(shapes, "PathRevolutions", typeof (Int32)); |
618 | createCol(shapes, "PathTaperX", typeof(Int32)); | 617 | createCol(shapes, "PathTaperX", typeof (Int32)); |
619 | createCol(shapes, "PathTaperY", typeof(Int32)); | 618 | createCol(shapes, "PathTaperY", typeof (Int32)); |
620 | createCol(shapes, "PathTwist", typeof(Int32)); | 619 | createCol(shapes, "PathTwist", typeof (Int32)); |
621 | createCol(shapes, "PathTwistBegin", typeof(Int32)); | 620 | createCol(shapes, "PathTwistBegin", typeof (Int32)); |
622 | // profile | 621 | // profile |
623 | createCol(shapes, "ProfileBegin", typeof(Int32)); | 622 | createCol(shapes, "ProfileBegin", typeof (Int32)); |
624 | createCol(shapes, "ProfileEnd", typeof(Int32)); | 623 | createCol(shapes, "ProfileEnd", typeof (Int32)); |
625 | createCol(shapes, "ProfileCurve", typeof(Int32)); | 624 | createCol(shapes, "ProfileCurve", typeof (Int32)); |
626 | createCol(shapes, "ProfileHollow", typeof(Int32)); | 625 | createCol(shapes, "ProfileHollow", typeof (Int32)); |
627 | createCol(shapes, "Texture", typeof(Byte[])); | 626 | createCol(shapes, "Texture", typeof (Byte[])); |
628 | createCol(shapes, "ExtraParams", typeof(Byte[])); | 627 | createCol(shapes, "ExtraParams", typeof (Byte[])); |
629 | 628 | ||
630 | shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; | 629 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; |
631 | 630 | ||
632 | return shapes; | 631 | return shapes; |
633 | } | 632 | } |
@@ -643,23 +642,23 @@ namespace OpenSim.Framework.Data.MySQL | |||
643 | private SceneObjectPart buildPrim(DataRow row) | 642 | private SceneObjectPart buildPrim(DataRow row) |
644 | { | 643 | { |
645 | SceneObjectPart prim = new SceneObjectPart(); | 644 | SceneObjectPart prim = new SceneObjectPart(); |
646 | prim.UUID = new LLUUID((String)row["UUID"]); | 645 | prim.UUID = new LLUUID((String) row["UUID"]); |
647 | // explicit conversion of integers is required, which sort | 646 | // explicit conversion of integers is required, which sort |
648 | // of sucks. No idea if there is a shortcut here or not. | 647 | // of sucks. No idea if there is a shortcut here or not. |
649 | prim.ParentID = Convert.ToUInt32(row["ParentID"]); | 648 | prim.ParentID = Convert.ToUInt32(row["ParentID"]); |
650 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); | 649 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); |
651 | prim.Name = (String)row["Name"]; | 650 | prim.Name = (String) row["Name"]; |
652 | // various text fields | 651 | // various text fields |
653 | prim.Text = (String)row["Text"]; | 652 | prim.Text = (String) row["Text"]; |
654 | prim.Description = (String)row["Description"]; | 653 | prim.Description = (String) row["Description"]; |
655 | prim.SitName = (String)row["SitName"]; | 654 | prim.SitName = (String) row["SitName"]; |
656 | prim.TouchName = (String)row["TouchName"]; | 655 | prim.TouchName = (String) row["TouchName"]; |
657 | // permissions | 656 | // permissions |
658 | prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); | 657 | prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); |
659 | prim.CreatorID = new LLUUID((String)row["CreatorID"]); | 658 | prim.CreatorID = new LLUUID((String) row["CreatorID"]); |
660 | prim.OwnerID = new LLUUID((String)row["OwnerID"]); | 659 | prim.OwnerID = new LLUUID((String) row["OwnerID"]); |
661 | prim.GroupID = new LLUUID((String)row["GroupID"]); | 660 | prim.GroupID = new LLUUID((String) row["GroupID"]); |
662 | prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); | 661 | prim.LastOwnerID = new LLUUID((String) row["LastOwnerID"]); |
663 | prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); | 662 | prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); |
664 | prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); | 663 | prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); |
665 | prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); | 664 | prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); |
@@ -701,19 +700,27 @@ namespace OpenSim.Framework.Data.MySQL | |||
701 | try | 700 | try |
702 | { | 701 | { |
703 | prim.SetSitTargetLL(new LLVector3( | 702 | prim.SetSitTargetLL(new LLVector3( |
704 | Convert.ToSingle(row["SitTargetOffsetX"]), | 703 | Convert.ToSingle(row["SitTargetOffsetX"]), |
705 | Convert.ToSingle(row["SitTargetOffsetY"]), | 704 | Convert.ToSingle(row["SitTargetOffsetY"]), |
706 | Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( | 705 | Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( |
707 | Convert.ToSingle(row["SitTargetOrientX"]), | 706 | Convert.ToSingle( |
708 | Convert.ToSingle(row["SitTargetOrientY"]), | 707 | row["SitTargetOrientX"]), |
709 | Convert.ToSingle(row["SitTargetOrientZ"]), | 708 | Convert.ToSingle( |
710 | Convert.ToSingle(row["SitTargetOrientW"]))); | 709 | row["SitTargetOrientY"]), |
710 | Convert.ToSingle( | ||
711 | row["SitTargetOrientZ"]), | ||
712 | Convert.ToSingle( | ||
713 | row["SitTargetOrientW"]))); | ||
711 | } | 714 | } |
712 | catch (System.InvalidCastException) | 715 | catch (InvalidCastException) |
713 | { | 716 | { |
714 | // Database table was created before we got here and needs to be created! :P | 717 | // Database table was created before we got here and needs to be created! :P |
715 | 718 | ||
716 | using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection)) | 719 | using ( |
720 | MySqlCommand cmd = | ||
721 | new MySqlCommand( | ||
722 | "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", | ||
723 | m_connection)) | ||
717 | { | 724 | { |
718 | cmd.ExecuteNonQuery(); | 725 | cmd.ExecuteNonQuery(); |
719 | } | 726 | } |
@@ -725,36 +732,42 @@ namespace OpenSim.Framework.Data.MySQL | |||
725 | { | 732 | { |
726 | LandData newData = new LandData(); | 733 | LandData newData = new LandData(); |
727 | 734 | ||
728 | newData.globalID = new LLUUID((String)row["UUID"]); | 735 | newData.globalID = new LLUUID((String) row["UUID"]); |
729 | newData.localID = Convert.ToInt32(row["LocalLandID"]); | 736 | newData.localID = Convert.ToInt32(row["LocalLandID"]); |
730 | 737 | ||
731 | // Bitmap is a byte[512] | 738 | // Bitmap is a byte[512] |
732 | newData.landBitmapByteArray = (Byte[])row["Bitmap"]; | 739 | newData.landBitmapByteArray = (Byte[]) row["Bitmap"]; |
733 | 740 | ||
734 | newData.landName = (String)row["Name"]; | 741 | newData.landName = (String) row["Name"]; |
735 | newData.landDesc = (String)row["Description"]; | 742 | newData.landDesc = (String) row["Description"]; |
736 | newData.ownerID = (String)row["OwnerUUID"]; | 743 | newData.ownerID = (String) row["OwnerUUID"]; |
737 | newData.isGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); | 744 | newData.isGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); |
738 | newData.area = Convert.ToInt32(row["Area"]); | 745 | newData.area = Convert.ToInt32(row["Area"]); |
739 | newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented | 746 | newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented |
740 | newData.category = (Parcel.ParcelCategory)Convert.ToInt32(row["Category"]); //Enum libsecondlife.Parcel.ParcelCategory | 747 | newData.category = (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]); |
748 | //Enum libsecondlife.Parcel.ParcelCategory | ||
741 | newData.claimDate = Convert.ToInt32(row["ClaimDate"]); | 749 | newData.claimDate = Convert.ToInt32(row["ClaimDate"]); |
742 | newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]); | 750 | newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]); |
743 | newData.groupID = new LLUUID((String)row["GroupUUID"]); | 751 | newData.groupID = new LLUUID((String) row["GroupUUID"]); |
744 | newData.salePrice = Convert.ToInt32(row["SalePrice"]); | 752 | newData.salePrice = Convert.ToInt32(row["SalePrice"]); |
745 | newData.landStatus = (Parcel.ParcelStatus)Convert.ToInt32(row["LandStatus"]); //Enum. libsecondlife.Parcel.ParcelStatus | 753 | newData.landStatus = (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]); |
754 | //Enum. libsecondlife.Parcel.ParcelStatus | ||
746 | newData.landFlags = Convert.ToUInt32(row["LandFlags"]); | 755 | newData.landFlags = Convert.ToUInt32(row["LandFlags"]); |
747 | newData.landingType = Convert.ToByte(row["LandingType"]); | 756 | newData.landingType = Convert.ToByte(row["LandingType"]); |
748 | newData.mediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); | 757 | newData.mediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); |
749 | newData.mediaID = new LLUUID((String)row["MediaTextureUUID"]); | 758 | newData.mediaID = new LLUUID((String) row["MediaTextureUUID"]); |
750 | newData.mediaURL = (String)row["MediaURL"]; | 759 | newData.mediaURL = (String) row["MediaURL"]; |
751 | newData.musicURL = (String)row["MusicURL"]; | 760 | newData.musicURL = (String) row["MusicURL"]; |
752 | newData.passHours = Convert.ToSingle(row["PassHours"]); | 761 | newData.passHours = Convert.ToSingle(row["PassHours"]); |
753 | newData.passPrice = Convert.ToInt32(row["PassPrice"]); | 762 | newData.passPrice = Convert.ToInt32(row["PassPrice"]); |
754 | newData.snapshotID = (String)row["SnapshotUUID"]; | 763 | newData.snapshotID = (String) row["SnapshotUUID"]; |
755 | 764 | ||
756 | newData.userLocation = new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), Convert.ToSingle(row["UserLocationZ"])); | 765 | newData.userLocation = |
757 | newData.userLookAt = new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), Convert.ToSingle(row["UserLookAtZ"])); | 766 | new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), |
767 | Convert.ToSingle(row["UserLocationZ"])); | ||
768 | newData.userLookAt = | ||
769 | new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), | ||
770 | Convert.ToSingle(row["UserLookAtZ"])); | ||
758 | newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); | 771 | newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); |
759 | 772 | ||
760 | return newData; | 773 | return newData; |
@@ -763,7 +776,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
763 | private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) | 776 | private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) |
764 | { | 777 | { |
765 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 778 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
766 | entry.AgentID = new LLUUID((string)row["AccessUUID"]); | 779 | entry.AgentID = new LLUUID((string) row["AccessUUID"]); |
767 | entry.Flags = (ParcelManager.AccessList) Convert.ToInt32(row["Flags"]); | 780 | entry.Flags = (ParcelManager.AccessList) Convert.ToInt32(row["Flags"]); |
768 | entry.Time = new DateTime(); | 781 | entry.Time = new DateTime(); |
769 | return entry; | 782 | return entry; |
@@ -771,7 +784,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
771 | 784 | ||
772 | private Array serializeTerrain(double[,] val) | 785 | private Array serializeTerrain(double[,] val) |
773 | { | 786 | { |
774 | MemoryStream str = new MemoryStream(65536 * sizeof(double)); | 787 | MemoryStream str = new MemoryStream(65536*sizeof (double)); |
775 | BinaryWriter bw = new BinaryWriter(str); | 788 | BinaryWriter bw = new BinaryWriter(str); |
776 | 789 | ||
777 | // TODO: COMPATIBILITY - Add byte-order conversions | 790 | // TODO: COMPATIBILITY - Add byte-order conversions |
@@ -789,7 +802,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
789 | row["ParentID"] = prim.ParentID; | 802 | row["ParentID"] = prim.ParentID; |
790 | row["CreationDate"] = prim.CreationDate; | 803 | row["CreationDate"] = prim.CreationDate; |
791 | row["Name"] = prim.Name; | 804 | row["Name"] = prim.Name; |
792 | row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); // the UUID of the root part for this SceneObjectGroup | 805 | row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); |
806 | // the UUID of the root part for this SceneObjectGroup | ||
793 | // various text fields | 807 | // various text fields |
794 | row["Text"] = prim.Text; | 808 | row["Text"] = prim.Text; |
795 | row["Description"] = prim.Description; | 809 | row["Description"] = prim.Description; |
@@ -841,18 +855,20 @@ namespace OpenSim.Framework.Data.MySQL | |||
841 | row["SitTargetOrientX"] = sitTargetOrient.X; | 855 | row["SitTargetOrientX"] = sitTargetOrient.X; |
842 | row["SitTargetOrientY"] = sitTargetOrient.Y; | 856 | row["SitTargetOrientY"] = sitTargetOrient.Y; |
843 | row["SitTargetOrientZ"] = sitTargetOrient.Z; | 857 | row["SitTargetOrientZ"] = sitTargetOrient.Z; |
844 | } | 858 | } |
845 | catch (MySql.Data.MySqlClient.MySqlException) | 859 | catch (MySqlException) |
846 | { | 860 | { |
847 | // Database table was created before we got here and needs to be created! :P | 861 | // Database table was created before we got here and needs to be created! :P |
848 | 862 | ||
849 | using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection)) | 863 | using ( |
864 | MySqlCommand cmd = | ||
865 | new MySqlCommand( | ||
866 | "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", | ||
867 | m_connection)) | ||
850 | { | 868 | { |
851 | cmd.ExecuteNonQuery(); | 869 | cmd.ExecuteNonQuery(); |
852 | } | 870 | } |
853 | } | 871 | } |
854 | |||
855 | |||
856 | } | 872 | } |
857 | 873 | ||
858 | private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) | 874 | private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) |
@@ -929,11 +945,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
929 | s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); | 945 | s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); |
930 | s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); | 946 | s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); |
931 | s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); | 947 | s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); |
932 | 948 | ||
933 | byte[] textureEntry = (byte[])row["Texture"]; | 949 | byte[] textureEntry = (byte[]) row["Texture"]; |
934 | s.TextureEntry = textureEntry; | 950 | s.TextureEntry = textureEntry; |
935 | 951 | ||
936 | s.ExtraParams = (byte[])row["ExtraParams"]; | 952 | s.ExtraParams = (byte[]) row["ExtraParams"]; |
937 | 953 | ||
938 | return s; | 954 | return s; |
939 | } | 955 | } |
@@ -1146,7 +1162,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
1146 | da.UpdateCommand = updateCommand; | 1162 | da.UpdateCommand = updateCommand; |
1147 | 1163 | ||
1148 | MySqlCommand delete = new MySqlCommand("delete from prims where UUID=?UUID"); | 1164 | MySqlCommand delete = new MySqlCommand("delete from prims where UUID=?UUID"); |
1149 | delete.Parameters.Add(createMySqlParameter("UUID", typeof(String))); | 1165 | delete.Parameters.Add(createMySqlParameter("UUID", typeof (String))); |
1150 | delete.Connection = conn; | 1166 | delete.Connection = conn; |
1151 | da.DeleteCommand = delete; | 1167 | da.DeleteCommand = delete; |
1152 | } | 1168 | } |
@@ -1181,7 +1197,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
1181 | da.UpdateCommand.Connection = conn; | 1197 | da.UpdateCommand.Connection = conn; |
1182 | 1198 | ||
1183 | MySqlCommand delete = new MySqlCommand("delete from primshapes where UUID = ?UUID"); | 1199 | MySqlCommand delete = new MySqlCommand("delete from primshapes where UUID = ?UUID"); |
1184 | delete.Parameters.Add(createMySqlParameter("UUID", typeof(String))); | 1200 | delete.Parameters.Add(createMySqlParameter("UUID", typeof (String))); |
1185 | delete.Connection = conn; | 1201 | delete.Connection = conn; |
1186 | da.DeleteCommand = delete; | 1202 | da.DeleteCommand = delete; |
1187 | } | 1203 | } |
@@ -1337,27 +1353,27 @@ namespace OpenSim.Framework.Data.MySQL | |||
1337 | 1353 | ||
1338 | private DbType dbtypeFromType(Type type) | 1354 | private DbType dbtypeFromType(Type type) |
1339 | { | 1355 | { |
1340 | if (type == typeof(String)) | 1356 | if (type == typeof (String)) |
1341 | { | 1357 | { |
1342 | return DbType.String; | 1358 | return DbType.String; |
1343 | } | 1359 | } |
1344 | else if (type == typeof(Int32)) | 1360 | else if (type == typeof (Int32)) |
1345 | { | 1361 | { |
1346 | return DbType.Int32; | 1362 | return DbType.Int32; |
1347 | } | 1363 | } |
1348 | else if (type == typeof(Double)) | 1364 | else if (type == typeof (Double)) |
1349 | { | 1365 | { |
1350 | return DbType.Double; | 1366 | return DbType.Double; |
1351 | } | 1367 | } |
1352 | else if (type == typeof(Byte)) | 1368 | else if (type == typeof (Byte)) |
1353 | { | 1369 | { |
1354 | return DbType.Byte; | 1370 | return DbType.Byte; |
1355 | } | 1371 | } |
1356 | else if (type == typeof(Double)) | 1372 | else if (type == typeof (Double)) |
1357 | { | 1373 | { |
1358 | return DbType.Double; | 1374 | return DbType.Double; |
1359 | } | 1375 | } |
1360 | else if (type == typeof(Byte[])) | 1376 | else if (type == typeof (Byte[])) |
1361 | { | 1377 | { |
1362 | return DbType.Binary; | 1378 | return DbType.Binary; |
1363 | } | 1379 | } |
@@ -1371,19 +1387,19 @@ namespace OpenSim.Framework.Data.MySQL | |||
1371 | // slightly differently. | 1387 | // slightly differently. |
1372 | private string MySqlType(Type type) | 1388 | private string MySqlType(Type type) |
1373 | { | 1389 | { |
1374 | if (type == typeof(String)) | 1390 | if (type == typeof (String)) |
1375 | { | 1391 | { |
1376 | return "varchar(255)"; | 1392 | return "varchar(255)"; |
1377 | } | 1393 | } |
1378 | else if (type == typeof(Int32)) | 1394 | else if (type == typeof (Int32)) |
1379 | { | 1395 | { |
1380 | return "integer"; | 1396 | return "integer"; |
1381 | } | 1397 | } |
1382 | else if (type == typeof(Double)) | 1398 | else if (type == typeof (Double)) |
1383 | { | 1399 | { |
1384 | return "float"; | 1400 | return "float"; |
1385 | } | 1401 | } |
1386 | else if (type == typeof(Byte[])) | 1402 | else if (type == typeof (Byte[])) |
1387 | { | 1403 | { |
1388 | return "longblob"; | 1404 | return "longblob"; |
1389 | } | 1405 | } |
@@ -1393,4 +1409,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
1393 | } | 1409 | } |
1394 | } | 1410 | } |
1395 | } | 1411 | } |
1396 | } | 1412 | } \ No newline at end of file |