diff options
author | Charles Krinke | 2008-03-02 22:36:47 +0000 |
---|---|---|
committer | Charles Krinke | 2008-03-02 22:36:47 +0000 |
commit | cff3c20ee5df34f4a6ff05c0bc1fbd35baceff42 (patch) | |
tree | 4747517f8a6f1fe50466dad18bb455434abd2392 /OpenSim/Framework | |
parent | Change handler001 through handler009 to more (diff) | |
download | opensim-SC-cff3c20ee5df34f4a6ff05c0bc1fbd35baceff42.zip opensim-SC-cff3c20ee5df34f4a6ff05c0bc1fbd35baceff42.tar.gz opensim-SC-cff3c20ee5df34f4a6ff05c0bc1fbd35baceff42.tar.bz2 opensim-SC-cff3c20ee5df34f4a6ff05c0bc1fbd35baceff42.tar.xz |
Thank you very much, Ahzzmandius for:
converts Parse calls to TryParse
Replaces string.empty and lluuid.zero calls on user load to use real
values from DB (related to user profile save/load work. Finer grained patching)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLManager.cs | 70 | ||||
-rw-r--r-- | OpenSim/Framework/Data/RegionProfileData.cs | 8 |
2 files changed, 27 insertions, 51 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index e8c42f3..1a90eea 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs | |||
@@ -293,10 +293,14 @@ namespace OpenSim.Framework.Data.MySQL | |||
293 | 293 | ||
294 | if (reader.Read()) | 294 | if (reader.Read()) |
295 | { | 295 | { |
296 | // Region Main | 296 | // Region Main gotta-have-or-we-return-null parts |
297 | retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); | 297 | if (!UInt64.TryParse(reader["regionHandle"].ToString(), out retval.regionHandle)) |
298 | retval.regionName = (string) reader["regionName"]; | 298 | return null; |
299 | retval.UUID = new LLUUID((string) reader["uuid"]); | 299 | if (!LLUUID.TryParse((string)reader["uuid"], out retval.UUID)) |
300 | return null; | ||
301 | |||
302 | // non-critical parts | ||
303 | retval.regionName = (string)reader["regionName"]; | ||
300 | 304 | ||
301 | // Secrets | 305 | // Secrets |
302 | retval.regionRecvKey = (string) reader["regionRecvKey"]; | 306 | retval.regionRecvKey = (string) reader["regionRecvKey"]; |
@@ -334,33 +338,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
334 | retval.regionUserSendKey = (string) reader["regionUserSendKey"]; | 338 | retval.regionUserSendKey = (string) reader["regionUserSendKey"]; |
335 | 339 | ||
336 | // World Map Addition | 340 | // World Map Addition |
337 | string tempRegionMap = reader["regionMapTexture"].ToString(); | 341 | LLUUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID); |
338 | if (tempRegionMap != String.Empty) | 342 | LLUUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid); |
339 | { | 343 | } |
340 | retval.regionMapTextureID = new LLUUID(tempRegionMap); | ||
341 | } | ||
342 | else | ||
343 | { | ||
344 | retval.regionMapTextureID = LLUUID.Zero; | ||
345 | } | ||
346 | |||
347 | // part of an initial brutish effort to provide accurate information (as per the xml region spec) | ||
348 | // wrt the ownership of a given region | ||
349 | // the (very bad) assumption is that this value is being read and handled inconsistently or | ||
350 | // not at all. Current strategy is to put the code in place to support the validity of this information | ||
351 | // and to roll forward debugging any issues from that point | ||
352 | // | ||
353 | // this particular section of the mod attempts to supply a value from the region table to the caller of 'readSimRow()' | ||
354 | // for the UUID of the region's owner (master avatar) | ||
355 | try | ||
356 | { | ||
357 | retval.owner_uuid = new LLUUID((string)reader["owner_uuid"]); | ||
358 | } | ||
359 | catch | ||
360 | { | ||
361 | retval.owner_uuid = LLUUID.Zero; | ||
362 | } | ||
363 | } | ||
364 | else | 344 | else |
365 | { | 345 | { |
366 | return null; | 346 | return null; |
@@ -387,7 +367,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
387 | retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); | 367 | retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); |
388 | retval.reservationName = (string) reader["resName"]; | 368 | retval.reservationName = (string) reader["resName"]; |
389 | retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; | 369 | retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; |
390 | retval.userUUID = new LLUUID((string) reader["userUUID"]); | 370 | LLUUID.TryParse((string) reader["userUUID"], out retval.userUUID); |
391 | } | 371 | } |
392 | else | 372 | else |
393 | { | 373 | { |
@@ -408,9 +388,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
408 | if (reader.Read()) | 388 | if (reader.Read()) |
409 | { | 389 | { |
410 | // Agent IDs | 390 | // Agent IDs |
411 | retval.UUID = new LLUUID((string) reader["UUID"]); | 391 | if (!LLUUID.TryParse((string)reader["UUID"], out retval.UUID)) |
412 | retval.sessionID = new LLUUID((string) reader["sessionID"]); | 392 | return null; |
413 | retval.secureSessionID = new LLUUID((string) reader["secureSessionID"]); | 393 | LLUUID.TryParse((string) reader["sessionID"], out retval.sessionID); |
394 | LLUUID.TryParse((string)reader["secureSessionID"], out retval.secureSessionID); | ||
414 | 395 | ||
415 | // Agent Who? | 396 | // Agent Who? |
416 | retval.agentIP = (string) reader["agentIP"]; | 397 | retval.agentIP = (string) reader["agentIP"]; |
@@ -444,7 +425,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
444 | 425 | ||
445 | if (reader.Read()) | 426 | if (reader.Read()) |
446 | { | 427 | { |
447 | retval.UUID = new LLUUID((string) reader["UUID"]); | 428 | if (!LLUUID.TryParse((string)reader["UUID"], out retval.UUID)) |
429 | return null; | ||
448 | retval.username = (string) reader["username"]; | 430 | retval.username = (string) reader["username"]; |
449 | retval.surname = (string) reader["lastname"]; | 431 | retval.surname = (string) reader["lastname"]; |
450 | 432 | ||
@@ -473,8 +455,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
473 | retval.profileAboutText = (string) reader["profileAboutText"]; | 455 | retval.profileAboutText = (string) reader["profileAboutText"]; |
474 | retval.profileFirstText = (string) reader["profileFirstText"]; | 456 | retval.profileFirstText = (string) reader["profileFirstText"]; |
475 | 457 | ||
476 | retval.profileImage = new LLUUID((string) reader["profileImage"]); | 458 | LLUUID.TryParse((string)reader["profileImage"], out retval.profileImage); |
477 | retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]); | 459 | LLUUID.TryParse((string)reader["profileFirstImage"], out retval.profileFirstImage); |
478 | 460 | ||
479 | if( reader.IsDBNull( reader.GetOrdinal( "webLoginKey" ) ) ) | 461 | if( reader.IsDBNull( reader.GetOrdinal( "webLoginKey" ) ) ) |
480 | { | 462 | { |
@@ -482,7 +464,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
482 | } | 464 | } |
483 | else | 465 | else |
484 | { | 466 | { |
485 | retval.webLoginKey = new LLUUID((string)reader["webLoginKey"]); | 467 | LLUUID.TryParse((string)reader["webLoginKey"], out retval.webLoginKey); |
486 | } | 468 | } |
487 | } | 469 | } |
488 | else | 470 | else |
@@ -605,11 +587,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
605 | parameters["?userAssetURI"] = String.Empty; | 587 | parameters["?userAssetURI"] = String.Empty; |
606 | parameters["?profileCanDoMask"] = "0"; | 588 | parameters["?profileCanDoMask"] = "0"; |
607 | parameters["?profileWantDoMask"] = "0"; | 589 | parameters["?profileWantDoMask"] = "0"; |
608 | parameters["?profileAboutText"] = String.Empty; | 590 | parameters["?profileAboutText"] = aboutText; |
609 | parameters["?profileFirstText"] = String.Empty; | 591 | parameters["?profileFirstText"] = firstText; |
610 | parameters["?profileImage"] = LLUUID.Zero.ToString(); | 592 | parameters["?profileImage"] = profileImage.ToString(); |
611 | parameters["?profileFirstImage"] = LLUUID.Zero.ToString(); | 593 | parameters["?profileFirstImage"] = firstImage.ToString(); |
612 | parameters["?webLoginKey"] = LLUUID.Random().ToString(); | 594 | parameters["?webLoginKey"] = string.Empty; |
613 | 595 | ||
614 | bool returnval = false; | 596 | bool returnval = false; |
615 | 597 | ||
diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs index fb53ac7..f9f4283 100644 --- a/OpenSim/Framework/Data/RegionProfileData.cs +++ b/OpenSim/Framework/Data/RegionProfileData.cs | |||
@@ -123,17 +123,11 @@ namespace OpenSim.Framework.Data | |||
123 | /// </summary> | 123 | /// </summary> |
124 | public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); | 124 | public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); |
125 | 125 | ||
126 | // part of an initial brutish effort to provide accurate information (as per the xml region spec) | ||
127 | // wrt the ownership of a given region | ||
128 | // the (very bad) assumption is that this value is being read and handled inconsistently or | ||
129 | // not at all. Current strategy is to put the code in place to support the validity of this information | ||
130 | // and to roll forward debugging any issues from that point | ||
131 | // | ||
132 | /// <summary> | 126 | /// <summary> |
133 | /// this particular mod to the file provides support within the spec for RegionProfileData for the | 127 | /// this particular mod to the file provides support within the spec for RegionProfileData for the |
134 | /// owner_uuid for the region | 128 | /// owner_uuid for the region |
135 | /// </summary> | 129 | /// </summary> |
136 | public LLUUID owner_uuid; | 130 | public LLUUID owner_uuid = LLUUID.Zero; |
137 | 131 | ||
138 | /// <summary> | 132 | /// <summary> |
139 | /// Get Sim profile data from grid server when in grid mode | 133 | /// Get Sim profile data from grid server when in grid mode |