fix an issue with user appearance where the new sqlite db adapter expects directly specification of byte[] type rather than base64 strings
							parent
							
								
									0b8b302aa0
								
							
						
					
					
						commit
						8966ed9c82
					
				|  | @ -108,22 +108,32 @@ namespace OpenSim.Data.SQLite | |||
| 
 | ||||
|             lock (ds) | ||||
|             { | ||||
|                 Console.WriteLine("Here1"); | ||||
|                 ds.Tables.Add(createUsersTable()); | ||||
|                 ds.Tables.Add(createUserAgentsTable()); | ||||
|                 ds.Tables.Add(createUserFriendsTable()); | ||||
|                 ds.Tables.Add(createAvatarAppearanceTable()); | ||||
| 
 | ||||
|                 Console.WriteLine("Here2"); | ||||
|                 setupUserCommands(da, conn); | ||||
|                 da.Fill(ds.Tables["users"]); | ||||
|                 CreateDataSetMapping(da, "users"); | ||||
| 
 | ||||
|                 Console.WriteLine("Here3"); | ||||
|                 setupAgentCommands(dua, conn); | ||||
|                 dua.Fill(ds.Tables["useragents"]); | ||||
|                 CreateDataSetMapping(dua, "useragents"); | ||||
| 
 | ||||
|                 Console.WriteLine("Here4"); | ||||
|                 setupUserFriendsCommands(daf, conn); | ||||
|                 daf.Fill(ds.Tables["userfriends"]); | ||||
|                 CreateDataSetMapping(daf, "userfriends"); | ||||
| 
 | ||||
|                 Console.WriteLine("Here5"); | ||||
|                 setupAvatarAppearanceCommands(daa, conn); | ||||
|                 daa.Fill(ds.Tables["avatarappearance"]); | ||||
|                 CreateDataSetMapping(daa, "avatarappearance"); | ||||
|                 Console.WriteLine("Here6"); | ||||
|             } | ||||
| 
 | ||||
|             return; | ||||
|  | @ -706,15 +716,10 @@ namespace OpenSim.Data.SQLite | |||
|                     aa.SkirtItem        = new UUID((String)row["SkirtItem"]); | ||||
|                     aa.SkirtAsset       = new UUID((String)row["SkirtAsset"]); | ||||
| 
 | ||||
|                     // Ewe Loon | ||||
|                     //  Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) | ||||
| 
 | ||||
|                     String str = (String)row["Texture"]; | ||||
|                     byte[] texture = Convert.FromBase64String(str); | ||||
|                     byte[] texture = (byte[])row["Texture"]; | ||||
|                     aa.Texture = new Primitive.TextureEntry(texture, 0, texture.Length); | ||||
| 
 | ||||
|                     str = (String)row["VisualParams"]; | ||||
|                     byte[] VisualParams = Convert.FromBase64String(str); | ||||
|                     byte[] VisualParams = (byte[])row["VisualParams"]; | ||||
|                     aa.VisualParams = VisualParams; | ||||
| 
 | ||||
|                     aa.Serial = Convert.ToInt32(row["Serial"]); | ||||
|  | @ -793,6 +798,15 @@ namespace OpenSim.Data.SQLite | |||
|          * | ||||
|          **********************************************************************/ | ||||
| 
 | ||||
|         protected void CreateDataSetMapping(IDataAdapter da, string tableName) | ||||
|         {        | ||||
|             ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); | ||||
|             foreach (DataColumn col in ds.Tables[tableName].Columns) | ||||
|             {        | ||||
|                 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); | ||||
|             }        | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// Create the "users" table | ||||
|         /// </summary> | ||||
|  | @ -924,9 +938,8 @@ namespace OpenSim.Data.SQLite | |||
|             SQLiteUtil.createCol(aa, "SkirtItem", typeof(String)); | ||||
|             SQLiteUtil.createCol(aa, "SkirtAsset", typeof(String)); | ||||
| 
 | ||||
|             //  Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) | ||||
|             SQLiteUtil.createCol(aa, "Texture", typeof (String)); | ||||
|             SQLiteUtil.createCol(aa, "VisualParams", typeof (String)); | ||||
|             SQLiteUtil.createCol(aa, "Texture", typeof (Byte[])); | ||||
|             SQLiteUtil.createCol(aa, "VisualParams", typeof (Byte[])); | ||||
| 
 | ||||
|             SQLiteUtil.createCol(aa, "Serial", typeof(Int32)); | ||||
|             SQLiteUtil.createCol(aa, "AvatarHeight", typeof(Double)); | ||||
|  | @ -1090,8 +1103,8 @@ namespace OpenSim.Data.SQLite | |||
|             row["SkirtAsset"] = appearance.SkirtAsset.ToString(); | ||||
| 
 | ||||
