diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLManager.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLManager.cs | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index 7e1b405..4b11739 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs | |||
@@ -191,6 +191,12 @@ namespace OpenSim.Data.MySQL | |||
191 | cmd.ExecuteNonQuery(); | 191 | cmd.ExecuteNonQuery(); |
192 | } | 192 | } |
193 | 193 | ||
194 | public void ExecuteSql(string sql) | ||
195 | { | ||
196 | MySqlCommand cmd = new MySqlCommand(sql, dbcon); | ||
197 | cmd.ExecuteNonQuery(); | ||
198 | } | ||
199 | |||
194 | /// <summary> | 200 | /// <summary> |
195 | /// Given a list of tables, return the version of the tables, as seen in the database | 201 | /// Given a list of tables, return the version of the tables, as seen in the database |
196 | /// </summary> | 202 | /// </summary> |
@@ -532,38 +538,42 @@ namespace OpenSim.Data.MySQL | |||
532 | 538 | ||
533 | public AvatarAppearance readAppearanceRow(IDataReader reader) | 539 | public AvatarAppearance readAppearanceRow(IDataReader reader) |
534 | { | 540 | { |
535 | AvatarAppearance appearance = new AvatarAppearance(); | 541 | AvatarAppearance appearance = null; |
536 | appearance.Owner = new LLUUID((string)reader["owner"]); | 542 | if (reader.Read()) |
537 | appearance.Serial = Convert.ToInt32(reader["serial"]); | 543 | { |
538 | appearance.VisualParams = (byte[])reader["visual_params"]; | 544 | appearance = new AvatarAppearance(); |
539 | appearance.Texture = new LLObject.TextureEntry((byte[])reader["texture"], 0, ((byte[])reader["texture"]).Length); | 545 | appearance.Owner = new LLUUID((string)reader["owner"]); |
540 | appearance.AvatarHeight = (float)Convert.ToDouble(reader["avatar_height"]); | 546 | appearance.Serial = Convert.ToInt32(reader["serial"]); |
541 | appearance.BodyItem = new LLUUID((string)reader["body_item"]); | 547 | appearance.VisualParams = (byte[])reader["visual_params"]; |
542 | appearance.BodyAsset = new LLUUID((string)reader["body_asset"]); | 548 | appearance.Texture = new LLObject.TextureEntry((byte[])reader["texture"], 0, ((byte[])reader["texture"]).Length); |
543 | appearance.SkinItem = new LLUUID((string)reader["skin_item"]); | 549 | appearance.AvatarHeight = (float)Convert.ToDouble(reader["avatar_height"]); |
544 | appearance.SkinAsset = new LLUUID((string)reader["skin_asset"]); | 550 | appearance.BodyItem = new LLUUID((string)reader["body_item"]); |
545 | appearance.HairItem = new LLUUID((string)reader["hair_item"]); | 551 | appearance.BodyAsset = new LLUUID((string)reader["body_asset"]); |
546 | appearance.HairAsset = new LLUUID((string)reader["hair_asset"]); | 552 | appearance.SkinItem = new LLUUID((string)reader["skin_item"]); |
547 | appearance.EyesItem = new LLUUID((string)reader["eyes_item"]); | 553 | appearance.SkinAsset = new LLUUID((string)reader["skin_asset"]); |
548 | appearance.EyesAsset = new LLUUID((string)reader["eyes_asset"]); | 554 | appearance.HairItem = new LLUUID((string)reader["hair_item"]); |
549 | appearance.ShirtItem = new LLUUID((string)reader["shirt_item"]); | 555 | appearance.HairAsset = new LLUUID((string)reader["hair_asset"]); |
550 | appearance.ShirtAsset = new LLUUID((string)reader["shirt_asset"]); | 556 | appearance.EyesItem = new LLUUID((string)reader["eyes_item"]); |
551 | appearance.PantsItem = new LLUUID((string)reader["pants_item"]); | 557 | appearance.EyesAsset = new LLUUID((string)reader["eyes_asset"]); |
552 | appearance.PantsAsset = new LLUUID((string)reader["pants_asset"]); | 558 | appearance.ShirtItem = new LLUUID((string)reader["shirt_item"]); |
553 | appearance.ShoesItem = new LLUUID((string)reader["shoes_item"]); | 559 | appearance.ShirtAsset = new LLUUID((string)reader["shirt_asset"]); |
554 | appearance.ShoesAsset = new LLUUID((string)reader["shoes_asset"]); | 560 | appearance.PantsItem = new LLUUID((string)reader["pants_item"]); |
555 | appearance.SocksItem = new LLUUID((string)reader["socks_item"]); | 561 | appearance.PantsAsset = new LLUUID((string)reader["pants_asset"]); |
556 | appearance.SocksAsset = new LLUUID((string)reader["socks_asset"]); | 562 | appearance.ShoesItem = new LLUUID((string)reader["shoes_item"]); |
557 | appearance.JacketItem = new LLUUID((string)reader["jacket_item"]); | 563 | appearance.ShoesAsset = new LLUUID((string)reader["shoes_asset"]); |
558 | appearance.JacketAsset = new LLUUID((string)reader["jacket_asset"]); | 564 | appearance.SocksItem = new LLUUID((string)reader["socks_item"]); |
559 | appearance.GlovesItem = new LLUUID((string)reader["gloves_item"]); | 565 | appearance.SocksAsset = new LLUUID((string)reader["socks_asset"]); |
560 | appearance.GlovesAsset = new LLUUID((string)reader["gloves_asset"]); | 566 | appearance.JacketItem = new LLUUID((string)reader["jacket_item"]); |
561 | appearance.UnderShirtItem = new LLUUID((string)reader["undershirt_item"]); | 567 | appearance.JacketAsset = new LLUUID((string)reader["jacket_asset"]); |
562 | appearance.UnderShirtAsset = new LLUUID((string)reader["undershirt_asset"]); | 568 | appearance.GlovesItem = new LLUUID((string)reader["gloves_item"]); |
563 | appearance.UnderPantsItem = new LLUUID((string)reader["underpants_item"]); | 569 | appearance.GlovesAsset = new LLUUID((string)reader["gloves_asset"]); |
564 | appearance.UnderPantsAsset = new LLUUID((string)reader["underpants_asset"]); | 570 | appearance.UnderShirtItem = new LLUUID((string)reader["undershirt_item"]); |
565 | appearance.SkirtItem = new LLUUID((string)reader["skirt_item"]); | 571 | appearance.UnderShirtAsset = new LLUUID((string)reader["undershirt_asset"]); |
566 | appearance.SkirtAsset = new LLUUID((string)reader["skirt_asset"]); | 572 | appearance.UnderPantsItem = new LLUUID((string)reader["underpants_item"]); |
573 | appearance.UnderPantsAsset = new LLUUID((string)reader["underpants_asset"]); | ||
574 | appearance.SkirtItem = new LLUUID((string)reader["skirt_item"]); | ||
575 | appearance.SkirtAsset = new LLUUID((string)reader["skirt_asset"]); | ||
576 | } | ||
567 | return appearance; | 577 | return appearance; |
568 | } | 578 | } |
569 | 579 | ||
@@ -1007,10 +1017,10 @@ namespace OpenSim.Data.MySQL | |||
1007 | MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand(); | 1017 | MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand(); |
1008 | cmd.CommandText = sql; | 1018 | cmd.CommandText = sql; |
1009 | cmd.Parameters.AddWithValue("?owner", appearance.Owner.ToString()); | 1019 | cmd.Parameters.AddWithValue("?owner", appearance.Owner.ToString()); |
1010 | cmd.Parameters.AddWithValue("?serial", appearance.Serial.ToString()); | 1020 | cmd.Parameters.AddWithValue("?serial", appearance.Serial); |
1011 | cmd.Parameters.AddWithValue("?visual_params", appearance.VisualParams); | 1021 | cmd.Parameters.AddWithValue("?visual_params", appearance.VisualParams); |
1012 | cmd.Parameters.AddWithValue("?texture", appearance.Texture.ToBytes()); | 1022 | cmd.Parameters.AddWithValue("?texture", appearance.Texture.ToBytes()); |
1013 | cmd.Parameters.AddWithValue("?avatar_height", appearance.AvatarHeight.ToString()); | 1023 | cmd.Parameters.AddWithValue("?avatar_height", appearance.AvatarHeight); |
1014 | cmd.Parameters.AddWithValue("?body_item", appearance.BodyItem.ToString()); | 1024 | cmd.Parameters.AddWithValue("?body_item", appearance.BodyItem.ToString()); |
1015 | cmd.Parameters.AddWithValue("?body_asset", appearance.BodyAsset.ToString()); | 1025 | cmd.Parameters.AddWithValue("?body_asset", appearance.BodyAsset.ToString()); |
1016 | cmd.Parameters.AddWithValue("?skin_item", appearance.SkinItem.ToString()); | 1026 | cmd.Parameters.AddWithValue("?skin_item", appearance.SkinItem.ToString()); |
@@ -1037,12 +1047,10 @@ namespace OpenSim.Data.MySQL | |||
1037 | cmd.Parameters.AddWithValue("?underpants_asset", appearance.UnderPantsAsset.ToString()); | 1047 | cmd.Parameters.AddWithValue("?underpants_asset", appearance.UnderPantsAsset.ToString()); |
1038 | cmd.Parameters.AddWithValue("?skirt_item", appearance.SkirtItem.ToString()); | 1048 | cmd.Parameters.AddWithValue("?skirt_item", appearance.SkirtItem.ToString()); |
1039 | cmd.Parameters.AddWithValue("?skirt_asset", appearance.SkirtAsset.ToString()); | 1049 | cmd.Parameters.AddWithValue("?skirt_asset", appearance.SkirtAsset.ToString()); |
1040 | 1050 | ||
1041 | int x; | 1051 | if (cmd.ExecuteNonQuery() > 0) |
1042 | if ((x = cmd.ExecuteNonQuery()) > 0) | ||
1043 | { | ||
1044 | returnval = true; | 1052 | returnval = true; |
1045 | } | 1053 | |
1046 | cmd.Dispose(); | 1054 | cmd.Dispose(); |
1047 | } | 1055 | } |
1048 | catch (Exception e) | 1056 | catch (Exception e) |