diff options
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserData.cs | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index 12db403..bffc0d0 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs | |||
@@ -108,22 +108,32 @@ namespace OpenSim.Data.SQLite | |||
108 | 108 | ||
109 | lock (ds) | 109 | lock (ds) |
110 | { | 110 | { |
111 | Console.WriteLine("Here1"); | ||
111 | ds.Tables.Add(createUsersTable()); | 112 | ds.Tables.Add(createUsersTable()); |
112 | ds.Tables.Add(createUserAgentsTable()); | 113 | ds.Tables.Add(createUserAgentsTable()); |
113 | ds.Tables.Add(createUserFriendsTable()); | 114 | ds.Tables.Add(createUserFriendsTable()); |
114 | ds.Tables.Add(createAvatarAppearanceTable()); | 115 | ds.Tables.Add(createAvatarAppearanceTable()); |
115 | 116 | ||
117 | Console.WriteLine("Here2"); | ||
116 | setupUserCommands(da, conn); | 118 | setupUserCommands(da, conn); |
117 | da.Fill(ds.Tables["users"]); | 119 | da.Fill(ds.Tables["users"]); |
120 | CreateDataSetMapping(da, "users"); | ||
118 | 121 | ||
122 | Console.WriteLine("Here3"); | ||
119 | setupAgentCommands(dua, conn); | 123 | setupAgentCommands(dua, conn); |
120 | dua.Fill(ds.Tables["useragents"]); | 124 | dua.Fill(ds.Tables["useragents"]); |
125 | CreateDataSetMapping(dua, "useragents"); | ||
121 | 126 | ||
127 | Console.WriteLine("Here4"); | ||
122 | setupUserFriendsCommands(daf, conn); | 128 | setupUserFriendsCommands(daf, conn); |
123 | daf.Fill(ds.Tables["userfriends"]); | 129 | daf.Fill(ds.Tables["userfriends"]); |
130 | CreateDataSetMapping(daf, "userfriends"); | ||
124 | 131 | ||
132 | Console.WriteLine("Here5"); | ||
125 | setupAvatarAppearanceCommands(daa, conn); | 133 | setupAvatarAppearanceCommands(daa, conn); |
126 | daa.Fill(ds.Tables["avatarappearance"]); | 134 | daa.Fill(ds.Tables["avatarappearance"]); |
135 | CreateDataSetMapping(daa, "avatarappearance"); | ||
136 | Console.WriteLine("Here6"); | ||
127 | } | 137 | } |
128 | 138 | ||
129 | return; | 139 | return; |
@@ -706,15 +716,10 @@ namespace OpenSim.Data.SQLite | |||
706 | aa.SkirtItem = new UUID((String)row["SkirtItem"]); | 716 | aa.SkirtItem = new UUID((String)row["SkirtItem"]); |
707 | aa.SkirtAsset = new UUID((String)row["SkirtAsset"]); | 717 | aa.SkirtAsset = new UUID((String)row["SkirtAsset"]); |
708 | 718 | ||
709 | // Ewe Loon | 719 | byte[] texture = (byte[])row["Texture"]; |
710 | // Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) | ||
711 | |||
712 | String str = (String)row["Texture"]; | ||
713 | byte[] texture = Convert.FromBase64String(str); | ||
714 | aa.Texture = new Primitive.TextureEntry(texture, 0, texture.Length); | 720 | aa.Texture = new Primitive.TextureEntry(texture, 0, texture.Length); |
715 | 721 | ||
716 | str = (String)row["VisualParams"]; | 722 | byte[] VisualParams = (byte[])row["VisualParams"]; |
717 | byte[] VisualParams = Convert.FromBase64String(str); | ||
718 | aa.VisualParams = VisualParams; | 723 | aa.VisualParams = VisualParams; |
719 | 724 | ||
720 | aa.Serial = Convert.ToInt32(row["Serial"]); | 725 | aa.Serial = Convert.ToInt32(row["Serial"]); |
@@ -793,6 +798,15 @@ namespace OpenSim.Data.SQLite | |||
793 | * | 798 | * |
794 | **********************************************************************/ | 799 | **********************************************************************/ |
795 | 800 | ||
801 | protected void CreateDataSetMapping(IDataAdapter da, string tableName) | ||
802 | { | ||
803 | ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); | ||
804 | foreach (DataColumn col in ds.Tables[tableName].Columns) | ||
805 | { | ||
806 | dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); | ||
807 | } | ||
808 | } | ||
809 | |||
796 | /// <summary> | 810 | /// <summary> |
797 | /// Create the "users" table | 811 | /// Create the "users" table |
798 | /// </summary> | 812 | /// </summary> |
@@ -924,9 +938,8 @@ namespace OpenSim.Data.SQLite | |||
924 | SQLiteUtil.createCol(aa, "SkirtItem", typeof(String)); | 938 | SQLiteUtil.createCol(aa, "SkirtItem", typeof(String)); |
925 | SQLiteUtil.createCol(aa, "SkirtAsset", typeof(String)); | 939 | SQLiteUtil.createCol(aa, "SkirtAsset", typeof(String)); |
926 | 940 | ||
927 | // Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) | 941 | SQLiteUtil.createCol(aa, "Texture", typeof (Byte[])); |
928 | SQLiteUtil.createCol(aa, "Texture", typeof (String)); | 942 | SQLiteUtil.createCol(aa, "VisualParams", typeof (Byte[])); |
929 | SQLiteUtil.createCol(aa, "VisualParams", typeof (String)); | ||
930 | 943 | ||
931 | SQLiteUtil.createCol(aa, "Serial", typeof(Int32)); | 944 | SQLiteUtil.createCol(aa, "Serial", typeof(Int32)); |
932 | SQLiteUtil.createCol(aa, "AvatarHeight", typeof(Double)); | 945 | SQLiteUtil.createCol(aa, "AvatarHeight", typeof(Double)); |
@@ -1090,8 +1103,8 @@ namespace OpenSim.Data.SQLite | |||
1090 | row["SkirtAsset"] = appearance.SkirtAsset.ToString(); | 1103 | row["SkirtAsset"] = appearance.SkirtAsset.ToString(); |
1091 | 1104 | ||
1092 | // Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) | 1105 | // Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) |
1093 | row["Texture"] = Convert.ToBase64String(appearance.Texture.GetBytes()); | 1106 | row["Texture"] = appearance.Texture.GetBytes(); |
1094 | row["VisualParams"] = Convert.ToBase64String(appearance.VisualParams); | 1107 | row["VisualParams"] = appearance.VisualParams; |
1095 | 1108 | ||
1096 | row["Serial"] = appearance.Serial; | 1109 | row["Serial"] = appearance.Serial; |
1097 | row["AvatarHeight"] = appearance.AvatarHeight; | 1110 | row["AvatarHeight"] = appearance.AvatarHeight; |