diff options
author | Justin Clark-Casey (justincc) | 2010-04-30 21:37:31 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-04-30 21:37:31 +0100 |
commit | 8966ed9c82c8199bf0da61815d04d485d67aa34a (patch) | |
tree | 9e23144ffa4f38a2608572d731c40d72e44108b2 /OpenSim | |
parent | Fix a bunch of issues that crop up after the naive porting of the new sqlite ... (diff) | |
download | opensim-SC-8966ed9c82c8199bf0da61815d04d485d67aa34a.zip opensim-SC-8966ed9c82c8199bf0da61815d04d485d67aa34a.tar.gz opensim-SC-8966ed9c82c8199bf0da61815d04d485d67aa34a.tar.bz2 opensim-SC-8966ed9c82c8199bf0da61815d04d485d67aa34a.tar.xz |
fix an issue with user appearance where the new sqlite db adapter expects directly specification of byte[] type rather than base64 strings
Diffstat (limited to '')
8 files changed, 25 insertions, 81 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; |
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql deleted file mode 100644 index 468567d..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE auth ( | ||
4 | UUID char(36) NOT NULL, | ||
5 | passwordHash char(32) NOT NULL default '', | ||
6 | passwordSalt char(32) NOT NULL default '', | ||
7 | webLoginKey varchar(255) NOT NULL default '', | ||
8 | accountType VARCHAR(32) NOT NULL DEFAULT 'UserAccount', | ||
9 | PRIMARY KEY (`UUID`) | ||
10 | ); | ||
11 | |||
12 | CREATE TABLE tokens ( | ||
13 | UUID char(36) NOT NULL, | ||
14 | token varchar(255) NOT NULL, | ||
15 | validity datetime NOT NULL | ||
16 | ); | ||
17 | |||
18 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql deleted file mode 100644 index 7ec906b..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE Avatars ( | ||
4 | PrincipalID CHAR(36) NOT NULL, | ||
5 | Name VARCHAR(32) NOT NULL, | ||
6 | Value VARCHAR(255) NOT NULL DEFAULT '', | ||
7 | PRIMARY KEY(PrincipalID, Name)); | ||
8 | |||
9 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql deleted file mode 100644 index f1b9ab9..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE `Friends` ( | ||
4 | `PrincipalID` CHAR(36) NOT NULL, | ||
5 | `Friend` VARCHAR(255) NOT NULL, | ||
6 | `Flags` VARCHAR(16) NOT NULL DEFAULT 0, | ||
7 | `Offered` VARCHAR(32) NOT NULL DEFAULT 0, | ||
8 | PRIMARY KEY(`PrincipalID`, `Friend`)); | ||
9 | |||
10 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql deleted file mode 100644 index c38d9a7..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | -- useraccounts table | ||
4 | CREATE TABLE UserAccounts ( | ||
5 | PrincipalID CHAR(36) primary key, | ||
6 | ScopeID CHAR(36) NOT NULL, | ||
7 | FirstName VARCHAR(64) NOT NULL, | ||
8 | LastName VARCHAR(64) NOT NULL, | ||
9 | Email VARCHAR(64), | ||
10 | ServiceURLs TEXT, | ||
11 | Created INT(11), | ||
12 | UserLevel integer NOT NULL DEFAULT 0, | ||
13 | UserFlags integer NOT NULL DEFAULT 0, | ||
14 | UserTitle varchar(64) NOT NULL DEFAULT '' | ||
15 | ); | ||
16 | |||
17 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql deleted file mode 100644 index 3237b68..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey) SELECT `UUID` AS UUID, `passwordHash` AS passwordHash, `passwordSalt` AS passwordSalt, `webLoginKey` AS webLoginKey FROM users; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql deleted file mode 100644 index 6733502..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | INSERT INTO `Friends` SELECT `ownerID`, `friendID`, `friendPerms`, 0 FROM `userfriends`; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql deleted file mode 100644 index c7a6293..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, surname AS LastName, '' as Email, '' AS ServiceURLs, created as Created FROM users; | ||
4 | |||
5 | COMMIT; | ||