aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLManager.cs
diff options
context:
space:
mode:
authorSean Dague2008-05-21 14:34:52 +0000
committerSean Dague2008-05-21 14:34:52 +0000
commit0e39250506f3dd3f2f66dfc87a808ea8eb5867ba (patch)
tree61dd302d93b94cb1a1ae399d211699b207559afa /OpenSim/Data/MySQL/MySQLManager.cs
parent* Fixed needing to alter your sculptie sometimes to get physics to generate a... (diff)
downloadopensim-SC-0e39250506f3dd3f2f66dfc87a808ea8eb5867ba.zip
opensim-SC-0e39250506f3dd3f2f66dfc87a808ea8eb5867ba.tar.gz
opensim-SC-0e39250506f3dd3f2f66dfc87a808ea8eb5867ba.tar.bz2
opensim-SC-0e39250506f3dd3f2f66dfc87a808ea8eb5867ba.tar.xz
create some direct sql calls for appearance
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLManager.cs109
1 files changed, 109 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs
index f7baadc..7e1b405 100644
--- a/OpenSim/Data/MySQL/MySQLManager.cs
+++ b/OpenSim/Data/MySQL/MySQLManager.cs
@@ -530,6 +530,44 @@ namespace OpenSim.Data.MySQL
530 return retval; 530 return retval;
531 } 531 }
532 532
533 public AvatarAppearance readAppearanceRow(IDataReader reader)
534 {
535 AvatarAppearance appearance = new AvatarAppearance();
536 appearance.Owner = new LLUUID((string)reader["owner"]);
537 appearance.Serial = Convert.ToInt32(reader["serial"]);
538 appearance.VisualParams = (byte[])reader["visual_params"];
539 appearance.Texture = new LLObject.TextureEntry((byte[])reader["texture"], 0, ((byte[])reader["texture"]).Length);
540 appearance.AvatarHeight = (float)Convert.ToDouble(reader["avatar_height"]);
541 appearance.BodyItem = new LLUUID((string)reader["body_item"]);
542 appearance.BodyAsset = new LLUUID((string)reader["body_asset"]);
543 appearance.SkinItem = new LLUUID((string)reader["skin_item"]);
544 appearance.SkinAsset = new LLUUID((string)reader["skin_asset"]);
545 appearance.HairItem = new LLUUID((string)reader["hair_item"]);
546 appearance.HairAsset = new LLUUID((string)reader["hair_asset"]);
547 appearance.EyesItem = new LLUUID((string)reader["eyes_item"]);
548 appearance.EyesAsset = new LLUUID((string)reader["eyes_asset"]);
549 appearance.ShirtItem = new LLUUID((string)reader["shirt_item"]);
550 appearance.ShirtAsset = new LLUUID((string)reader["shirt_asset"]);
551 appearance.PantsItem = new LLUUID((string)reader["pants_item"]);
552 appearance.PantsAsset = new LLUUID((string)reader["pants_asset"]);
553 appearance.ShoesItem = new LLUUID((string)reader["shoes_item"]);
554 appearance.ShoesAsset = new LLUUID((string)reader["shoes_asset"]);
555 appearance.SocksItem = new LLUUID((string)reader["socks_item"]);
556 appearance.SocksAsset = new LLUUID((string)reader["socks_asset"]);
557 appearance.JacketItem = new LLUUID((string)reader["jacket_item"]);
558 appearance.JacketAsset = new LLUUID((string)reader["jacket_asset"]);
559 appearance.GlovesItem = new LLUUID((string)reader["gloves_item"]);
560 appearance.GlovesAsset = new LLUUID((string)reader["gloves_asset"]);
561 appearance.UnderShirtItem = new LLUUID((string)reader["undershirt_item"]);
562 appearance.UnderShirtAsset = new LLUUID((string)reader["undershirt_asset"]);
563 appearance.UnderPantsItem = new LLUUID((string)reader["underpants_item"]);
564 appearance.UnderPantsAsset = new LLUUID((string)reader["underpants_asset"]);
565 appearance.SkirtItem = new LLUUID((string)reader["skirt_item"]);
566 appearance.SkirtAsset = new LLUUID((string)reader["skirt_asset"]);
567 return appearance;
568 }
569
570
533 /// <summary> 571 /// <summary>
534 /// Inserts a new row into the log database 572 /// Inserts a new row into the log database
535 /// </summary> 573 /// </summary>
@@ -946,5 +984,76 @@ namespace OpenSim.Data.MySQL
946 984
947 return returnval; 985 return returnval;
948 } 986 }
987
988 public bool insertAppearanceRow(AvatarAppearance appearance)
989 {
990 string sql = String.Empty;
991 sql += "REPLACE INTO ";
992 sql += "avatarappearance (owner, serial, visual_params, texture, avatar_height, ";
993 sql += "body_item, body_asset, skin_item, skin_asset, hair_item, hair_asset, eyes_item, eyes_asset, ";
994 sql += "shirt_item, shirt_asset, pants_item, pants_asset, shoes_item, shoes_asset, socks_item, socks_asset, ";
995 sql += "jacket_item, jacket_asset, gloves_item, gloves_asset, undershirt_item, undershirt_asset, underpants_item, underpants_asset, ";
996 sql += "skirt_item, skirt_asset) values (";
997 sql += "?owner, ?serial, ?visual_params, ?texture, ?avatar_height, ";
998 sql += "?body_item, ?body_asset, ?skin_item, ?skin_asset, ?hair_item, ?hair_asset, ?eyes_item, ?eyes_asset, ";
999 sql += "?shirt_item, ?shirt_asset, ?pants_item, ?pants_asset, ?shoes_item, ?shoes_asset, ?socks_item, ?socks_asset, ";
1000 sql += "?jacket_item, ?jacket_asset, ?gloves_item, ?gloves_asset, ?undershirt_item, ?undershirt_asset, ?underpants_item, ?underpants_asset, ";
1001 sql += "?skirt_item, ?skirt_asset)";
1002
1003 bool returnval = false;
1004
1005 // we want to send in byte data, which means we can't just pass down strings
1006 try {
1007 MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand();
1008 cmd.CommandText = sql;
1009 cmd.Parameters.AddWithValue("?owner", appearance.Owner.ToString());
1010 cmd.Parameters.AddWithValue("?serial", appearance.Serial.ToString());
1011 cmd.Parameters.AddWithValue("?visual_params", appearance.VisualParams);
1012 cmd.Parameters.AddWithValue("?texture", appearance.Texture.ToBytes());
1013 cmd.Parameters.AddWithValue("?avatar_height", appearance.AvatarHeight.ToString());
1014 cmd.Parameters.AddWithValue("?body_item", appearance.BodyItem.ToString());
1015 cmd.Parameters.AddWithValue("?body_asset", appearance.BodyAsset.ToString());
1016 cmd.Parameters.AddWithValue("?skin_item", appearance.SkinItem.ToString());
1017 cmd.Parameters.AddWithValue("?skin_asset", appearance.SkinAsset.ToString());
1018 cmd.Parameters.AddWithValue("?hair_item", appearance.HairItem.ToString());
1019 cmd.Parameters.AddWithValue("?hair_asset", appearance.HairAsset.ToString());
1020 cmd.Parameters.AddWithValue("?eyes_item", appearance.EyesItem.ToString());
1021 cmd.Parameters.AddWithValue("?eyes_asset", appearance.EyesAsset.ToString());
1022 cmd.Parameters.AddWithValue("?shirt_item", appearance.ShirtItem.ToString());
1023 cmd.Parameters.AddWithValue("?shirt_asset", appearance.ShirtAsset.ToString());
1024 cmd.Parameters.AddWithValue("?pants_item", appearance.PantsItem.ToString());
1025 cmd.Parameters.AddWithValue("?pants_asset", appearance.PantsAsset.ToString());
1026 cmd.Parameters.AddWithValue("?shoes_item", appearance.ShoesItem.ToString());
1027 cmd.Parameters.AddWithValue("?shoes_asset", appearance.ShoesAsset.ToString());
1028 cmd.Parameters.AddWithValue("?socks_item", appearance.SocksItem.ToString());
1029 cmd.Parameters.AddWithValue("?socks_asset", appearance.SocksAsset.ToString());
1030 cmd.Parameters.AddWithValue("?jacket_item", appearance.JacketItem.ToString());
1031 cmd.Parameters.AddWithValue("?jacket_asset", appearance.JacketAsset.ToString());
1032 cmd.Parameters.AddWithValue("?gloves_item", appearance.GlovesItem.ToString());
1033 cmd.Parameters.AddWithValue("?gloves_asset", appearance.GlovesAsset.ToString());
1034 cmd.Parameters.AddWithValue("?undershirt_item", appearance.UnderShirtItem.ToString());
1035 cmd.Parameters.AddWithValue("?undershirt_asset", appearance.UnderShirtAsset.ToString());
1036 cmd.Parameters.AddWithValue("?underpants_item", appearance.UnderPantsItem.ToString());
1037 cmd.Parameters.AddWithValue("?underpants_asset", appearance.UnderPantsAsset.ToString());
1038 cmd.Parameters.AddWithValue("?skirt_item", appearance.SkirtItem.ToString());
1039 cmd.Parameters.AddWithValue("?skirt_asset", appearance.SkirtAsset.ToString());
1040
1041 int x;
1042 if ((x = cmd.ExecuteNonQuery()) > 0)
1043 {
1044 returnval = true;
1045 }
1046 cmd.Dispose();
1047 }
1048 catch (Exception e)
1049 {
1050 m_log.Error(e.ToString());
1051 return false;
1052 }
1053
1054 return returnval;
1055
1056 }
1057
949 } 1058 }
950} 1059}