aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteUserData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteUserData.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs33
1 files changed, 20 insertions, 13 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index caddcf8..ea755b0 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Data.SqliteClient; 33using Mono.Data.Sqlite;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36 36
@@ -115,15 +115,19 @@ namespace OpenSim.Data.SQLite
115 115
116 setupUserCommands(da, conn); 116 setupUserCommands(da, conn);
117 da.Fill(ds.Tables["users"]); 117 da.Fill(ds.Tables["users"]);
118 CreateDataSetMapping(da, "users");
118 119
119 setupAgentCommands(dua, conn); 120 setupAgentCommands(dua, conn);
120 dua.Fill(ds.Tables["useragents"]); 121 dua.Fill(ds.Tables["useragents"]);
122 CreateDataSetMapping(dua, "useragents");
121 123
122 setupUserFriendsCommands(daf, conn); 124 setupUserFriendsCommands(daf, conn);
123 daf.Fill(ds.Tables["userfriends"]); 125 daf.Fill(ds.Tables["userfriends"]);
126 CreateDataSetMapping(daf, "userfriends");
124 127
125 setupAvatarAppearanceCommands(daa, conn); 128 setupAvatarAppearanceCommands(daa, conn);
126 daa.Fill(ds.Tables["avatarappearance"]); 129 daa.Fill(ds.Tables["avatarappearance"]);
130 CreateDataSetMapping(daa, "avatarappearance");
127 } 131 }
128 132
129 return; 133 return;
@@ -706,15 +710,10 @@ namespace OpenSim.Data.SQLite
706 aa.SkirtItem = new UUID((String)row["SkirtItem"]); 710 aa.SkirtItem = new UUID((String)row["SkirtItem"]);
707 aa.SkirtAsset = new UUID((String)row["SkirtAsset"]); 711 aa.SkirtAsset = new UUID((String)row["SkirtAsset"]);
708 712
709 // Ewe Loon 713 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); 714 aa.Texture = new Primitive.TextureEntry(texture, 0, texture.Length);
715 715
716 str = (String)row["VisualParams"]; 716 byte[] VisualParams = (byte[])row["VisualParams"];
717 byte[] VisualParams = Convert.FromBase64String(str);
718 aa.VisualParams = VisualParams; 717 aa.VisualParams = VisualParams;
719 718
720 aa.Serial = Convert.ToInt32(row["Serial"]); 719 aa.Serial = Convert.ToInt32(row["Serial"]);
@@ -793,6 +792,15 @@ namespace OpenSim.Data.SQLite
793 * 792 *
794 **********************************************************************/ 793 **********************************************************************/
795 794
795 protected void CreateDataSetMapping(IDataAdapter da, string tableName)
796 {
797 ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
798 foreach (DataColumn col in ds.Tables[tableName].Columns)
799 {
800 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
801 }
802 }
803
796 /// <summary> 804 /// <summary>
797 /// Create the "users" table 805 /// Create the "users" table
798 /// </summary> 806 /// </summary>
@@ -924,9 +932,8 @@ namespace OpenSim.Data.SQLite
924 SQLiteUtil.createCol(aa, "SkirtItem", typeof(String)); 932 SQLiteUtil.createCol(aa, "SkirtItem", typeof(String));
925 SQLiteUtil.createCol(aa, "SkirtAsset", typeof(String)); 933 SQLiteUtil.createCol(aa, "SkirtAsset", typeof(String));
926 934
927 // Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) 935 SQLiteUtil.createCol(aa, "Texture", typeof (Byte[]));
928 SQLiteUtil.createCol(aa, "Texture", typeof (String)); 936 SQLiteUtil.createCol(aa, "VisualParams", typeof (Byte[]));
929 SQLiteUtil.createCol(aa, "VisualParams", typeof (String));
930 937
931 SQLiteUtil.createCol(aa, "Serial", typeof(Int32)); 938 SQLiteUtil.createCol(aa, "Serial", typeof(Int32));
932 SQLiteUtil.createCol(aa, "AvatarHeight", typeof(Double)); 939 SQLiteUtil.createCol(aa, "AvatarHeight", typeof(Double));
@@ -1090,8 +1097,8 @@ namespace OpenSim.Data.SQLite
1090 row["SkirtAsset"] = appearance.SkirtAsset.ToString(); 1097 row["SkirtAsset"] = appearance.SkirtAsset.ToString();
1091 1098
1092 // Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) 1099 // Used Base64String because for some reason it wont accept using Byte[] (which works in Region date)
1093 row["Texture"] = Convert.ToBase64String(appearance.Texture.GetBytes()); 1100 row["Texture"] = appearance.Texture.GetBytes();
1094 row["VisualParams"] = Convert.ToBase64String(appearance.VisualParams); 1101 row["VisualParams"] = appearance.VisualParams;
1095 1102
1096 row["Serial"] = appearance.Serial; 1103 row["Serial"] = appearance.Serial;
1097 row["AvatarHeight"] = appearance.AvatarHeight; 1104 row["AvatarHeight"] = appearance.AvatarHeight;