|             //  Used Base64String because for some reason it wont accept using Byte[] (which works in Region date) | ||||
|             row["Texture"] = Convert.ToBase64String(appearance.Texture.GetBytes()); | ||||
|             row["VisualParams"] = Convert.ToBase64String(appearance.VisualParams); | ||||
|             row["Texture"] = appearance.Texture.GetBytes(); | ||||
|             row["VisualParams"] = appearance.VisualParams; | ||||
| 
 | ||||
|             row["Serial"] = appearance.Serial; | ||||
|             row["AvatarHeight"] = appearance.AvatarHeight; | ||||
|  |  | |||
|  | @ -1,18 +0,0 @@ | |||
| BEGIN TRANSACTION; | ||||
| 
 | ||||
| CREATE TABLE auth ( | ||||
|   UUID char(36) NOT NULL, | ||||
|   passwordHash char(32) NOT NULL default '', | ||||
|   passwordSalt char(32) NOT NULL default '', | ||||
|   webLoginKey varchar(255) NOT NULL default '', | ||||
|   accountType VARCHAR(32) NOT NULL DEFAULT 'UserAccount', | ||||
|   PRIMARY KEY  (`UUID`) | ||||
| ); | ||||
| 
 | ||||
| CREATE TABLE tokens ( | ||||
|   UUID char(36) NOT NULL, | ||||
|   token varchar(255) NOT NULL, | ||||
|   validity datetime NOT NULL | ||||
| ); | ||||
| 
 | ||||
| COMMIT; | ||||
|  | @ -1,9 +0,0 @@ | |||
| BEGIN TRANSACTION; | ||||
| 
 | ||||
| CREATE TABLE Avatars ( | ||||
| 	PrincipalID CHAR(36) NOT NULL,  | ||||
| 	Name VARCHAR(32) NOT NULL,  | ||||
| 	Value VARCHAR(255) NOT NULL DEFAULT '',  | ||||
| 	PRIMARY KEY(PrincipalID, Name)); | ||||
| 
 | ||||
| COMMIT; | ||||
|  | @ -1,10 +0,0 @@ | |||
| BEGIN TRANSACTION; | ||||
| 
 | ||||
| CREATE TABLE `Friends` ( | ||||
| 	`PrincipalID` CHAR(36) NOT NULL,  | ||||
| 	`Friend` VARCHAR(255) NOT NULL,  | ||||
| 	`Flags` VARCHAR(16) NOT NULL DEFAULT 0,  | ||||
| 	`Offered` VARCHAR(32) NOT NULL DEFAULT 0,  | ||||
| 	PRIMARY KEY(`PrincipalID`, `Friend`)); | ||||
| 
 | ||||
| COMMIT; | ||||
|  | @ -1,17 +0,0 @@ | |||
| BEGIN TRANSACTION; | ||||
| 
 | ||||
| -- useraccounts table | ||||
| CREATE TABLE UserAccounts ( | ||||
|     PrincipalID CHAR(36)  primary key, | ||||
|     ScopeID CHAR(36) NOT NULL, | ||||
|     FirstName VARCHAR(64) NOT NULL, | ||||
|     LastName VARCHAR(64) NOT NULL, | ||||
|     Email VARCHAR(64), | ||||
|     ServiceURLs TEXT, | ||||
|     Created INT(11), | ||||
|     UserLevel integer NOT NULL DEFAULT 0, | ||||
|     UserFlags integer NOT NULL DEFAULT 0, | ||||
|     UserTitle varchar(64) NOT NULL DEFAULT '' | ||||
| ); | ||||
| 
 | ||||
| COMMIT; | ||||
|  | @ -1,5 +0,0 @@ | |||
| BEGIN TRANSACTION; | ||||
| 
 | ||||
| INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey) SELECT `UUID` AS UUID, `passwordHash` AS passwordHash, `passwordSalt` AS passwordSalt, `webLoginKey` AS webLoginKey FROM users; | ||||
| 
 | ||||
| COMMIT; | ||||
|  | @ -1,5 +0,0 @@ | |||
| BEGIN TRANSACTION; | ||||
| 
 | ||||
| INSERT INTO `Friends` SELECT `ownerID`, `friendID`, `friendPerms`, 0 FROM `userfriends`; | ||||
| 
 | ||||
| COMMIT; | ||||
|  | @ -1,5 +0,0 @@ | |||
| BEGIN TRANSACTION; | ||||
| 
 | ||||
| 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; | ||||
| 
 | ||||
| COMMIT; | ||||
		Loading…
	
		Reference in New Issue
	
	 Justin Clark-Casey (justincc)
						Justin Clark-Casey (justincc)