aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oGridData.cs5
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oManager.cs2
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oUserData.cs10
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs59
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs46
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs163
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs13
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLManager.cs261
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs142
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLAssetData.cs14
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLDataStore.cs404
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs49
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs4
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLLogData.cs2
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs2
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs53
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs2
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteBase.cs2
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteGridData.cs5
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs6
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteManager.cs2
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteUserData.cs44
-rw-r--r--OpenSim/Framework/Data/GridData.cs7
-rw-r--r--OpenSim/Framework/Data/ILogData.cs2
-rw-r--r--OpenSim/Framework/Data/IniConfig.cs2
-rw-r--r--OpenSim/Framework/Data/RegionProfileData.cs2
-rw-r--r--OpenSim/Framework/Data/ReservationData.cs2
27 files changed, 662 insertions, 643 deletions
diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
index 00999c2..2637166 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
@@ -140,16 +140,17 @@ namespace OpenSim.Framework.Data.DB4o
140 { 140 {
141 manager = null; 141 manager = null;
142 } 142 }
143
143 /// <summary> 144 /// <summary>
144 /// // Returns a list of avatar and UUIDs that match the query 145 /// // Returns a list of avatar and UUIDs that match the query
145 /// </summary> 146 /// </summary>
146
147 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 147 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
148 { 148 {
149 //Do nothing yet 149 //Do nothing yet
150 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 150 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
151 return returnlist; 151 return returnlist;
152 } 152 }
153
153 /// <summary> 154 /// <summary>
154 /// Returns the providers name 155 /// Returns the providers name
155 /// </summary> 156 /// </summary>
@@ -173,4 +174,4 @@ namespace OpenSim.Framework.Data.DB4o
173 return null; 174 return null;
174 } 175 }
175 } 176 }
176} 177} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs
index cf1dfae..4b1b451 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs
@@ -167,4 +167,4 @@ namespace OpenSim.Framework.Data.DB4o
167 } 167 }
168 } 168 }
169 } 169 }
170} 170} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
index 383bfbe..e0973f1 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
@@ -26,8 +26,8 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO;
30using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
31using libsecondlife; 31using libsecondlife;
32 32
33namespace OpenSim.Framework.Data.DB4o 33namespace OpenSim.Framework.Data.DB4o
@@ -132,12 +132,14 @@ namespace OpenSim.Framework.Data.DB4o
132 return null; 132 return null;
133 } 133 }
134 } 134 }
135 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 135
136 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
136 { 137 {
137 //Do nothing yet 138 //Do nothing yet
138 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); 139 List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
139 return returnlist; 140 return returnlist;
140 } 141 }
142
141 /// <summary> 143 /// <summary>
142 /// Creates a new user profile 144 /// Creates a new user profile
143 /// </summary> 145 /// </summary>
@@ -225,4 +227,4 @@ namespace OpenSim.Framework.Data.DB4o
225 return "0.1"; 227 return "0.1";
226 } 228 }
227 } 229 }
228} 230} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs
index cc0422c..08fbef0 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs
@@ -27,18 +27,18 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Data;
31using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data;
32using System.Data.SqlClient; 32using System.Data.SqlClient;
33
34using libsecondlife; 33using libsecondlife;
35using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
36 35
37namespace OpenSim.Framework.Data.MSSQL 36namespace OpenSim.Framework.Data.MSSQL
38{ 37{
39 class MSSQLAssetData : IAssetProvider 38 internal class MSSQLAssetData : IAssetProvider
40 { 39 {
41 MSSQLManager database; 40 private MSSQLManager database;
41
42 #region IAssetProvider Members 42 #region IAssetProvider Members
43 43
44 private void UpgradeAssetsTable(string tableName) 44 private void UpgradeAssetsTable(string tableName)
@@ -46,7 +46,7 @@ namespace OpenSim.Framework.Data.MSSQL
46 // null as the version, indicates that the table didn't exist 46 // null as the version, indicates that the table didn't exist
47 if (tableName == null) 47 if (tableName == null)
48 { 48 {
49 MainLog.Instance.Notice("ASSETS", "Creating new database tables"); 49 MainLog.Instance.Notice("ASSETS", "Creating new database tables");
50 database.ExecuteResourceSql("CreateAssetsTable.sql"); 50 database.ExecuteResourceSql("CreateAssetsTable.sql");
51 return; 51 return;
52 } 52 }
@@ -57,14 +57,12 @@ namespace OpenSim.Framework.Data.MSSQL
57 /// </summary> 57 /// </summary>
58 private void TestTables() 58 private void TestTables()
59 { 59 {
60
61 Dictionary<string, string> tableList = new Dictionary<string, string>(); 60 Dictionary<string, string> tableList = new Dictionary<string, string>();
62 61
63 tableList["assets"] = null; 62 tableList["assets"] = null;
64 database.GetTableVersion(tableList); 63 database.GetTableVersion(tableList);
65 64
66 UpgradeAssetsTable(tableList["assets"]); 65 UpgradeAssetsTable(tableList["assets"]);
67
68 } 66 }
69 67
70 public AssetBase FetchAsset(LLUUID assetID) 68 public AssetBase FetchAsset(LLUUID assetID)
@@ -80,30 +78,27 @@ namespace OpenSim.Framework.Data.MSSQL
80 asset = database.getAssetRow(reader); 78 asset = database.getAssetRow(reader);
81 reader.Close(); 79 reader.Close();
82 result.Dispose(); 80 result.Dispose();
83 81
84 return asset; 82 return asset;
85 } 83 }
86 84
87 public void CreateAsset(AssetBase asset) 85 public void CreateAsset(AssetBase asset)
88 { 86 {
89 87 if (ExistsAsset((LLUUID) asset.FullID))
90 if (ExistsAsset((LLUUID)asset.FullID))
91 { 88 {
92 return; 89 return;
93 } 90 }
94 91
95 92
96
97 SqlCommand cmd = 93 SqlCommand cmd =
98 new SqlCommand( 94 new SqlCommand(
99 "INSERT INTO assets ([id], [name], [description], [assetType], [invType], [local], [temporary], [data])"+ 95 "INSERT INTO assets ([id], [name], [description], [assetType], [invType], [local], [temporary], [data])" +
100 " VALUES "+ 96 " VALUES " +
101 "(@id, @name, @description, @assetType, @invType, @local, @temporary, @data)", 97 "(@id, @name, @description, @assetType, @invType, @local, @temporary, @data)",
102 database.getConnection()); 98 database.getConnection());
103 99
104 using (cmd) 100 using (cmd)
105 { 101 {
106
107 //SqlParameter p = cmd.Parameters.Add("id", SqlDbType.NVarChar); 102 //SqlParameter p = cmd.Parameters.Add("id", SqlDbType.NVarChar);
108 //p.Value = asset.FullID.ToString(); 103 //p.Value = asset.FullID.ToString();
109 cmd.Parameters.AddWithValue("id", asset.FullID.ToString()); 104 cmd.Parameters.AddWithValue("id", asset.FullID.ToString());
@@ -127,24 +122,23 @@ namespace OpenSim.Framework.Data.MSSQL
127 { 122 {
128 throw; 123 throw;
129 } 124 }
130 125
131 cmd.Dispose(); 126 cmd.Dispose();
132 } 127 }
133
134 } 128 }
135 129
136 130
137 public void UpdateAsset(AssetBase asset) 131 public void UpdateAsset(AssetBase asset)
138 { 132 {
139 SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + 133 SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " +
140 "name = @name, " + 134 "name = @name, " +
141 "description = @description," + 135 "description = @description," +
142 "assetType = @assetType," + 136 "assetType = @assetType," +
143 "invType = @invType," + 137 "invType = @invType," +
144 "local = @local,"+ 138 "local = @local," +
145 "temporary = @temporary," + 139 "temporary = @temporary," +
146 "data = @data where " + 140 "data = @data where " +
147 "id = @keyId;", database.getConnection()); 141 "id = @keyId;", database.getConnection());
148 SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString()); 142 SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString());
149 SqlParameter param2 = new SqlParameter("@name", asset.Name); 143 SqlParameter param2 = new SqlParameter("@name", asset.Name);
150 SqlParameter param3 = new SqlParameter("@description", asset.Description); 144 SqlParameter param3 = new SqlParameter("@description", asset.Description);
@@ -172,12 +166,12 @@ namespace OpenSim.Framework.Data.MSSQL
172 { 166 {
173 MainLog.Instance.Error(e.ToString()); 167 MainLog.Instance.Error(e.ToString());
174 } 168 }
175
176 } 169 }
177 170
178 public bool ExistsAsset(LLUUID uuid) 171 public bool ExistsAsset(LLUUID uuid)
179 { 172 {
180 if (FetchAsset(uuid) != null) { 173 if (FetchAsset(uuid) != null)
174 {
181 return true; 175 return true;
182 } 176 }
183 return false; 177 return false;
@@ -194,11 +188,8 @@ namespace OpenSim.Framework.Data.MSSQL
194 188
195 #region IPlugin Members 189 #region IPlugin Members
196 190
197
198
199 public void Initialise() 191 public void Initialise()
200 { 192 {
201
202 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); 193 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
203 string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); 194 string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
204 string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); 195 string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog");
@@ -206,7 +197,9 @@ namespace OpenSim.Framework.Data.MSSQL
206 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 197 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
207 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 198 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
208 199
209 this.database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 200 database =
201 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
202 settingPassword);
210 203
211 TestTables(); 204 TestTables();
212 } 205 }
@@ -214,7 +207,7 @@ namespace OpenSim.Framework.Data.MSSQL
214 public string Version 207 public string Version
215 { 208 {
216// get { return database.getVersion(); } 209// get { return database.getVersion(); }
217 get { return database.getVersion(); } 210 get { return database.getVersion(); }
218 } 211 }
219 212
220 public string Name 213 public string Name
@@ -224,4 +217,4 @@ namespace OpenSim.Framework.Data.MSSQL
224 217
225 #endregion 218 #endregion
226 } 219 }
227} 220} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
index 72db568..7d228e6 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
@@ -57,8 +57,9 @@ namespace OpenSim.Framework.Data.MSSQL
57 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 57 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
58 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 58 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
59 59
60 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 60 database =
61 61 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
62 settingPassword);
62 } 63 }
63 64
64 /// <summary> 65 /// <summary>
@@ -120,14 +121,13 @@ namespace OpenSim.Framework.Data.MSSQL
120 result.Dispose(); 121 result.Dispose();
121 122
122 return row; 123 return row;
123
124 } 124 }
125 catch (Exception) 125 catch (Exception)
126 { 126 {
127 if (reader != null) { 127 if (reader != null)
128 {
128 reader.Close(); 129 reader.Close();
129 } 130 }
130
131 } 131 }
132 return null; 132 return null;
133 } 133 }
@@ -135,7 +135,6 @@ namespace OpenSim.Framework.Data.MSSQL
135 /// <summary> 135 /// <summary>
136 /// // Returns a list of avatar and UUIDs that match the query 136 /// // Returns a list of avatar and UUIDs that match the query
137 /// </summary> 137 /// </summary>
138
139 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 138 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
140 { 139 {
141 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 140 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
@@ -152,18 +151,19 @@ namespace OpenSim.Framework.Data.MSSQL
152 param["second"] = querysplit[1]; 151 param["second"] = querysplit[1];
153 152
154 IDbCommand result = 153 IDbCommand result =
155 database.Query("SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second", param); 154 database.Query(
155 "SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second",
156 param);
156 IDataReader reader = result.ExecuteReader(); 157 IDataReader reader = result.ExecuteReader();
157 158
158 159
159 while (reader.Read()) 160 while (reader.Read())
160 { 161 {
161 AvatarPickerAvatar user = new AvatarPickerAvatar(); 162 AvatarPickerAvatar user = new AvatarPickerAvatar();
162 user.AvatarID = new LLUUID((string)reader["UUID"]); 163 user.AvatarID = new LLUUID((string) reader["UUID"]);
163 user.firstName = (string)reader["username"]; 164 user.firstName = (string) reader["username"];
164 user.lastName = (string)reader["surname"]; 165 user.lastName = (string) reader["surname"];
165 returnlist.Add(user); 166 returnlist.Add(user);
166
167 } 167 }
168 reader.Close(); 168 reader.Close();
169 result.Dispose(); 169 result.Dispose();
@@ -175,13 +175,9 @@ namespace OpenSim.Framework.Data.MSSQL
175 MainLog.Instance.Error(e.ToString()); 175 MainLog.Instance.Error(e.ToString());
176 return returnlist; 176 return returnlist;
177 } 177 }
178
179
180
181 } 178 }
182 else if (querysplit.Length == 1) 179 else if (querysplit.Length == 1)
183 { 180 {
184
185 try 181 try
186 { 182 {
187 lock (database) 183 lock (database)
@@ -191,18 +187,19 @@ namespace OpenSim.Framework.Data.MSSQL
191 param["second"] = querysplit[1]; 187 param["second"] = querysplit[1];
192 188
193 IDbCommand result = 189 IDbCommand result =
194 database.Query("SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second", param); 190 database.Query(
191 "SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second",
192 param);
195 IDataReader reader = result.ExecuteReader(); 193 IDataReader reader = result.ExecuteReader();
196 194
197 195
198 while (reader.Read()) 196 while (reader.Read())
199 { 197 {
200 AvatarPickerAvatar user = new AvatarPickerAvatar(); 198 AvatarPickerAvatar user = new AvatarPickerAvatar();
201 user.AvatarID = new LLUUID((string)reader["UUID"]); 199 user.AvatarID = new LLUUID((string) reader["UUID"]);
202 user.firstName = (string)reader["username"]; 200 user.firstName = (string) reader["username"];
203 user.lastName = (string)reader["surname"]; 201 user.lastName = (string) reader["surname"];
204 returnlist.Add(user); 202 returnlist.Add(user);
205
206 } 203 }
207 reader.Close(); 204 reader.Close();
208 result.Dispose(); 205 result.Dispose();
@@ -225,8 +222,8 @@ namespace OpenSim.Framework.Data.MSSQL
225 /// <returns>The sim profile</returns> 222 /// <returns>The sim profile</returns>
226 public RegionProfileData GetProfileByLLUUID(LLUUID uuid) 223 public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
227 { 224 {
228 Dictionary<string, string> param = new Dictionary<string, string>(); 225 Dictionary<string, string> param = new Dictionary<string, string>();
229 param["uuid"] = uuid.ToString(); 226 param["uuid"] = uuid.ToString();
230 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); 227 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
231 IDataReader reader = result.ExecuteReader(); 228 IDataReader reader = result.ExecuteReader();
232 229
@@ -244,7 +241,6 @@ namespace OpenSim.Framework.Data.MSSQL
244 /// <returns>A dataresponse enum indicating success</returns> 241 /// <returns>A dataresponse enum indicating success</returns>
245 public DataResponse AddProfile(RegionProfileData profile) 242 public DataResponse AddProfile(RegionProfileData profile)
246 { 243 {
247
248 try 244 try
249 { 245 {
250 if (GetProfileByLLUUID(profile.UUID) != null) 246 if (GetProfileByLLUUID(profile.UUID) != null)
@@ -310,4 +306,4 @@ namespace OpenSim.Framework.Data.MSSQL
310 return null; 306 return null;
311 } 307 }
312 } 308 }
313} 309} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
index a6b8819..4b2c7af 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
@@ -26,10 +26,9 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Data.SqlClient; 31using System.Data.SqlClient;
32using System.Collections.Generic;
33using libsecondlife; 32using libsecondlife;
34using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
35 34
@@ -57,7 +56,9 @@ namespace OpenSim.Framework.Data.MSSQL
57 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 56 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
58 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 57 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
59 58
60 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 59 database =
60 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
61 settingPassword);
61 TestTables(); 62 TestTables();
62 } 63 }
63 64
@@ -72,7 +73,6 @@ namespace OpenSim.Framework.Data.MSSQL
72 //database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql"); 73 //database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
73 return; 74 return;
74 } 75 }
75
76 } 76 }
77 77
78 private void UpgradeItemsTable(string tableName) 78 private void UpgradeItemsTable(string tableName)
@@ -88,17 +88,17 @@ namespace OpenSim.Framework.Data.MSSQL
88 88
89 private void TestTables() 89 private void TestTables()
90 { 90 {
91
92 Dictionary<string, string> tableList = new Dictionary<string, string>(); 91 Dictionary<string, string> tableList = new Dictionary<string, string>();
93 92
94 tableList["inventoryfolders"] = null; 93 tableList["inventoryfolders"] = null;
95 tableList["inventoryitems"] = null; 94 tableList["inventoryitems"] = null;
96 95
97 database.GetTableVersion(tableList); 96 database.GetTableVersion(tableList);
98 97
99 UpgradeFoldersTable(tableList["inventoryfolders"]); 98 UpgradeFoldersTable(tableList["inventoryfolders"]);
100 UpgradeItemsTable(tableList["inventoryitems"]); 99 UpgradeItemsTable(tableList["inventoryitems"]);
101 } 100 }
101
102 #endregion 102 #endregion
103 103
104 /// <summary> 104 /// <summary>
@@ -124,7 +124,7 @@ namespace OpenSim.Framework.Data.MSSQL
124 /// <returns>A string containing the DB provider</returns> 124 /// <returns>A string containing the DB provider</returns>
125 public string getVersion() 125 public string getVersion()
126 { 126 {
127 return database.getVersion(); 127 return database.getVersion();
128 } 128 }
129 129
130 /// <summary> 130 /// <summary>
@@ -143,15 +143,16 @@ namespace OpenSim.Framework.Data.MSSQL
143 Dictionary<string, string> param = new Dictionary<string, string>(); 143 Dictionary<string, string> param = new Dictionary<string, string>();
144 param["parentFolderID"] = folderID.ToString(); 144 param["parentFolderID"] = folderID.ToString();
145 145
146 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param); 146 IDbCommand result =
147 database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param);
147 IDataReader reader = result.ExecuteReader(); 148 IDataReader reader = result.ExecuteReader();
148 149
149 while(reader.Read()) 150 while (reader.Read())
150 items.Add(readInventoryItem(reader)); 151 items.Add(readInventoryItem(reader));
151 152
152 reader.Close(); 153 reader.Close();
153 result.Dispose(); 154 result.Dispose();
154 155
155 return items; 156 return items;
156 } 157 }
157 } 158 }
@@ -174,16 +175,17 @@ namespace OpenSim.Framework.Data.MSSQL
174 { 175 {
175 lock (database) 176 lock (database)
176 { 177 {
177
178 Dictionary<string, string> param = new Dictionary<string, string>(); 178 Dictionary<string, string> param = new Dictionary<string, string>();
179 param["uuid"] = user.ToString(); 179 param["uuid"] = user.ToString();
180 param["zero"] = LLUUID.Zero.ToString(); 180 param["zero"] = LLUUID.Zero.ToString();
181 181
182 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); 182 IDbCommand result =
183 database.Query(
184 "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param);
183 IDataReader reader = result.ExecuteReader(); 185 IDataReader reader = result.ExecuteReader();
184 186
185 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 187 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
186 while(reader.Read()) 188 while (reader.Read())
187 items.Add(readInventoryFolder(reader)); 189 items.Add(readInventoryFolder(reader));
188 190
189 191
@@ -212,24 +214,27 @@ namespace OpenSim.Framework.Data.MSSQL
212 param["uuid"] = user.ToString(); 214 param["uuid"] = user.ToString();
213 param["zero"] = LLUUID.Zero.ToString(); 215 param["zero"] = LLUUID.Zero.ToString();
214 216
215 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); 217 IDbCommand result =
218 database.Query(
219 "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param);
216 IDataReader reader = result.ExecuteReader(); 220 IDataReader reader = result.ExecuteReader();
217 221
218 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 222 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
219 while(reader.Read()) 223 while (reader.Read())
220 items.Add(readInventoryFolder(reader)); 224 items.Add(readInventoryFolder(reader));
221 225
222 InventoryFolderBase rootFolder = null; 226 InventoryFolderBase rootFolder = null;
223 227
224 // There should only ever be one root folder for a user. However, if there's more 228 // There should only ever be one root folder for a user. However, if there's more
225 // than one we'll simply use the first one rather than failing. It would be even 229 // than one we'll simply use the first one rather than failing. It would be even
226 // nicer to print some message to this effect, but this feels like it's too low a 230 // nicer to print some message to this effect, but this feels like it's too low a
227 // to put such a message out, and it's too minor right now to spare the time to 231 // to put such a message out, and it's too minor right now to spare the time to
228 // suitably refactor. 232 // suitably refactor.
229 if (items.Count > 0) { 233 if (items.Count > 0)
234 {
230 rootFolder = items[0]; 235 rootFolder = items[0];
231 } 236 }
232 237
233 reader.Close(); 238 reader.Close();
234 result.Dispose(); 239 result.Dispose();
235 240
@@ -259,12 +264,13 @@ namespace OpenSim.Framework.Data.MSSQL
259 param["parentFolderID"] = parentID.ToString(); 264 param["parentFolderID"] = parentID.ToString();
260 265
261 266
262 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param); 267 IDbCommand result =
268 database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param);
263 IDataReader reader = result.ExecuteReader(); 269 IDataReader reader = result.ExecuteReader();
264 270
265 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 271 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
266 272
267 while(reader.Read()) 273 while (reader.Read())
268 items.Add(readInventoryFolder(reader)); 274 items.Add(readInventoryFolder(reader));
269 275
270 reader.Close(); 276 reader.Close();
@@ -292,17 +298,17 @@ namespace OpenSim.Framework.Data.MSSQL
292 { 298 {
293 InventoryItemBase item = new InventoryItemBase(); 299 InventoryItemBase item = new InventoryItemBase();
294 300
295 item.inventoryID = new LLUUID((string)reader["inventoryID"]); 301 item.inventoryID = new LLUUID((string) reader["inventoryID"]);
296 item.assetID = new LLUUID((string)reader["assetID"]); 302 item.assetID = new LLUUID((string) reader["assetID"]);
297 item.assetType = (int)reader["assetType"]; 303 item.assetType = (int) reader["assetType"];
298 item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); 304 item.parentFolderID = new LLUUID((string) reader["parentFolderID"]);
299 item.avatarID = new LLUUID((string)reader["avatarID"]); 305 item.avatarID = new LLUUID((string) reader["avatarID"]);
300 item.inventoryName = (string)reader["inventoryName"]; 306 item.inventoryName = (string) reader["inventoryName"];
301 item.inventoryDescription = (string)reader["inventoryDescription"]; 307 item.inventoryDescription = (string) reader["inventoryDescription"];
302 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); 308 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]);
303 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); 309 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]);
304 item.invType = (int)reader["invType"]; 310 item.invType = (int) reader["invType"];
305 item.creatorsID = new LLUUID((string)reader["creatorID"]); 311 item.creatorsID = new LLUUID((string) reader["creatorID"]);
306 item.inventoryBasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); 312 item.inventoryBasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
307 item.inventoryEveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); 313 item.inventoryEveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
308 return item; 314 return item;
@@ -322,7 +328,6 @@ namespace OpenSim.Framework.Data.MSSQL
322 /// <returns>An inventory item</returns> 328 /// <returns>An inventory item</returns>
323 public InventoryItemBase getInventoryItem(LLUUID itemID) 329 public InventoryItemBase getInventoryItem(LLUUID itemID)
324 { 330 {
325
326 try 331 try
327 { 332 {
328 lock (database) 333 lock (database)
@@ -330,11 +335,12 @@ namespace OpenSim.Framework.Data.MSSQL
330 Dictionary<string, string> param = new Dictionary<string, string>(); 335 Dictionary<string, string> param = new Dictionary<string, string>();
331 param["inventoryID"] = itemID.ToString(); 336 param["inventoryID"] = itemID.ToString();
332 337
333 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param); 338 IDbCommand result =
339 database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param);
334 IDataReader reader = result.ExecuteReader(); 340 IDataReader reader = result.ExecuteReader();
335 341
336 InventoryItemBase item = null; 342 InventoryItemBase item = null;
337 if(reader.Read()) 343 if (reader.Read())
338 item = readInventoryItem(reader); 344 item = readInventoryItem(reader);
339 345
340 reader.Close(); 346 reader.Close();
@@ -361,12 +367,12 @@ namespace OpenSim.Framework.Data.MSSQL
361 try 367 try
362 { 368 {
363 InventoryFolderBase folder = new InventoryFolderBase(); 369 InventoryFolderBase folder = new InventoryFolderBase();
364 folder.agentID = new LLUUID((string)reader["agentID"]); 370 folder.agentID = new LLUUID((string) reader["agentID"]);
365 folder.parentID = new LLUUID((string)reader["parentFolderID"]); 371 folder.parentID = new LLUUID((string) reader["parentFolderID"]);
366 folder.folderID = new LLUUID((string)reader["folderID"]); 372 folder.folderID = new LLUUID((string) reader["folderID"]);
367 folder.name = (string)reader["folderName"]; 373 folder.name = (string) reader["folderName"];
368 folder.type = (short)reader["type"]; 374 folder.type = (short) reader["type"];
369 folder.version = (ushort)((int)reader["version"]); 375 folder.version = (ushort) ((int) reader["version"]);
370 return folder; 376 return folder;
371 } 377 }
372 catch (Exception e) 378 catch (Exception e)
@@ -389,7 +395,7 @@ namespace OpenSim.Framework.Data.MSSQL
389 { 395 {
390 lock (database) 396 lock (database)
391 { 397 {
392 Dictionary<string, string> param = new Dictionary<string,string>(); 398 Dictionary<string, string> param = new Dictionary<string, string>();
393 param["uuid"] = folderID.ToString(); 399 param["uuid"] = folderID.ToString();
394 400
395 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @uuid", param); 401 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @uuid", param);
@@ -418,8 +424,10 @@ namespace OpenSim.Framework.Data.MSSQL
418 public void addInventoryItem(InventoryItemBase item) 424 public void addInventoryItem(InventoryItemBase item)
419 { 425 {
420 string sql = "INSERT INTO inventoryitems"; 426 string sql = "INSERT INTO inventoryitems";
421 sql += "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES "; 427 sql +=
422 sql += "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);"; 428 "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES ";
429 sql +=
430 "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);";
423 431
424 try 432 try
425 { 433 {
@@ -441,7 +449,6 @@ namespace OpenSim.Framework.Data.MSSQL
441 IDbCommand result = database.Query(sql, param); 449 IDbCommand result = database.Query(sql, param);
442 result.ExecuteNonQuery(); 450 result.ExecuteNonQuery();
443 result.Dispose(); 451 result.Dispose();
444
445 } 452 }
446 catch (SqlException e) 453 catch (SqlException e)
447 { 454 {
@@ -454,21 +461,21 @@ namespace OpenSim.Framework.Data.MSSQL
454 /// </summary> 461 /// </summary>
455 /// <param name="item">Inventory item to update</param> 462 /// <param name="item">Inventory item to update</param>
456 public void updateInventoryItem(InventoryItemBase item) 463 public void updateInventoryItem(InventoryItemBase item)
457 { 464 {
458 SqlCommand command = new SqlCommand("UPDATE inventoryitems set inventoryID = @inventoryID, " + 465 SqlCommand command = new SqlCommand("UPDATE inventoryitems set inventoryID = @inventoryID, " +
459 "assetID = @assetID, " + 466 "assetID = @assetID, " +
460 "assetType = @assetType" + 467 "assetType = @assetType" +
461 "parentFolderID = @parentFolderID" + 468 "parentFolderID = @parentFolderID" +
462 "avatarID = @avatarID" + 469 "avatarID = @avatarID" +
463 "inventoryName = @inventoryName"+ 470 "inventoryName = @inventoryName" +
464 "inventoryDescription = @inventoryDescription" + 471 "inventoryDescription = @inventoryDescription" +
465 "inventoryNextPermissions = @inventoryNextPermissions" + 472 "inventoryNextPermissions = @inventoryNextPermissions" +
466 "inventoryCurrentPermissions = @inventoryCurrentPermissions" + 473 "inventoryCurrentPermissions = @inventoryCurrentPermissions" +
467 "invType = @invType" + 474 "invType = @invType" +
468 "creatorID = @creatorID" + 475 "creatorID = @creatorID" +
469 "inventoryBasePermissions = @inventoryBasePermissions" + 476 "inventoryBasePermissions = @inventoryBasePermissions" +
470 "inventoryEveryOnePermissions = @inventoryEveryOnePermissions) where " + 477 "inventoryEveryOnePermissions = @inventoryEveryOnePermissions) where " +
471 "invenoryID = @keyInventoryID;", database.getConnection()); 478 "invenoryID = @keyInventoryID;", database.getConnection());
472 SqlParameter param1 = new SqlParameter("@inventoryID", item.inventoryID.ToString()); 479 SqlParameter param1 = new SqlParameter("@inventoryID", item.inventoryID.ToString());
473 SqlParameter param2 = new SqlParameter("@assetID", item.assetID); 480 SqlParameter param2 = new SqlParameter("@assetID", item.assetID);
474 SqlParameter param3 = new SqlParameter("@assetType", item.assetType); 481 SqlParameter param3 = new SqlParameter("@assetType", item.assetType);
@@ -481,7 +488,7 @@ namespace OpenSim.Framework.Data.MSSQL
481 SqlParameter param10 = new SqlParameter("@invType", item.invType); 488 SqlParameter param10 = new SqlParameter("@invType", item.invType);
482 SqlParameter param11 = new SqlParameter("@creatorID", item.creatorsID); 489 SqlParameter param11 = new SqlParameter("@creatorID", item.creatorsID);
483 SqlParameter param12 = new SqlParameter("@inventoryBasePermissions", item.inventoryBasePermissions); 490 SqlParameter param12 = new SqlParameter("@inventoryBasePermissions", item.inventoryBasePermissions);
484 SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.inventoryEveryOnePermissions); 491 SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.inventoryEveryOnePermissions);
485 SqlParameter param14 = new SqlParameter("@keyInventoryID", item.inventoryID.ToString()); 492 SqlParameter param14 = new SqlParameter("@keyInventoryID", item.inventoryID.ToString());
486 command.Parameters.Add(param1); 493 command.Parameters.Add(param1);
487 command.Parameters.Add(param2); 494 command.Parameters.Add(param2);
@@ -506,7 +513,6 @@ namespace OpenSim.Framework.Data.MSSQL
506 { 513 {
507 MainLog.Instance.Error(e.ToString()); 514 MainLog.Instance.Error(e.ToString());
508 } 515 }
509
510 } 516 }
511 517
512 /// <summary> 518 /// <summary>
@@ -523,8 +529,6 @@ namespace OpenSim.Framework.Data.MSSQL
523 IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@uuid", param); 529 IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@uuid", param);
524 cmd.ExecuteNonQuery(); 530 cmd.ExecuteNonQuery();
525 cmd.Dispose(); 531 cmd.Dispose();
526
527
528 } 532 }
529 catch (SqlException e) 533 catch (SqlException e)
530 { 534 {
@@ -539,7 +543,8 @@ namespace OpenSim.Framework.Data.MSSQL
539 /// <param name="folder">Folder to create</param> 543 /// <param name="folder">Folder to create</param>
540 public void addInventoryFolder(InventoryFolderBase folder) 544 public void addInventoryFolder(InventoryFolderBase folder)
541 { 545 {
542 string sql = "INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) VALUES "; 546 string sql =
547 "INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) VALUES ";
543 sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);"; 548 sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);";
544 549
545 550
@@ -550,9 +555,9 @@ namespace OpenSim.Framework.Data.MSSQL
550 param["folderName"] = folder.name; 555 param["folderName"] = folder.name;
551 param["type"] = Convert.ToString(folder.type); 556 param["type"] = Convert.ToString(folder.type);
552 param["version"] = Convert.ToString(folder.version); 557 param["version"] = Convert.ToString(folder.version);
553 558
554 try 559 try
555 { 560 {
556 IDbCommand result = database.Query(sql, param); 561 IDbCommand result = database.Query(sql, param);
557 result.ExecuteNonQuery(); 562 result.ExecuteNonQuery();
558 result.Dispose(); 563 result.Dispose();
@@ -567,16 +572,15 @@ namespace OpenSim.Framework.Data.MSSQL
567 /// Updates an inventory folder 572 /// Updates an inventory folder
568 /// </summary> 573 /// </summary>
569 /// <param name="folder">Folder to update</param> 574 /// <param name="folder">Folder to update</param>
570
571 public void updateInventoryFolder(InventoryFolderBase folder) 575 public void updateInventoryFolder(InventoryFolderBase folder)
572 { 576 {
573 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + 577 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " +
574 "agentID = @agentID, " + 578 "agentID = @agentID, " +
575 "parentFolderID = @parentFolderID," + 579 "parentFolderID = @parentFolderID," +
576 "folderName = @folderName," + 580 "folderName = @folderName," +
577 "type = @type," + 581 "type = @type," +
578 "version = @version where " + 582 "version = @version where " +
579 "folderID = @keyFolderID;", database.getConnection()); 583 "folderID = @keyFolderID;", database.getConnection());
580 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); 584 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString());
581 SqlParameter param2 = new SqlParameter("@agentID", folder.agentID.ToString()); 585 SqlParameter param2 = new SqlParameter("@agentID", folder.agentID.ToString());
582 SqlParameter param3 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); 586 SqlParameter param3 = new SqlParameter("@parentFolderID", folder.parentID.ToString());
@@ -600,20 +604,17 @@ namespace OpenSim.Framework.Data.MSSQL
600 { 604 {
601 MainLog.Instance.Error(e.ToString()); 605 MainLog.Instance.Error(e.ToString());
602 } 606 }
603
604
605 } 607 }
606 608
607 /// <summary> 609 /// <summary>
608 /// Updates an inventory folder 610 /// Updates an inventory folder
609 /// </summary> 611 /// </summary>
610 /// <param name="folder">Folder to update</param> 612 /// <param name="folder">Folder to update</param>
611
612 public void moveInventoryFolder(InventoryFolderBase folder) 613 public void moveInventoryFolder(InventoryFolderBase folder)
613 { 614 {
614 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + 615 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " +
615 "parentFolderID = @parentFolderID," + 616 "parentFolderID = @parentFolderID," +
616 "folderID = @keyFolderID;", database.getConnection()); 617 "folderID = @keyFolderID;", database.getConnection());
617 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); 618 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString());
618 SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); 619 SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToString());
619 SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToString()); 620 SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToString());
@@ -629,8 +630,6 @@ namespace OpenSim.Framework.Data.MSSQL
629 { 630 {
630 MainLog.Instance.Error(e.ToString()); 631 MainLog.Instance.Error(e.ToString());
631 } 632 }
632
633
634 } 633 }
635 634
636 /// <summary> 635 /// <summary>
@@ -645,7 +644,7 @@ namespace OpenSim.Framework.Data.MSSQL
645 foreach (InventoryFolderBase f in subfolderList) 644 foreach (InventoryFolderBase f in subfolderList)
646 folders.Add(f); 645 folders.Add(f);
647 } 646 }
648 647
649 /// <summary> 648 /// <summary>
650 /// Returns all child folders in the hierarchy from the parent folder and down 649 /// Returns all child folders in the hierarchy from the parent folder and down
651 /// </summary> 650 /// </summary>
@@ -672,7 +671,6 @@ namespace OpenSim.Framework.Data.MSSQL
672 IDbCommand cmd = database.Query("DELETE FROM inventoryfolders WHERE folderID=@folderID", param); 671 IDbCommand cmd = database.Query("DELETE FROM inventoryfolders WHERE folderID=@folderID", param);
673 cmd.ExecuteNonQuery(); 672 cmd.ExecuteNonQuery();
674 cmd.Dispose(); 673 cmd.Dispose();
675
676 } 674 }
677 catch (SqlException e) 675 catch (SqlException e)
678 { 676 {
@@ -689,7 +687,8 @@ namespace OpenSim.Framework.Data.MSSQL
689 param["parentFolderID"] = folderID.ToString(); 687 param["parentFolderID"] = folderID.ToString();
690 688
691 689
692 IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param); 690 IDbCommand cmd =
691 database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param);
693 cmd.ExecuteNonQuery(); 692 cmd.ExecuteNonQuery();
694 cmd.Dispose(); 693 cmd.Dispose();
695 } 694 }
@@ -724,4 +723,4 @@ namespace OpenSim.Framework.Data.MSSQL
724 } 723 }
725 } 724 }
726 } 725 }
727} 726} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs
index a5b33ec..c3ec7c6 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs
@@ -25,14 +25,12 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29
30namespace OpenSim.Framework.Data.MSSQL 28namespace OpenSim.Framework.Data.MSSQL
31{ 29{
32 /// <summary> 30 /// <summary>
33 /// An interface to the log database for MySQL 31 /// An interface to the log database for MySQL
34 /// </summary> 32 /// </summary>
35 class MSSQLLogData : ILogData 33 internal class MSSQLLogData : ILogData
36 { 34 {
37 /// <summary> 35 /// <summary>
38 /// The database manager 36 /// The database manager
@@ -51,7 +49,9 @@ namespace OpenSim.Framework.Data.MSSQL
51 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 49 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
52 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 50 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
53 51
54 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 52 database =
53 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
54 settingPassword);
55 } 55 }
56 56
57 /// <summary> 57 /// <summary>
@@ -63,7 +63,8 @@ namespace OpenSim.Framework.Data.MSSQL
63 /// <param name="arguments">The arguments passed to the method</param> 63 /// <param name="arguments">The arguments passed to the method</param>
64 /// <param name="priority">How critical is this?</param> 64 /// <param name="priority">How critical is this?</param>
65 /// <param name="logMessage">The message to log</param> 65 /// <param name="logMessage">The message to log</param>
66 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) 66 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
67 string logMessage)
67 { 68 {
68 try 69 try
69 { 70 {
@@ -101,4 +102,4 @@ namespace OpenSim.Framework.Data.MSSQL
101 return "0.1"; 102 return "0.1";
102 } 103 }
103 } 104 }
104} 105} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
index b009a56..0dc3338 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
@@ -25,6 +25,7 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Data; 31using System.Data;
@@ -32,7 +33,6 @@ using System.Data.SqlClient;
32using System.IO; 33using System.IO;
33using System.Reflection; 34using System.Reflection;
34using libsecondlife; 35using libsecondlife;
35
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37 37
38namespace OpenSim.Framework.Data.MSSQL 38namespace OpenSim.Framework.Data.MSSQL
@@ -40,12 +40,12 @@ namespace OpenSim.Framework.Data.MSSQL
40 /// <summary> 40 /// <summary>
41 /// A management class for the MS SQL Storage Engine 41 /// A management class for the MS SQL Storage Engine
42 /// </summary> 42 /// </summary>
43 class MSSQLManager 43 internal class MSSQLManager
44 { 44 {
45 /// <summary> 45 /// <summary>
46 /// The database connection object 46 /// The database connection object
47 /// </summary> 47 /// </summary>
48 IDbConnection dbcon; 48 private IDbConnection dbcon;
49 49
50 /// <summary> 50 /// <summary>
51 /// Connection string for ADO.net 51 /// Connection string for ADO.net
@@ -60,12 +60,14 @@ namespace OpenSim.Framework.Data.MSSQL
60 /// <param name="username">The username logging into the database</param> 60 /// <param name="username">The username logging into the database</param>
61 /// <param name="password">The password for the user logging in</param> 61 /// <param name="password">The password for the user logging in</param>
62 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> 62 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
63 public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId, string password) 63 public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId,
64 string password)
64 { 65 {
65 try 66 try
66 { 67 {
67 68 connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + initialCatalog +
68 connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + initialCatalog + ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" + password+";"; 69 ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" +
70 password + ";";
69 dbcon = new SqlConnection(connectionString); 71 dbcon = new SqlConnection(connectionString);
70 TestTables(dbcon); 72 TestTables(dbcon);
71 dbcon.Open(); 73 dbcon.Open();
@@ -78,7 +80,7 @@ namespace OpenSim.Framework.Data.MSSQL
78 80
79 private bool TestTables(IDbConnection conn) 81 private bool TestTables(IDbConnection conn)
80 { 82 {
81 IDbCommand cmd = this.Query("SELECT * FROM regions", new Dictionary<string, string>()); 83 IDbCommand cmd = Query("SELECT * FROM regions", new Dictionary<string, string>());
82 //SqlCommand cmd = (SqlCommand)dbcon.CreateCommand(); 84 //SqlCommand cmd = (SqlCommand)dbcon.CreateCommand();
83 //cmd.CommandText = "SELECT * FROM regions"; 85 //cmd.CommandText = "SELECT * FROM regions";
84 try 86 try
@@ -90,7 +92,7 @@ namespace OpenSim.Framework.Data.MSSQL
90 } 92 }
91 catch (Exception) 93 catch (Exception)
92 { 94 {
93 MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating"); 95 MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating");
94 InitDB(conn); 96 InitDB(conn);
95 } 97 }
96 return true; 98 return true;
@@ -100,66 +102,66 @@ namespace OpenSim.Framework.Data.MSSQL
100 { 102 {
101 string createRegions = defineTable(createRegionsTable()); 103 string createRegions = defineTable(createRegionsTable());
102 Dictionary<string, string> param = new Dictionary<string, string>(); 104 Dictionary<string, string> param = new Dictionary<string, string>();
103 IDbCommand pcmd = this.Query(createRegions, param); 105 IDbCommand pcmd = Query(createRegions, param);
104 if (conn.State == ConnectionState.Closed) { 106 if (conn.State == ConnectionState.Closed)
107 {
105 conn.Open(); 108 conn.Open();
106 } 109 }
107 pcmd.ExecuteNonQuery(); 110 pcmd.ExecuteNonQuery();
108 pcmd.Dispose(); 111 pcmd.Dispose();
109 112
110 this.ExecuteResourceSql("Mssql-users.sql"); 113 ExecuteResourceSql("Mssql-users.sql");
111 this.ExecuteResourceSql("Mssql-agents.sql"); 114 ExecuteResourceSql("Mssql-agents.sql");
112 this.ExecuteResourceSql("Mssql-logs.sql"); 115 ExecuteResourceSql("Mssql-logs.sql");
113 116
114 conn.Close(); 117 conn.Close();
115
116 } 118 }
117 119
118 private DataTable createRegionsTable() 120 private DataTable createRegionsTable()
119 { 121 {
120 DataTable regions = new DataTable("regions"); 122 DataTable regions = new DataTable("regions");
121 123
122 createCol(regions, "regionHandle", typeof(ulong)); 124 createCol(regions, "regionHandle", typeof (ulong));
123 createCol(regions, "regionName", typeof(System.String)); 125 createCol(regions, "regionName", typeof (String));
124 createCol(regions, "uuid", typeof(System.String)); 126 createCol(regions, "uuid", typeof (String));
125 127
126 createCol(regions, "regionRecvKey", typeof(System.String)); 128 createCol(regions, "regionRecvKey", typeof (String));
127 createCol(regions, "regionSecret", typeof(System.String)); 129 createCol(regions, "regionSecret", typeof (String));
128 createCol(regions, "regionSendKey", typeof(System.String)); 130 createCol(regions, "regionSendKey", typeof (String));
129 131
130 createCol(regions, "regionDataURI", typeof(System.String)); 132 createCol(regions, "regionDataURI", typeof (String));
131 createCol(regions, "serverIP", typeof(System.String)); 133 createCol(regions, "serverIP", typeof (String));
132 createCol(regions, "serverPort", typeof(System.String)); 134 createCol(regions, "serverPort", typeof (String));
133 createCol(regions, "serverURI", typeof(System.String)); 135 createCol(regions, "serverURI", typeof (String));
134 136
135 137
136 createCol(regions, "locX", typeof(uint)); 138 createCol(regions, "locX", typeof (uint));
137 createCol(regions, "locY", typeof(uint)); 139 createCol(regions, "locY", typeof (uint));
138 createCol(regions, "locZ", typeof(uint)); 140 createCol(regions, "locZ", typeof (uint));
139 141
140 createCol(regions, "eastOverrideHandle", typeof(ulong)); 142 createCol(regions, "eastOverrideHandle", typeof (ulong));
141 createCol(regions, "westOverrideHandle", typeof(ulong)); 143 createCol(regions, "westOverrideHandle", typeof (ulong));
142 createCol(regions, "southOverrideHandle", typeof(ulong)); 144 createCol(regions, "southOverrideHandle", typeof (ulong));
143 createCol(regions, "northOverrideHandle", typeof(ulong)); 145 createCol(regions, "northOverrideHandle", typeof (ulong));
144 146
145 createCol(regions, "regionAssetURI", typeof(System.String)); 147 createCol(regions, "regionAssetURI", typeof (String));
146 createCol(regions, "regionAssetRecvKey", typeof(System.String)); 148 createCol(regions, "regionAssetRecvKey", typeof (String));
147 createCol(regions, "regionAssetSendKey", typeof(System.String)); 149 createCol(regions, "regionAssetSendKey", typeof (String));
148 150
149 createCol(regions, "regionUserURI", typeof(System.String)); 151 createCol(regions, "regionUserURI", typeof (String));
150 createCol(regions, "regionUserRecvKey", typeof(System.String)); 152 createCol(regions, "regionUserRecvKey", typeof (String));
151 createCol(regions, "regionUserSendKey", typeof(System.String)); 153 createCol(regions, "regionUserSendKey", typeof (String));
152 154
153 createCol(regions, "regionMapTexture", typeof(System.String)); 155 createCol(regions, "regionMapTexture", typeof (String));
154 createCol(regions, "serverHttpPort", typeof(System.String)); 156 createCol(regions, "serverHttpPort", typeof (String));
155 createCol(regions, "serverRemotingPort", typeof(uint)); 157 createCol(regions, "serverRemotingPort", typeof (uint));
156 158
157 // Add in contraints 159 // Add in contraints
158 regions.PrimaryKey = new DataColumn[] { regions.Columns["UUID"] }; 160 regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]};
159 return regions; 161 return regions;
160 } 162 }
161 163
162 protected static void createCol(DataTable dt, string name, System.Type type) 164 protected static void createCol(DataTable dt, string name, Type type)
163 { 165 {
164 DataColumn col = new DataColumn(name, type); 166 DataColumn col = new DataColumn(name, type);
165 dt.Columns.Add(col); 167 dt.Columns.Add(col);
@@ -172,10 +174,11 @@ namespace OpenSim.Framework.Data.MSSQL
172 foreach (DataColumn col in dt.Columns) 174 foreach (DataColumn col in dt.Columns)
173 { 175 {
174 if (subsql.Length > 0) 176 if (subsql.Length > 0)
175 { // a map function would rock so much here 177 {
178 // a map function would rock so much here
176 subsql += ",\n"; 179 subsql += ",\n";
177 } 180 }
178 181
179 subsql += col.ColumnName + " " + SqlType(col.DataType); 182 subsql += col.ColumnName + " " + SqlType(col.DataType);
180 if (col == dt.PrimaryKey[0]) 183 if (col == dt.PrimaryKey[0])
181 { 184 {
@@ -192,19 +195,19 @@ namespace OpenSim.Framework.Data.MSSQL
192 // slightly differently. 195 // slightly differently.
193 private static string SqlType(Type type) 196 private static string SqlType(Type type)
194 { 197 {
195 if (type == typeof(System.String)) 198 if (type == typeof (String))
196 { 199 {
197 return "varchar(255)"; 200 return "varchar(255)";
198 } 201 }
199 else if (type == typeof(System.Int32)) 202 else if (type == typeof (Int32))
200 { 203 {
201 return "integer"; 204 return "integer";
202 } 205 }
203 else if (type == typeof(System.Double)) 206 else if (type == typeof (Double))
204 { 207 {
205 return "float"; 208 return "float";
206 } 209 }
207 else if (type == typeof(System.Byte[])) 210 else if (type == typeof (Byte[]))
208 { 211 {
209 return "image"; 212 return "image";
210 } 213 }
@@ -254,14 +257,14 @@ namespace OpenSim.Framework.Data.MSSQL
254 /// <returns>A Sql DB Command</returns> 257 /// <returns>A Sql DB Command</returns>
255 public IDbCommand Query(string sql, Dictionary<string, string> parameters) 258 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
256 { 259 {
257 SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); 260 SqlCommand dbcommand = (SqlCommand) dbcon.CreateCommand();
258 dbcommand.CommandText = sql; 261 dbcommand.CommandText = sql;
259 foreach (KeyValuePair<string, string> param in parameters) 262 foreach (KeyValuePair<string, string> param in parameters)
260 { 263 {
261 dbcommand.Parameters.AddWithValue(param.Key, param.Value); 264 dbcommand.Parameters.AddWithValue(param.Key, param.Value);
262 } 265 }
263 266
264 return (IDbCommand)dbcommand; 267 return (IDbCommand) dbcommand;
265 } 268 }
266 269
267 /// <summary> 270 /// <summary>
@@ -277,20 +280,20 @@ namespace OpenSim.Framework.Data.MSSQL
277 { 280 {
278 // Region Main 281 // Region Main
279 regionprofile.regionHandle = Convert.ToUInt64(reader["regionHandle"]); 282 regionprofile.regionHandle = Convert.ToUInt64(reader["regionHandle"]);
280 regionprofile.regionName = (string)reader["regionName"]; 283 regionprofile.regionName = (string) reader["regionName"];
281 regionprofile.UUID = new LLUUID((string)reader["uuid"]); 284 regionprofile.UUID = new LLUUID((string) reader["uuid"]);
282 285
283 // Secrets 286 // Secrets
284 regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; 287 regionprofile.regionRecvKey = (string) reader["regionRecvKey"];
285 regionprofile.regionSecret = (string)reader["regionSecret"]; 288 regionprofile.regionSecret = (string) reader["regionSecret"];
286 regionprofile.regionSendKey = (string)reader["regionSendKey"]; 289 regionprofile.regionSendKey = (string) reader["regionSendKey"];
287 290
288 // Region Server 291 // Region Server
289 regionprofile.regionDataURI = (string)reader["regionDataURI"]; 292 regionprofile.regionDataURI = (string) reader["regionDataURI"];
290 regionprofile.regionOnline = false; // Needs to be pinged before this can be set. 293 regionprofile.regionOnline = false; // Needs to be pinged before this can be set.
291 regionprofile.serverIP = (string)reader["serverIP"]; 294 regionprofile.serverIP = (string) reader["serverIP"];
292 regionprofile.serverPort = Convert.ToUInt32(reader["serverPort"]); 295 regionprofile.serverPort = Convert.ToUInt32(reader["serverPort"]);
293 regionprofile.serverURI = (string)reader["serverURI"]; 296 regionprofile.serverURI = (string) reader["serverURI"];
294 regionprofile.httpPort = Convert.ToUInt32(reader["serverHttpPort"]); 297 regionprofile.httpPort = Convert.ToUInt32(reader["serverHttpPort"]);
295 regionprofile.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"]); 298 regionprofile.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"]);
296 299
@@ -307,14 +310,14 @@ namespace OpenSim.Framework.Data.MSSQL
307 regionprofile.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"]); 310 regionprofile.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"]);
308 311
309 // Assets 312 // Assets
310 regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; 313 regionprofile.regionAssetURI = (string) reader["regionAssetURI"];
311 regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; 314 regionprofile.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
312 regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; 315 regionprofile.regionAssetSendKey = (string) reader["regionAssetSendKey"];
313 316
314 // Userserver 317 // Userserver
315 regionprofile.regionUserURI = (string)reader["regionUserURI"]; 318 regionprofile.regionUserURI = (string) reader["regionUserURI"];
316 regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; 319 regionprofile.regionUserRecvKey = (string) reader["regionUserRecvKey"];
317 regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; 320 regionprofile.regionUserSendKey = (string) reader["regionUserSendKey"];
318 321
319 // World Map Addition 322 // World Map Addition
320 string tempRegionMap = reader["regionMapTexture"].ToString(); 323 string tempRegionMap = reader["regionMapTexture"].ToString();
@@ -331,7 +334,6 @@ namespace OpenSim.Framework.Data.MSSQL
331 { 334 {
332 reader.Close(); 335 reader.Close();
333 throw new Exception("No rows to return"); 336 throw new Exception("No rows to return");
334
335 } 337 }
336 return regionprofile; 338 return regionprofile;
337 } 339 }
@@ -347,12 +349,12 @@ namespace OpenSim.Framework.Data.MSSQL
347 349
348 if (reader.Read()) 350 if (reader.Read())
349 { 351 {
350 retval.UUID = new LLUUID((string)reader["UUID"]); 352 retval.UUID = new LLUUID((string) reader["UUID"]);
351 retval.username = (string)reader["username"]; 353 retval.username = (string) reader["username"];
352 retval.surname = (string)reader["lastname"]; 354 retval.surname = (string) reader["lastname"];
353 355
354 retval.passwordHash = (string)reader["passwordHash"]; 356 retval.passwordHash = (string) reader["passwordHash"];
355 retval.passwordSalt = (string)reader["passwordSalt"]; 357 retval.passwordSalt = (string) reader["passwordSalt"];
356 358
357 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); 359 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString());
358 retval.homeLocation = new LLVector3( 360 retval.homeLocation = new LLVector3(
@@ -367,18 +369,17 @@ namespace OpenSim.Framework.Data.MSSQL
367 retval.created = Convert.ToInt32(reader["created"].ToString()); 369 retval.created = Convert.ToInt32(reader["created"].ToString());
368 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); 370 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
369 371
370 retval.userInventoryURI = (string)reader["userInventoryURI"]; 372 retval.userInventoryURI = (string) reader["userInventoryURI"];
371 retval.userAssetURI = (string)reader["userAssetURI"]; 373 retval.userAssetURI = (string) reader["userAssetURI"];
372 374
373 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); 375 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
374 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); 376 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
375 377
376 retval.profileAboutText = (string)reader["profileAboutText"]; 378 retval.profileAboutText = (string) reader["profileAboutText"];
377 retval.profileFirstText = (string)reader["profileFirstText"]; 379 retval.profileFirstText = (string) reader["profileFirstText"];
378
379 retval.profileImage = new LLUUID((string)reader["profileImage"]);
380 retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]);
381 380
381 retval.profileImage = new LLUUID((string) reader["profileImage"]);
382 retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]);
382 } 383 }
383 else 384 else
384 { 385 {
@@ -399,12 +400,12 @@ namespace OpenSim.Framework.Data.MSSQL
399 if (reader.Read()) 400 if (reader.Read())
400 { 401 {
401 // Agent IDs 402 // Agent IDs
402 retval.UUID = new LLUUID((string)reader["UUID"]); 403 retval.UUID = new LLUUID((string) reader["UUID"]);
403 retval.sessionID = new LLUUID((string)reader["sessionID"]); 404 retval.sessionID = new LLUUID((string) reader["sessionID"]);
404 retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); 405 retval.secureSessionID = new LLUUID((string) reader["secureSessionID"]);
405 406
406 // Agent Who? 407 // Agent Who?
407 retval.agentIP = (string)reader["agentIP"]; 408 retval.agentIP = (string) reader["agentIP"];
408 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); 409 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString());
409 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); 410 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString());
410 411
@@ -413,9 +414,9 @@ namespace OpenSim.Framework.Data.MSSQL
413 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); 414 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString());
414 415
415 // Current position 416 // Current position
416 retval.currentRegion = (string)reader["currentRegion"]; 417 retval.currentRegion = (string) reader["currentRegion"];
417 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); 418 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString());
418 LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); 419 LLVector3.TryParse((string) reader["currentPos"], out retval.currentPos);
419 } 420 }
420 else 421 else
421 { 422 {
@@ -426,20 +427,19 @@ namespace OpenSim.Framework.Data.MSSQL
426 427
427 public AssetBase getAssetRow(IDataReader reader) 428 public AssetBase getAssetRow(IDataReader reader)
428 { 429 {
429 AssetBase asset = new AssetBase(); 430 AssetBase asset = new AssetBase();
430 if (reader.Read()) 431 if (reader.Read())
431 { 432 {
432 // Region Main 433 // Region Main
433 434
434 asset = new AssetBase(); 435 asset = new AssetBase();
435 asset.Data = (byte[])reader["data"]; 436 asset.Data = (byte[]) reader["data"];
436 asset.Description = (string)reader["description"]; 437 asset.Description = (string) reader["description"];
437 asset.FullID = new LLUUID((string)reader["id"]); 438 asset.FullID = new LLUUID((string) reader["id"]);
438 asset.InvType = Convert.ToSByte(reader["invType"]); 439 asset.InvType = Convert.ToSByte(reader["invType"]);
439 asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false; 440 asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false;
440 asset.Name = (string)reader["name"]; 441 asset.Name = (string) reader["name"];
441 asset.Type = Convert.ToSByte(reader["assetType"]); 442 asset.Type = Convert.ToSByte(reader["assetType"]);
442
443 } 443 }
444 else 444 else
445 { 445 {
@@ -455,15 +455,19 @@ namespace OpenSim.Framework.Data.MSSQL
455 /// <returns>Successful?</returns> 455 /// <returns>Successful?</returns>
456 public bool insertRegionRow(RegionProfileData profile) 456 public bool insertRegionRow(RegionProfileData profile)
457 { 457 {
458
459 //Insert new region 458 //Insert new region
460 string sql = "INSERT INTO regions ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], "; 459 string sql =
461 sql += "[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], "; 460 "INSERT INTO regions ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], ";
462 sql += "[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort]) VALUES "; 461 sql +=
462 "[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], ";
463 sql +=
464 "[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort]) VALUES ";
463 465
464 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; 466 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
465 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; 467 sql +=
466 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort);"; 468 "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
469 sql +=
470 "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort);";
467 471
468 Dictionary<string, string> parameters = new Dictionary<string, string>(); 472 Dictionary<string, string> parameters = new Dictionary<string, string>();
469 473
@@ -498,9 +502,9 @@ namespace OpenSim.Framework.Data.MSSQL
498 bool returnval = false; 502 bool returnval = false;
499 503
500 try 504 try
501 { 505 {
502 IDbCommand result = Query(sql, parameters); 506 IDbCommand result = Query(sql, parameters);
503 507
504 if (result.ExecuteNonQuery() == 1) 508 if (result.ExecuteNonQuery() == 1)
505 returnval = true; 509 returnval = true;
506 510
@@ -509,15 +513,12 @@ namespace OpenSim.Framework.Data.MSSQL
509 catch (Exception e) 513 catch (Exception e)
510 { 514 {
511 MainLog.Instance.Error("MSSQLManager : " + e.ToString()); 515 MainLog.Instance.Error("MSSQLManager : " + e.ToString());
512
513 } 516 }
514 517
515 return returnval; 518 return returnval;
516
517 } 519 }
518 520
519 521
520
521 /// <summary> 522 /// <summary>
522 /// Inserts a new row into the log database 523 /// Inserts a new row into the log database
523 /// </summary> 524 /// </summary>
@@ -528,7 +529,8 @@ namespace OpenSim.Framework.Data.MSSQL
528 /// <param name="priority">How critical is this?</param> 529 /// <param name="priority">How critical is this?</param>
529 /// <param name="logMessage">Extra message info</param> 530 /// <param name="logMessage">Extra message info</param>
530 /// <returns>Saved successfully?</returns> 531 /// <returns>Saved successfully?</returns>
531 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) 532 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority,
533 string logMessage)
532 { 534 {
533 string sql = "INSERT INTO logs ([target], [server], [method], [arguments], [priority], [message]) VALUES "; 535 string sql = "INSERT INTO logs ([target], [server], [method], [arguments], [priority], [message]) VALUES ";
534 sql += "(@target, @server, @method, @arguments, @priority, @message);"; 536 sql += "(@target, @server, @method, @arguments, @priority, @message);";
@@ -588,19 +590,26 @@ namespace OpenSim.Framework.Data.MSSQL
588 /// <param name="profileImage">UUID for profile image</param> 590 /// <param name="profileImage">UUID for profile image</param>
589 /// <param name="firstImage">UUID for firstlife image</param> 591 /// <param name="firstImage">UUID for firstlife image</param>
590 /// <returns>Success?</returns> 592 /// <returns>Success?</returns>
591 public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, 593 public bool insertUserRow(LLUUID uuid, string username, string lastname, string passwordHash,
592 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, 594 string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
593 libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage) 595 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
596 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
597 string aboutText, string firstText,
598 LLUUID profileImage, LLUUID firstImage)
594 { 599 {
595 string sql = "INSERT INTO users "; 600 string sql = "INSERT INTO users ";
596 sql += "([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], "; 601 sql += "([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], ";
597 sql += "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], "; 602 sql +=
598 sql += "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], "; 603 "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], ";
604 sql +=
605 "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], ";
599 sql += "[profileFirstText], [profileImage], [profileFirstImage]) VALUES "; 606 sql += "[profileFirstText], [profileImage], [profileFirstImage]) VALUES ";
600 607
601 sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, "; 608 sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, ";
602 sql += "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, "; 609 sql +=
603 sql += "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, "; 610 "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, ";
611 sql +=
612 "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, ";
604 sql += "@profileFirstText, @profileImage, @profileFirstImage);"; 613 sql += "@profileFirstText, @profileImage, @profileFirstImage);";
605 614
606 Dictionary<string, string> parameters = new Dictionary<string, string>(); 615 Dictionary<string, string> parameters = new Dictionary<string, string>();
@@ -624,13 +633,13 @@ namespace OpenSim.Framework.Data.MSSQL
624 parameters["profileWantDoMask"] = "0"; 633 parameters["profileWantDoMask"] = "0";
625 parameters["profileAboutText"] = ""; 634 parameters["profileAboutText"] = "";
626 parameters["profileFirstText"] = ""; 635 parameters["profileFirstText"] = "";
627 parameters["profileImage"] = libsecondlife.LLUUID.Zero.ToString(); 636 parameters["profileImage"] = LLUUID.Zero.ToString();
628 parameters["profileFirstImage"] = libsecondlife.LLUUID.Zero.ToString(); 637 parameters["profileFirstImage"] = LLUUID.Zero.ToString();
629 638
630 bool returnval = false; 639 bool returnval = false;
631 640
632 try 641 try
633 { 642 {
634 IDbCommand result = Query(sql, parameters); 643 IDbCommand result = Query(sql, parameters);
635 644
636 if (result.ExecuteNonQuery() == 1) 645 if (result.ExecuteNonQuery() == 1)
@@ -655,8 +664,7 @@ namespace OpenSim.Framework.Data.MSSQL
655 { 664 {
656 try 665 try
657 { 666 {
658 667 SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection) dbcon);
659 SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection)dbcon);
660 cmd.ExecuteNonQuery(); 668 cmd.ExecuteNonQuery();
661 cmd.Dispose(); 669 cmd.Dispose();
662 } 670 }
@@ -668,7 +676,7 @@ namespace OpenSim.Framework.Data.MSSQL
668 676
669 public SqlConnection getConnection() 677 public SqlConnection getConnection()
670 { 678 {
671 return (SqlConnection)dbcon; 679 return (SqlConnection) dbcon;
672 } 680 }
673 681
674 /// <summary> 682 /// <summary>
@@ -681,14 +689,15 @@ namespace OpenSim.Framework.Data.MSSQL
681 { 689 {
682 Dictionary<string, string> param = new Dictionary<string, string>(); 690 Dictionary<string, string> param = new Dictionary<string, string>();
683 param["dbname"] = dbcon.Database; 691 param["dbname"] = dbcon.Database;
684 IDbCommand tablesCmd = this.Query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG=@dbname", param); 692 IDbCommand tablesCmd =
693 Query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG=@dbname", param);
685 using (IDataReader tables = tablesCmd.ExecuteReader()) 694 using (IDataReader tables = tablesCmd.ExecuteReader())
686 { 695 {
687 while (tables.Read()) 696 while (tables.Read())
688 { 697 {
689 try 698 try
690 { 699 {
691 string tableName = (string)tables["TABLE_NAME"]; 700 string tableName = (string) tables["TABLE_NAME"];
692 if (tableList.ContainsKey(tableName)) 701 if (tableList.ContainsKey(tableName))
693 tableList[tableName] = tableName; 702 tableList[tableName] = tableName;
694 } 703 }
@@ -704,7 +713,7 @@ namespace OpenSim.Framework.Data.MSSQL
704 713
705 private string getResourceString(string name) 714 private string getResourceString(string name)
706 { 715 {
707 Assembly assem = this.GetType().Assembly; 716 Assembly assem = GetType().Assembly;
708 string[] names = assem.GetManifestResourceNames(); 717 string[] names = assem.GetManifestResourceNames();
709 718
710 foreach (string s in names) 719 foreach (string s in names)
@@ -726,16 +735,14 @@ namespace OpenSim.Framework.Data.MSSQL
726 /// <returns>A string containing the DB provider</returns> 735 /// <returns>A string containing the DB provider</returns>
727 public string getVersion() 736 public string getVersion()
728 { 737 {
729 System.Reflection.Module module = this.GetType().Module; 738 Module module = GetType().Module;
730 string dllName = module.Assembly.ManifestModule.Name; 739 string dllName = module.Assembly.ManifestModule.Name;
731 Version dllVersion = module.Assembly.GetName().Version; 740 Version dllVersion = module.Assembly.GetName().Version;
732 741
733 742
734 return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); 743 return
744 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
745 dllVersion.Revision);
735 } 746 }
736
737 } 747 }
738 748} \ No newline at end of file
739
740
741}
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index eac9826..01ef559 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.MSSQL
37 /// <summary> 37 /// <summary>
38 /// A database interface class to a user profile storage system 38 /// A database interface class to a user profile storage system
39 /// </summary> 39 /// </summary>
40 class MSSQLUserData : IUserData 40 internal class MSSQLUserData : IUserData
41 { 41 {
42 /// <summary> 42 /// <summary>
43 /// Database manager for MySQL 43 /// Database manager for MySQL
@@ -58,7 +58,9 @@ namespace OpenSim.Framework.Data.MSSQL
58 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 58 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
59 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 59 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
60 60
61 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 61 database =
62 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
63 settingPassword);
62 } 64 }
63 65
64 /// <summary> 66 /// <summary>
@@ -77,11 +79,12 @@ namespace OpenSim.Framework.Data.MSSQL
77 param["first"] = user; 79 param["first"] = user;
78 param["second"] = last; 80 param["second"] = last;
79 81
80 IDbCommand result = database.Query("SELECT * FROM users WHERE username = @first AND lastname = @second", param); 82 IDbCommand result =
83 database.Query("SELECT * FROM users WHERE username = @first AND lastname = @second", param);
81 IDataReader reader = result.ExecuteReader(); 84 IDataReader reader = result.ExecuteReader();
82 85
83 UserProfileData row = database.readUserRow(reader); 86 UserProfileData row = database.readUserRow(reader);
84 87
85 reader.Close(); 88 reader.Close();
86 result.Dispose(); 89 result.Dispose();
87 90
@@ -96,9 +99,9 @@ namespace OpenSim.Framework.Data.MSSQL
96 } 99 }
97 } 100 }
98 101
99 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 102 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
100 { 103 {
101 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); 104 List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
102 string[] querysplit; 105 string[] querysplit;
103 querysplit = query.Split(' '); 106 querysplit = query.Split(' ');
104 if (querysplit.Length == 2) 107 if (querysplit.Length == 2)
@@ -112,18 +115,19 @@ namespace OpenSim.Framework.Data.MSSQL
112 param["second"] = querysplit[1]; 115 param["second"] = querysplit[1];
113 116
114 IDbCommand result = 117 IDbCommand result =
115 database.Query("SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second", param); 118 database.Query(
119 "SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second",
120 param);
116 IDataReader reader = result.ExecuteReader(); 121 IDataReader reader = result.ExecuteReader();
117 122
118 123
119 while (reader.Read()) 124 while (reader.Read())
120 { 125 {
121 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 126 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
122 user.AvatarID = new LLUUID((string)reader["UUID"]); 127 user.AvatarID = new LLUUID((string) reader["UUID"]);
123 user.firstName = (string)reader["username"]; 128 user.firstName = (string) reader["username"];
124 user.lastName = (string)reader["surname"]; 129 user.lastName = (string) reader["surname"];
125 returnlist.Add(user); 130 returnlist.Add(user);
126
127 } 131 }
128 reader.Close(); 132 reader.Close();
129 result.Dispose(); 133 result.Dispose();
@@ -135,13 +139,9 @@ namespace OpenSim.Framework.Data.MSSQL
135 MainLog.Instance.Error(e.ToString()); 139 MainLog.Instance.Error(e.ToString());
136 return returnlist; 140 return returnlist;
137 } 141 }
138
139
140
141 } 142 }
142 else if (querysplit.Length == 1) 143 else if (querysplit.Length == 1)
143 { 144 {
144
145 try 145 try
146 { 146 {
147 lock (database) 147 lock (database)
@@ -151,18 +151,19 @@ namespace OpenSim.Framework.Data.MSSQL
151 param["second"] = querysplit[1]; 151 param["second"] = querysplit[1];
152 152
153 IDbCommand result = 153 IDbCommand result =
154 database.Query("SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second", param); 154 database.Query(
155 "SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second",
156 param);
155 IDataReader reader = result.ExecuteReader(); 157 IDataReader reader = result.ExecuteReader();
156 158
157 159
158 while (reader.Read()) 160 while (reader.Read())
159 { 161 {
160 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 162 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
161 user.AvatarID = new LLUUID((string)reader["UUID"]); 163 user.AvatarID = new LLUUID((string) reader["UUID"]);
162 user.firstName = (string)reader["username"]; 164 user.firstName = (string) reader["username"];
163 user.lastName = (string)reader["surname"]; 165 user.lastName = (string) reader["surname"];
164 returnlist.Add(user); 166 returnlist.Add(user);
165
166 } 167 }
167 reader.Close(); 168 reader.Close();
168 result.Dispose(); 169 result.Dispose();
@@ -268,21 +269,25 @@ namespace OpenSim.Framework.Data.MSSQL
268 /// <param name="user">The user profile to create</param> 269 /// <param name="user">The user profile to create</param>
269 public void AddNewUserProfile(UserProfileData user) 270 public void AddNewUserProfile(UserProfileData user)
270 { 271 {
271 try 272 try
272 { 273 {
273 lock (database) 274 lock (database)
274 { 275 {
275 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, 276 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt,
276 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, 277 user.homeRegion, user.homeLocation.X, user.homeLocation.Y,
277 user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage); 278 user.homeLocation.Z,
278 } 279 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created,
279 } 280 user.lastLogin, user.userInventoryURI, user.userAssetURI,
280 catch (Exception e) 281 user.profileCanDoMask, user.profileWantDoMask,
281 { 282 user.profileAboutText, user.profileFirstText, user.profileImage,
282 database.Reconnect(); 283 user.profileFirstImage);
283 MainLog.Instance.Error(e.ToString()); 284 }
284 } 285 }
285 286 catch (Exception e)
287 {
288 database.Reconnect();
289 MainLog.Instance.Error(e.ToString());
290 }
286 } 291 }
287 292
288 /// <summary> 293 /// <summary>
@@ -293,34 +298,33 @@ namespace OpenSim.Framework.Data.MSSQL
293 { 298 {
294 // Do nothing. 299 // Do nothing.
295 } 300 }
296 301
297 302
298 public bool UpdateUserProfile(UserProfileData user) 303 public bool UpdateUserProfile(UserProfileData user)
299 { 304 {
300
301 SqlCommand command = new SqlCommand("UPDATE users set UUID = @uuid, " + 305 SqlCommand command = new SqlCommand("UPDATE users set UUID = @uuid, " +
302 "username = @username, " + 306 "username = @username, " +
303 "lastname = @lastname," + 307 "lastname = @lastname," +
304 "passwordHash = @passwordHash," + 308 "passwordHash = @passwordHash," +
305 "passwordSalt = @passwordSalt," + 309 "passwordSalt = @passwordSalt," +
306 "homeRegion = @homeRegion," + 310 "homeRegion = @homeRegion," +
307 "homeLocationX = @homeLocationX," + 311 "homeLocationX = @homeLocationX," +
308 "homeLocationY = @homeLocationY," + 312 "homeLocationY = @homeLocationY," +
309 "homeLocationZ = @homeLocationZ," + 313 "homeLocationZ = @homeLocationZ," +
310 "homeLookAtX = @homeLookAtX," + 314 "homeLookAtX = @homeLookAtX," +
311 "homeLookAtY = @homeLookAtY," + 315 "homeLookAtY = @homeLookAtY," +
312 "homeLookAtZ = @homeLookAtZ," + 316 "homeLookAtZ = @homeLookAtZ," +
313 "created = @created," + 317 "created = @created," +
314 "lastLogin = @lastLogin," + 318 "lastLogin = @lastLogin," +
315 "userInventoryURI = @userInventoryURI," + 319 "userInventoryURI = @userInventoryURI," +
316 "userAssetURI = @userAssetURI," + 320 "userAssetURI = @userAssetURI," +
317 "profileCanDoMask = @profileCanDoMask," + 321 "profileCanDoMask = @profileCanDoMask," +
318 "profileWantDoMask = @profileWantDoMask," + 322 "profileWantDoMask = @profileWantDoMask," +
319 "profileAboutText = @profileAboutText," + 323 "profileAboutText = @profileAboutText," +
320 "profileFirstText = @profileFirstText," + 324 "profileFirstText = @profileFirstText," +
321 "profileImage = @profileImage," + 325 "profileImage = @profileImage," +
322 "profileFirstImage = @profileFirstImage where " + 326 "profileFirstImage = @profileFirstImage where " +
323 "UUID = @keyUUUID;", database.getConnection()); 327 "UUID = @keyUUUID;", database.getConnection());
324 SqlParameter param1 = new SqlParameter("@uuid", user.UUID.ToString()); 328 SqlParameter param1 = new SqlParameter("@uuid", user.UUID.ToString());
325 SqlParameter param2 = new SqlParameter("@username", user.username); 329 SqlParameter param2 = new SqlParameter("@username", user.username);
326 SqlParameter param3 = new SqlParameter("@lastname", user.surname); 330 SqlParameter param3 = new SqlParameter("@lastname", user.surname);
@@ -341,8 +345,8 @@ namespace OpenSim.Framework.Data.MSSQL
341 SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.profileWantDoMask)); 345 SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.profileWantDoMask));
342 SqlParameter param19 = new SqlParameter("@profileAboutText", user.profileAboutText); 346 SqlParameter param19 = new SqlParameter("@profileAboutText", user.profileAboutText);
343 SqlParameter param20 = new SqlParameter("@profileFirstText", user.profileFirstText); 347 SqlParameter param20 = new SqlParameter("@profileFirstText", user.profileFirstText);
344 SqlParameter param21 = new SqlParameter("@profileImage", libsecondlife.LLUUID.Zero.ToString()); 348 SqlParameter param21 = new SqlParameter("@profileImage", LLUUID.Zero.ToString());
345 SqlParameter param22 = new SqlParameter("@profileFirstImage", libsecondlife.LLUUID.Zero.ToString()); 349 SqlParameter param22 = new SqlParameter("@profileFirstImage", LLUUID.Zero.ToString());
346 SqlParameter param23 = new SqlParameter("@keyUUUID", user.UUID.ToString()); 350 SqlParameter param23 = new SqlParameter("@keyUUUID", user.UUID.ToString());
347 command.Parameters.Add(param1); 351 command.Parameters.Add(param1);
348 command.Parameters.Add(param2); 352 command.Parameters.Add(param2);
@@ -370,9 +374,12 @@ namespace OpenSim.Framework.Data.MSSQL
370 try 374 try
371 { 375 {
372 int affected = command.ExecuteNonQuery(); 376 int affected = command.ExecuteNonQuery();
373 if (affected != 0) { 377 if (affected != 0)
378 {
374 return true; 379 return true;
375 } else { 380 }
381 else
382 {
376 return false; 383 return false;
377 } 384 }
378 } 385 }
@@ -433,6 +440,5 @@ namespace OpenSim.Framework.Data.MSSQL
433 public void runQuery(string query) 440 public void runQuery(string query)
434 { 441 {
435 } 442 }
436
437 } 443 }
438} 444} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
index 19ae115..b20c54e 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
@@ -83,13 +83,13 @@ namespace OpenSim.Framework.Data.MySQL
83 if (dbReader.Read()) 83 if (dbReader.Read())
84 { 84 {
85 asset = new AssetBase(); 85 asset = new AssetBase();
86 asset.Data = (byte[])dbReader["data"]; 86 asset.Data = (byte[]) dbReader["data"];
87 asset.Description = (string)dbReader["description"]; 87 asset.Description = (string) dbReader["description"];
88 asset.FullID = assetID; 88 asset.FullID = assetID;
89 asset.InvType = (sbyte)dbReader["invType"]; 89 asset.InvType = (sbyte) dbReader["invType"];
90 asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; 90 asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false;
91 asset.Name = (string)dbReader["name"]; 91 asset.Name = (string) dbReader["name"];
92 asset.Type = (sbyte)dbReader["assetType"]; 92 asset.Type = (sbyte) dbReader["assetType"];
93 } 93 }
94 dbReader.Close(); 94 dbReader.Close();
95 cmd.Dispose(); 95 cmd.Dispose();
@@ -98,7 +98,7 @@ namespace OpenSim.Framework.Data.MySQL
98 catch (Exception) 98 catch (Exception)
99 { 99 {
100 MainLog.Instance.Warn("ASSETS", "MySql failure fetching asset"); 100 MainLog.Instance.Warn("ASSETS", "MySql failure fetching asset");
101 } 101 }
102 } 102 }
103 return asset; 103 return asset;
104 } 104 }
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
index c48c88f..fcf8c6f 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
@@ -31,15 +31,12 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.Diagnostics; 32using System.Diagnostics;
33using System.IO; 33using System.IO;
34using System.Text;
35using libsecondlife; 34using libsecondlife;
36using MySql.Data.MySqlClient; 35using MySql.Data.MySqlClient;
37using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
38using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.LandManagement; 38using OpenSim.Region.Environment.LandManagement;
40using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
41using System.Data.SqlClient;
42using System.Data.Common;
43 40
44namespace OpenSim.Framework.Data.MySQL 41namespace OpenSim.Framework.Data.MySQL
45{ 42{
@@ -130,7 +127,7 @@ namespace OpenSim.Framework.Data.MySQL
130 { 127 {
131 foreach (SceneObjectPart prim in obj.Children.Values) 128 foreach (SceneObjectPart prim in obj.Children.Values)
132 { 129 {
133 if ((prim.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) 130 if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0)
134 { 131 {
135 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); 132 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID);
136 addPrim(prim, obj.UUID, regionUUID); 133 addPrim(prim, obj.UUID, regionUUID);
@@ -156,7 +153,7 @@ namespace OpenSim.Framework.Data.MySQL
156 DataRow[] primRows = prims.Select(selectExp); 153 DataRow[] primRows = prims.Select(selectExp);
157 foreach (DataRow row in primRows) 154 foreach (DataRow row in primRows)
158 { 155 {
159 LLUUID uuid = new LLUUID((string)row["UUID"]); 156 LLUUID uuid = new LLUUID((string) row["UUID"]);
160 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid)); 157 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid));
161 if (shapeRow != null) 158 if (shapeRow != null)
162 { 159 {
@@ -191,8 +188,8 @@ namespace OpenSim.Framework.Data.MySQL
191 { 188 {
192 try 189 try
193 { 190 {
194 string uuid = (string)primRow["UUID"]; 191 string uuid = (string) primRow["UUID"];
195 string objID = (string)primRow["SceneGroupID"]; 192 string objID = (string) primRow["SceneGroupID"];
196 if (uuid == objID) //is new SceneObjectGroup ? 193 if (uuid == objID) //is new SceneObjectGroup ?
197 { 194 {
198 SceneObjectGroup group = new SceneObjectGroup(); 195 SceneObjectGroup group = new SceneObjectGroup();
@@ -255,10 +252,9 @@ namespace OpenSim.Framework.Data.MySQL
255 lock (m_dataSet) 252 lock (m_dataSet)
256 { 253 {
257 MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" + 254 MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" +
258 " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection); 255 " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection);
259 using (cmd) 256 using (cmd)
260 { 257 {
261
262 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); 258 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID)));
263 cmd.Parameters.Add(new MySqlParameter("?Revision", revision)); 259 cmd.Parameters.Add(new MySqlParameter("?Revision", revision));
264 cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter))); 260 cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter)));
@@ -269,7 +265,7 @@ namespace OpenSim.Framework.Data.MySQL
269 265
270 public double[,] LoadTerrain(LLUUID regionID) 266 public double[,] LoadTerrain(LLUUID regionID)
271 { 267 {
272 double[,] terret = new double[256, 256]; 268 double[,] terret = new double[256,256];
273 terret.Initialize(); 269 terret.Initialize();
274 270
275 MySqlCommand cmd = new MySqlCommand( 271 MySqlCommand cmd = new MySqlCommand(
@@ -278,7 +274,7 @@ namespace OpenSim.Framework.Data.MySQL
278 , m_connection); 274 , m_connection);
279 275
280 MySqlParameter param = new MySqlParameter(); 276 MySqlParameter param = new MySqlParameter();
281 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); 277 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID)));
282 278
283 if (m_connection.State != ConnectionState.Open) 279 if (m_connection.State != ConnectionState.Open)
284 { 280 {
@@ -290,15 +286,15 @@ namespace OpenSim.Framework.Data.MySQL
290 int rev = 0; 286 int rev = 0;
291 if (row.Read()) 287 if (row.Read())
292 { 288 {
293 byte[] heightmap = (byte[])row["Heightfield"]; 289 byte[] heightmap = (byte[]) row["Heightfield"];
294 for (int x = 0; x < 256; x++) 290 for (int x = 0; x < 256; x++)
295 { 291 {
296 for (int y = 0; y < 256; y++) 292 for (int y = 0; y < 256; y++)
297 { 293 {
298 terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8); 294 terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8);
299 } 295 }
300 } 296 }
301 rev = (int)row["Revision"]; 297 rev = (int) row["Revision"];
302 } 298 }
303 else 299 else
304 { 300 {
@@ -322,7 +318,9 @@ namespace OpenSim.Framework.Data.MySQL
322 cmd.ExecuteNonQuery(); 318 cmd.ExecuteNonQuery();
323 } 319 }
324 320
325 using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?UUID", m_connection)) 321 using (
322 MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?UUID", m_connection)
323 )
326 { 324 {
327 cmd.Parameters.Add(new MySqlParameter("?UUID", Util.ToRawUuidString(globalID))); 325 cmd.Parameters.Add(new MySqlParameter("?UUID", Util.ToRawUuidString(globalID)));
328 cmd.ExecuteNonQuery(); 326 cmd.ExecuteNonQuery();
@@ -336,7 +334,7 @@ namespace OpenSim.Framework.Data.MySQL
336 { 334 {
337 DataTable land = m_landTable; 335 DataTable land = m_landTable;
338 DataTable landaccesslist = m_landAccessListTable; 336 DataTable landaccesslist = m_landAccessListTable;
339 337
340 DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.globalID)); 338 DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.globalID));
341 if (landRow == null) 339 if (landRow == null)
342 { 340 {
@@ -349,7 +347,9 @@ namespace OpenSim.Framework.Data.MySQL
349 fillLandRow(landRow, parcel.landData, regionUUID); 347 fillLandRow(landRow, parcel.landData, regionUUID);
350 } 348 }
351 349
352 using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection)) 350 using (
351 MySqlCommand cmd =
352 new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection))
353 { 353 {
354 cmd.Parameters.Add(new MySqlParameter("?LandUUID", Util.ToRawUuidString(parcel.landData.globalID))); 354 cmd.Parameters.Add(new MySqlParameter("?LandUUID", Util.ToRawUuidString(parcel.landData.globalID)));
355 cmd.ExecuteNonQuery(); 355 cmd.ExecuteNonQuery();
@@ -361,13 +361,12 @@ namespace OpenSim.Framework.Data.MySQL
361 fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID); 361 fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID);
362 landaccesslist.Rows.Add(newAccessRow); 362 landaccesslist.Rows.Add(newAccessRow);
363 } 363 }
364
365 } 364 }
366 365
367 Commit(); 366 Commit();
368 } 367 }
369 368
370 public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) 369 public List<LandData> LoadLandObjects(LLUUID regionUUID)
371 { 370 {
372 List<LandData> landDataForRegion = new List<LandData>(); 371 List<LandData> landDataForRegion = new List<LandData>();
373 lock (m_dataSet) 372 lock (m_dataSet)
@@ -403,7 +402,7 @@ namespace OpenSim.Framework.Data.MySQL
403 foreach (DataRow row in table.Rows) 402 foreach (DataRow row in table.Rows)
404 { 403 {
405 //--- Display the original values, if there are any. 404 //--- Display the original values, if there are any.
406 if (row.HasVersion(System.Data.DataRowVersion.Original)) 405 if (row.HasVersion(DataRowVersion.Original))
407 { 406 {
408 Debug.Write("Original Row Values ===> "); 407 Debug.Write("Original Row Values ===> ");
409 foreach (DataColumn column in table.Columns) 408 foreach (DataColumn column in table.Columns)
@@ -412,7 +411,7 @@ namespace OpenSim.Framework.Data.MySQL
412 Debug.WriteLine(""); 411 Debug.WriteLine("");
413 } 412 }
414 //--- Display the current values, if there are any. 413 //--- Display the current values, if there are any.
415 if (row.HasVersion(System.Data.DataRowVersion.Current)) 414 if (row.HasVersion(DataRowVersion.Current))
416 { 415 {
417 Debug.Write("Current Row Values ====> "); 416 Debug.Write("Current Row Values ====> ");
418 foreach (DataColumn column in table.Columns) 417 foreach (DataColumn column in table.Columns)
@@ -470,9 +469,9 @@ namespace OpenSim.Framework.Data.MySQL
470 { 469 {
471 DataTable terrain = new DataTable("terrain"); 470 DataTable terrain = new DataTable("terrain");
472 471
473 createCol(terrain, "RegionUUID", typeof(String)); 472 createCol(terrain, "RegionUUID", typeof (String));
474 createCol(terrain, "Revision", typeof(Int32)); 473 createCol(terrain, "Revision", typeof (Int32));
475 DataColumn heightField = createCol(terrain, "Heightfield", typeof(Byte[])); 474 DataColumn heightField = createCol(terrain, "Heightfield", typeof (Byte[]));
476 return terrain; 475 return terrain;
477 } 476 }
478 477
@@ -480,62 +479,62 @@ namespace OpenSim.Framework.Data.MySQL
480 { 479 {
481 DataTable prims = new DataTable("prims"); 480 DataTable prims = new DataTable("prims");
482 481
483 createCol(prims, "UUID", typeof(String)); 482 createCol(prims, "UUID", typeof (String));
484 createCol(prims, "RegionUUID", typeof(String)); 483 createCol(prims, "RegionUUID", typeof (String));
485 createCol(prims, "ParentID", typeof(Int32)); 484 createCol(prims, "ParentID", typeof (Int32));
486 createCol(prims, "CreationDate", typeof(Int32)); 485 createCol(prims, "CreationDate", typeof (Int32));
487 createCol(prims, "Name", typeof(String)); 486 createCol(prims, "Name", typeof (String));
488 createCol(prims, "SceneGroupID", typeof(String)); 487 createCol(prims, "SceneGroupID", typeof (String));
489 // various text fields 488 // various text fields
490 createCol(prims, "Text", typeof(String)); 489 createCol(prims, "Text", typeof (String));
491 createCol(prims, "Description", typeof(String)); 490 createCol(prims, "Description", typeof (String));
492 createCol(prims, "SitName", typeof(String)); 491 createCol(prims, "SitName", typeof (String));
493 createCol(prims, "TouchName", typeof(String)); 492 createCol(prims, "TouchName", typeof (String));
494 // permissions 493 // permissions
495 createCol(prims, "ObjectFlags", typeof(Int32)); 494 createCol(prims, "ObjectFlags", typeof (Int32));
496 createCol(prims, "CreatorID", typeof(String)); 495 createCol(prims, "CreatorID", typeof (String));
497 createCol(prims, "OwnerID", typeof(String)); 496 createCol(prims, "OwnerID", typeof (String));
498 createCol(prims, "GroupID", typeof(String)); 497 createCol(prims, "GroupID", typeof (String));
499 createCol(prims, "LastOwnerID", typeof(String)); 498 createCol(prims, "LastOwnerID", typeof (String));
500 createCol(prims, "OwnerMask", typeof(Int32)); 499 createCol(prims, "OwnerMask", typeof (Int32));
501 createCol(prims, "NextOwnerMask", typeof(Int32)); 500 createCol(prims, "NextOwnerMask", typeof (Int32));
502 createCol(prims, "GroupMask", typeof(Int32)); 501 createCol(prims, "GroupMask", typeof (Int32));
503 createCol(prims, "EveryoneMask", typeof(Int32)); 502 createCol(prims, "EveryoneMask", typeof (Int32));
504 createCol(prims, "BaseMask", typeof(Int32)); 503 createCol(prims, "BaseMask", typeof (Int32));
505 // vectors 504 // vectors
506 createCol(prims, "PositionX", typeof(Double)); 505 createCol(prims, "PositionX", typeof (Double));
507 createCol(prims, "PositionY", typeof(Double)); 506 createCol(prims, "PositionY", typeof (Double));
508 createCol(prims, "PositionZ", typeof(Double)); 507 createCol(prims, "PositionZ", typeof (Double));
509 createCol(prims, "GroupPositionX", typeof(Double)); 508 createCol(prims, "GroupPositionX", typeof (Double));
510 createCol(prims, "GroupPositionY", typeof(Double)); 509 createCol(prims, "GroupPositionY", typeof (Double));
511 createCol(prims, "GroupPositionZ", typeof(Double)); 510 createCol(prims, "GroupPositionZ", typeof (Double));
512 createCol(prims, "VelocityX", typeof(Double)); 511 createCol(prims, "VelocityX", typeof (Double));
513 createCol(prims, "VelocityY", typeof(Double)); 512 createCol(prims, "VelocityY", typeof (Double));
514 createCol(prims, "VelocityZ", typeof(Double)); 513 createCol(prims, "VelocityZ", typeof (Double));
515 createCol(prims, "AngularVelocityX", typeof(Double)); 514 createCol(prims, "AngularVelocityX", typeof (Double));
516 createCol(prims, "AngularVelocityY", typeof(Double)); 515 createCol(prims, "AngularVelocityY", typeof (Double));
517 createCol(prims, "AngularVelocityZ", typeof(Double)); 516 createCol(prims, "AngularVelocityZ", typeof (Double));
518 createCol(prims, "AccelerationX", typeof(Double)); 517 createCol(prims, "AccelerationX", typeof (Double));
519 createCol(prims, "AccelerationY", typeof(Double)); 518 createCol(prims, "AccelerationY", typeof (Double));
520 createCol(prims, "AccelerationZ", typeof(Double)); 519 createCol(prims, "AccelerationZ", typeof (Double));
521 // quaternions 520 // quaternions
522 createCol(prims, "RotationX", typeof(Double)); 521 createCol(prims, "RotationX", typeof (Double));
523 createCol(prims, "RotationY", typeof(Double)); 522 createCol(prims, "RotationY", typeof (Double));
524 createCol(prims, "RotationZ", typeof(Double)); 523 createCol(prims, "RotationZ", typeof (Double));
525 createCol(prims, "RotationW", typeof(Double)); 524 createCol(prims, "RotationW", typeof (Double));
526 // sit target 525 // sit target
527 createCol(prims, "SitTargetOffsetX", typeof(Double)); 526 createCol(prims, "SitTargetOffsetX", typeof (Double));
528 createCol(prims, "SitTargetOffsetY", typeof(Double)); 527 createCol(prims, "SitTargetOffsetY", typeof (Double));
529 createCol(prims, "SitTargetOffsetZ", typeof(Double)); 528 createCol(prims, "SitTargetOffsetZ", typeof (Double));
530 529
531 createCol(prims, "SitTargetOrientW", typeof(Double)); 530 createCol(prims, "SitTargetOrientW", typeof (Double));
532 createCol(prims, "SitTargetOrientX", typeof(Double)); 531 createCol(prims, "SitTargetOrientX", typeof (Double));
533 createCol(prims, "SitTargetOrientY", typeof(Double)); 532 createCol(prims, "SitTargetOrientY", typeof (Double));
534 createCol(prims, "SitTargetOrientZ", typeof(Double)); 533 createCol(prims, "SitTargetOrientZ", typeof (Double));
535 534
536 535
537 // Add in contraints 536 // Add in contraints
538 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 537 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
539 538
540 return prims; 539 return prims;
541 } 540 }
@@ -543,42 +542,42 @@ namespace OpenSim.Framework.Data.MySQL
543 private DataTable createLandTable() 542 private DataTable createLandTable()
544 { 543 {
545 DataTable land = new DataTable("land"); 544 DataTable land = new DataTable("land");
546 createCol(land, "UUID", typeof(String)); 545 createCol(land, "UUID", typeof (String));
547 createCol(land, "RegionUUID", typeof(String)); 546 createCol(land, "RegionUUID", typeof (String));
548 createCol(land, "LocalLandID", typeof(Int32)); 547 createCol(land, "LocalLandID", typeof (Int32));
549 548
550 // Bitmap is a byte[512] 549 // Bitmap is a byte[512]
551 createCol(land, "Bitmap", typeof(Byte[])); 550 createCol(land, "Bitmap", typeof (Byte[]));
552 551
553 createCol(land, "Name", typeof(String)); 552 createCol(land, "Name", typeof (String));
554 createCol(land, "Description", typeof(String)); 553 createCol(land, "Description", typeof (String));
555 createCol(land, "OwnerUUID", typeof(String)); 554 createCol(land, "OwnerUUID", typeof (String));
556 createCol(land, "IsGroupOwned", typeof(Int32)); 555 createCol(land, "IsGroupOwned", typeof (Int32));
557 createCol(land, "Area", typeof(Int32)); 556 createCol(land, "Area", typeof (Int32));
558 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented 557 createCol(land, "AuctionID", typeof (Int32)); //Unemplemented
559 createCol(land, "Category", typeof(Int32)); //Enum libsecondlife.Parcel.ParcelCategory 558 createCol(land, "Category", typeof (Int32)); //Enum libsecondlife.Parcel.ParcelCategory
560 createCol(land, "ClaimDate", typeof(Int32)); 559 createCol(land, "ClaimDate", typeof (Int32));
561 createCol(land, "ClaimPrice", typeof(Int32)); 560 createCol(land, "ClaimPrice", typeof (Int32));
562 createCol(land, "GroupUUID", typeof(String)); 561 createCol(land, "GroupUUID", typeof (String));
563 createCol(land, "SalePrice", typeof(Int32)); 562 createCol(land, "SalePrice", typeof (Int32));
564 createCol(land, "LandStatus", typeof(Int32)); //Enum. libsecondlife.Parcel.ParcelStatus 563 createCol(land, "LandStatus", typeof (Int32)); //Enum. libsecondlife.Parcel.ParcelStatus
565 createCol(land, "LandFlags", typeof(Int32)); 564 createCol(land, "LandFlags", typeof (Int32));
566 createCol(land, "LandingType", typeof(Int32)); 565 createCol(land, "LandingType", typeof (Int32));
567 createCol(land, "MediaAutoScale", typeof(Int32)); 566 createCol(land, "MediaAutoScale", typeof (Int32));
568 createCol(land, "MediaTextureUUID", typeof(String)); 567 createCol(land, "MediaTextureUUID", typeof (String));
569 createCol(land, "MediaURL", typeof(String)); 568 createCol(land, "MediaURL", typeof (String));
570 createCol(land, "MusicURL", typeof(String)); 569 createCol(land, "MusicURL", typeof (String));
571 createCol(land, "PassHours", typeof(Double)); 570 createCol(land, "PassHours", typeof (Double));
572 createCol(land, "PassPrice", typeof(Int32)); 571 createCol(land, "PassPrice", typeof (Int32));
573 createCol(land, "SnapshotUUID", typeof(String)); 572 createCol(land, "SnapshotUUID", typeof (String));
574 createCol(land, "UserLocationX", typeof(Double)); 573 createCol(land, "UserLocationX", typeof (Double));
575 createCol(land, "UserLocationY", typeof(Double)); 574 createCol(land, "UserLocationY", typeof (Double));
576 createCol(land, "UserLocationZ", typeof(Double)); 575 createCol(land, "UserLocationZ", typeof (Double));
577 createCol(land, "UserLookAtX", typeof(Double)); 576 createCol(land, "UserLookAtX", typeof (Double));
578 createCol(land, "UserLookAtY", typeof(Double)); 577 createCol(land, "UserLookAtY", typeof (Double));
579 createCol(land, "UserLookAtZ", typeof(Double)); 578 createCol(land, "UserLookAtZ", typeof (Double));
580 579
581 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; 580 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
582 581
583 return land; 582 return land;
584 } 583 }
@@ -586,9 +585,9 @@ namespace OpenSim.Framework.Data.MySQL
586 private DataTable createLandAccessListTable() 585 private DataTable createLandAccessListTable()
587 { 586 {
588 DataTable landaccess = new DataTable("landaccesslist"); 587 DataTable landaccess = new DataTable("landaccesslist");
589 createCol(landaccess, "LandUUID", typeof(String)); 588 createCol(landaccess, "LandUUID", typeof (String));
590 createCol(landaccess, "AccessUUID", typeof(String)); 589 createCol(landaccess, "AccessUUID", typeof (String));
591 createCol(landaccess, "Flags", typeof(Int32)); 590 createCol(landaccess, "Flags", typeof (Int32));
592 591
593 return landaccess; 592 return landaccess;
594 } 593 }
@@ -596,38 +595,38 @@ namespace OpenSim.Framework.Data.MySQL
596 private DataTable createShapeTable() 595 private DataTable createShapeTable()
597 { 596 {
598 DataTable shapes = new DataTable("primshapes"); 597 DataTable shapes = new DataTable("primshapes");
599 createCol(shapes, "UUID", typeof(String)); 598 createCol(shapes, "UUID", typeof (String));
600 // shape is an enum 599 // shape is an enum
601 createCol(shapes, "Shape", typeof(Int32)); 600 createCol(shapes, "Shape", typeof (Int32));
602 // vectors 601 // vectors
603 createCol(shapes, "ScaleX", typeof(Double)); 602 createCol(shapes, "ScaleX", typeof (Double));
604 createCol(shapes, "ScaleY", typeof(Double)); 603 createCol(shapes, "ScaleY", typeof (Double));
605 createCol(shapes, "ScaleZ", typeof(Double)); 604 createCol(shapes, "ScaleZ", typeof (Double));
606 // paths 605 // paths
607 createCol(shapes, "PCode", typeof(Int32)); 606 createCol(shapes, "PCode", typeof (Int32));
608 createCol(shapes, "PathBegin", typeof(Int32)); 607 createCol(shapes, "PathBegin", typeof (Int32));
609 createCol(shapes, "PathEnd", typeof(Int32)); 608 createCol(shapes, "PathEnd", typeof (Int32));
610 createCol(shapes, "PathScaleX", typeof(Int32)); 609 createCol(shapes, "PathScaleX", typeof (Int32));
611 createCol(shapes, "PathScaleY", typeof(Int32)); 610 createCol(shapes, "PathScaleY", typeof (Int32));
612 createCol(shapes, "PathShearX", typeof(Int32)); 611 createCol(shapes, "PathShearX", typeof (Int32));
613 createCol(shapes, "PathShearY", typeof(Int32)); 612 createCol(shapes, "PathShearY", typeof (Int32));
614 createCol(shapes, "PathSkew", typeof(Int32)); 613 createCol(shapes, "PathSkew", typeof (Int32));
615 createCol(shapes, "PathCurve", typeof(Int32)); 614 createCol(shapes, "PathCurve", typeof (Int32));
616 createCol(shapes, "PathRadiusOffset", typeof(Int32)); 615 createCol(shapes, "PathRadiusOffset", typeof (Int32));
617 createCol(shapes, "PathRevolutions", typeof(Int32)); 616 createCol(shapes, "PathRevolutions", typeof (Int32));
618 createCol(shapes, "PathTaperX", typeof(Int32)); 617 createCol(shapes, "PathTaperX", typeof (Int32));
619 createCol(shapes, "PathTaperY", typeof(Int32)); 618 createCol(shapes, "PathTaperY", typeof (Int32));
620 createCol(shapes, "PathTwist", typeof(Int32)); 619 createCol(shapes, "PathTwist", typeof (Int32));
621 createCol(shapes, "PathTwistBegin", typeof(Int32)); 620 createCol(shapes, "PathTwistBegin", typeof (Int32));
622 // profile 621 // profile
623 createCol(shapes, "ProfileBegin", typeof(Int32)); 622 createCol(shapes, "ProfileBegin", typeof (Int32));
624 createCol(shapes, "ProfileEnd", typeof(Int32)); 623 createCol(shapes, "ProfileEnd", typeof (Int32));
625 createCol(shapes, "ProfileCurve", typeof(Int32)); 624 createCol(shapes, "ProfileCurve", typeof (Int32));
626 createCol(shapes, "ProfileHollow", typeof(Int32)); 625 createCol(shapes, "ProfileHollow", typeof (Int32));
627 createCol(shapes, "Texture", typeof(Byte[])); 626 createCol(shapes, "Texture", typeof (Byte[]));
628 createCol(shapes, "ExtraParams", typeof(Byte[])); 627 createCol(shapes, "ExtraParams", typeof (Byte[]));
629 628
630 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; 629 shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
631 630
632 return shapes; 631 return shapes;
633 } 632 }
@@ -643,23 +642,23 @@ namespace OpenSim.Framework.Data.MySQL
643 private SceneObjectPart buildPrim(DataRow row) 642 private SceneObjectPart buildPrim(DataRow row)
644 { 643 {
645 SceneObjectPart prim = new SceneObjectPart(); 644 SceneObjectPart prim = new SceneObjectPart();
646 prim.UUID = new LLUUID((String)row["UUID"]); 645 prim.UUID = new LLUUID((String) row["UUID"]);
647 // explicit conversion of integers is required, which sort 646 // explicit conversion of integers is required, which sort
648 // of sucks. No idea if there is a shortcut here or not. 647 // of sucks. No idea if there is a shortcut here or not.
649 prim.ParentID = Convert.ToUInt32(row["ParentID"]); 648 prim.ParentID = Convert.ToUInt32(row["ParentID"]);
650 prim.CreationDate = Convert.ToInt32(row["CreationDate"]); 649 prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
651 prim.Name = (String)row["Name"]; 650 prim.Name = (String) row["Name"];
652 // various text fields 651 // various text fields
653 prim.Text = (String)row["Text"]; 652 prim.Text = (String) row["Text"];
654 prim.Description = (String)row["Description"]; 653 prim.Description = (String) row["Description"];
655 prim.SitName = (String)row["SitName"]; 654 prim.SitName = (String) row["SitName"];
656 prim.TouchName = (String)row["TouchName"]; 655 prim.TouchName = (String) row["TouchName"];
657 // permissions 656 // permissions
658 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); 657 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
659 prim.CreatorID = new LLUUID((String)row["CreatorID"]); 658 prim.CreatorID = new LLUUID((String) row["CreatorID"]);
660 prim.OwnerID = new LLUUID((String)row["OwnerID"]); 659 prim.OwnerID = new LLUUID((String) row["OwnerID"]);
661 prim.GroupID = new LLUUID((String)row["GroupID"]); 660 prim.GroupID = new LLUUID((String) row["GroupID"]);
662 prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); 661 prim.LastOwnerID = new LLUUID((String) row["LastOwnerID"]);
663 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); 662 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
664 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); 663 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
665 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); 664 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
@@ -701,19 +700,27 @@ namespace OpenSim.Framework.Data.MySQL
701 try 700 try
702 { 701 {
703 prim.SetSitTargetLL(new LLVector3( 702 prim.SetSitTargetLL(new LLVector3(
704 Convert.ToSingle(row["SitTargetOffsetX"]), 703 Convert.ToSingle(row["SitTargetOffsetX"]),
705 Convert.ToSingle(row["SitTargetOffsetY"]), 704 Convert.ToSingle(row["SitTargetOffsetY"]),
706 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( 705 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
707 Convert.ToSingle(row["SitTargetOrientX"]), 706 Convert.ToSingle(
708 Convert.ToSingle(row["SitTargetOrientY"]), 707 row["SitTargetOrientX"]),
709 Convert.ToSingle(row["SitTargetOrientZ"]), 708 Convert.ToSingle(
710 Convert.ToSingle(row["SitTargetOrientW"]))); 709 row["SitTargetOrientY"]),
710 Convert.ToSingle(
711 row["SitTargetOrientZ"]),
712 Convert.ToSingle(
713 row["SitTargetOrientW"])));
711 } 714 }
712 catch (System.InvalidCastException) 715 catch (InvalidCastException)
713 { 716 {
714 // Database table was created before we got here and needs to be created! :P 717 // Database table was created before we got here and needs to be created! :P
715 718
716 using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection)) 719 using (
720 MySqlCommand cmd =
721 new MySqlCommand(
722 "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;",
723 m_connection))
717 { 724 {
718 cmd.ExecuteNonQuery(); 725 cmd.ExecuteNonQuery();
719 } 726 }
@@ -725,36 +732,42 @@ namespace OpenSim.Framework.Data.MySQL
725 { 732 {
726 LandData newData = new LandData(); 733 LandData newData = new LandData();
727 734
728 newData.globalID = new LLUUID((String)row["UUID"]); 735 newData.globalID = new LLUUID((String) row["UUID"]);
729 newData.localID = Convert.ToInt32(row["LocalLandID"]); 736 newData.localID = Convert.ToInt32(row["LocalLandID"]);
730 737
731 // Bitmap is a byte[512] 738 // Bitmap is a byte[512]
732 newData.landBitmapByteArray = (Byte[])row["Bitmap"]; 739 newData.landBitmapByteArray = (Byte[]) row["Bitmap"];
733 740
734 newData.landName = (String)row["Name"]; 741 newData.landName = (String) row["Name"];
735 newData.landDesc = (String)row["Description"]; 742 newData.landDesc = (String) row["Description"];
736 newData.ownerID = (String)row["OwnerUUID"]; 743 newData.ownerID = (String) row["OwnerUUID"];
737 newData.isGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); 744 newData.isGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
738 newData.area = Convert.ToInt32(row["Area"]); 745 newData.area = Convert.ToInt32(row["Area"]);
739 newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented 746 newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
740 newData.category = (Parcel.ParcelCategory)Convert.ToInt32(row["Category"]); //Enum libsecondlife.Parcel.ParcelCategory 747 newData.category = (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]);
748 //Enum libsecondlife.Parcel.ParcelCategory
741 newData.claimDate = Convert.ToInt32(row["ClaimDate"]); 749 newData.claimDate = Convert.ToInt32(row["ClaimDate"]);
742 newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]); 750 newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]);
743 newData.groupID = new LLUUID((String)row["GroupUUID"]); 751 newData.groupID = new LLUUID((String) row["GroupUUID"]);
744 newData.salePrice = Convert.ToInt32(row["SalePrice"]); 752 newData.salePrice = Convert.ToInt32(row["SalePrice"]);
745 newData.landStatus = (Parcel.ParcelStatus)Convert.ToInt32(row["LandStatus"]); //Enum. libsecondlife.Parcel.ParcelStatus 753 newData.landStatus = (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]);
754 //Enum. libsecondlife.Parcel.ParcelStatus
746 newData.landFlags = Convert.ToUInt32(row["LandFlags"]); 755 newData.landFlags = Convert.ToUInt32(row["LandFlags"]);
747 newData.landingType = Convert.ToByte(row["LandingType"]); 756 newData.landingType = Convert.ToByte(row["LandingType"]);
748 newData.mediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); 757 newData.mediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
749 newData.mediaID = new LLUUID((String)row["MediaTextureUUID"]); 758 newData.mediaID = new LLUUID((String) row["MediaTextureUUID"]);
750 newData.mediaURL = (String)row["MediaURL"]; 759 newData.mediaURL = (String) row["MediaURL"];
751 newData.musicURL = (String)row["MusicURL"]; 760 newData.musicURL = (String) row["MusicURL"];
752 newData.passHours = Convert.ToSingle(row["PassHours"]); 761 newData.passHours = Convert.ToSingle(row["PassHours"]);
753 newData.passPrice = Convert.ToInt32(row["PassPrice"]); 762 newData.passPrice = Convert.ToInt32(row["PassPrice"]);
754 newData.snapshotID = (String)row["SnapshotUUID"]; 763 newData.snapshotID = (String) row["SnapshotUUID"];
755 764
756 newData.userLocation = new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), Convert.ToSingle(row["UserLocationZ"])); 765 newData.userLocation =
757 newData.userLookAt = new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), Convert.ToSingle(row["UserLookAtZ"])); 766 new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
767 Convert.ToSingle(row["UserLocationZ"]));
768 newData.userLookAt =
769 new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
770 Convert.ToSingle(row["UserLookAtZ"]));
758 newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); 771 newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
759 772
760 return newData; 773 return newData;
@@ -763,7 +776,7 @@ namespace OpenSim.Framework.Data.MySQL
763 private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) 776 private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
764 { 777 {
765 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 778 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
766 entry.AgentID = new LLUUID((string)row["AccessUUID"]); 779 entry.AgentID = new LLUUID((string) row["AccessUUID"]);
767 entry.Flags = (ParcelManager.AccessList) Convert.ToInt32(row["Flags"]); 780 entry.Flags = (ParcelManager.AccessList) Convert.ToInt32(row["Flags"]);
768 entry.Time = new DateTime(); 781 entry.Time = new DateTime();
769 return entry; 782 return entry;
@@ -771,7 +784,7 @@ namespace OpenSim.Framework.Data.MySQL
771 784
772 private Array serializeTerrain(double[,] val) 785 private Array serializeTerrain(double[,] val)
773 { 786 {
774 MemoryStream str = new MemoryStream(65536 * sizeof(double)); 787 MemoryStream str = new MemoryStream(65536*sizeof (double));
775 BinaryWriter bw = new BinaryWriter(str); 788 BinaryWriter bw = new BinaryWriter(str);
776 789
777 // TODO: COMPATIBILITY - Add byte-order conversions 790 // TODO: COMPATIBILITY - Add byte-order conversions
@@ -789,7 +802,8 @@ namespace OpenSim.Framework.Data.MySQL
789 row["ParentID"] = prim.ParentID; 802 row["ParentID"] = prim.ParentID;
790 row["CreationDate"] = prim.CreationDate; 803 row["CreationDate"] = prim.CreationDate;
791 row["Name"] = prim.Name; 804 row["Name"] = prim.Name;
792 row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); // the UUID of the root part for this SceneObjectGroup 805 row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID);
806 // the UUID of the root part for this SceneObjectGroup
793 // various text fields 807 // various text fields
794 row["Text"] = prim.Text; 808 row["Text"] = prim.Text;
795 row["Description"] = prim.Description; 809 row["Description"] = prim.Description;
@@ -841,18 +855,20 @@ namespace OpenSim.Framework.Data.MySQL
841 row["SitTargetOrientX"] = sitTargetOrient.X; 855 row["SitTargetOrientX"] = sitTargetOrient.X;
842 row["SitTargetOrientY"] = sitTargetOrient.Y; 856 row["SitTargetOrientY"] = sitTargetOrient.Y;
843 row["SitTargetOrientZ"] = sitTargetOrient.Z; 857 row["SitTargetOrientZ"] = sitTargetOrient.Z;
844 } 858 }
845 catch (MySql.Data.MySqlClient.MySqlException) 859 catch (MySqlException)
846 { 860 {
847 // Database table was created before we got here and needs to be created! :P 861 // Database table was created before we got here and needs to be created! :P
848 862
849 using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection)) 863 using (
864 MySqlCommand cmd =
865 new MySqlCommand(
866 "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;",
867 m_connection))
850 { 868 {
851 cmd.ExecuteNonQuery(); 869 cmd.ExecuteNonQuery();
852 } 870 }
853 } 871 }
854
855
856 } 872 }
857 873
858 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) 874 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
@@ -929,11 +945,11 @@ namespace OpenSim.Framework.Data.MySQL
929 s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); 945 s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
930 s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); 946 s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
931 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); 947 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
932 948
933 byte[] textureEntry = (byte[])row["Texture"]; 949 byte[] textureEntry = (byte[]) row["Texture"];
934 s.TextureEntry = textureEntry; 950 s.TextureEntry = textureEntry;
935 951
936 s.ExtraParams = (byte[])row["ExtraParams"]; 952 s.ExtraParams = (byte[]) row["ExtraParams"];
937 953
938 return s; 954 return s;
939 } 955 }
@@ -1146,7 +1162,7 @@ namespace OpenSim.Framework.Data.MySQL
1146 da.UpdateCommand = updateCommand; 1162 da.UpdateCommand = updateCommand;
1147 1163
1148 MySqlCommand delete = new MySqlCommand("delete from prims where UUID=?UUID"); 1164 MySqlCommand delete = new MySqlCommand("delete from prims where UUID=?UUID");
1149 delete.Parameters.Add(createMySqlParameter("UUID", typeof(String))); 1165 delete.Parameters.Add(createMySqlParameter("UUID", typeof (String)));
1150 delete.Connection = conn; 1166 delete.Connection = conn;
1151 da.DeleteCommand = delete; 1167 da.DeleteCommand = delete;
1152 } 1168 }
@@ -1181,7 +1197,7 @@ namespace OpenSim.Framework.Data.MySQL
1181 da.UpdateCommand.Connection = conn; 1197 da.UpdateCommand.Connection = conn;
1182 1198
1183 MySqlCommand delete = new MySqlCommand("delete from primshapes where UUID = ?UUID"); 1199 MySqlCommand delete = new MySqlCommand("delete from primshapes where UUID = ?UUID");
1184 delete.Parameters.Add(createMySqlParameter("UUID", typeof(String))); 1200 delete.Parameters.Add(createMySqlParameter("UUID", typeof (String)));
1185 delete.Connection = conn; 1201 delete.Connection = conn;
1186 da.DeleteCommand = delete; 1202 da.DeleteCommand = delete;
1187 } 1203 }
@@ -1337,27 +1353,27 @@ namespace OpenSim.Framework.Data.MySQL
1337 1353
1338 private DbType dbtypeFromType(Type type) 1354 private DbType dbtypeFromType(Type type)
1339 { 1355 {
1340 if (type == typeof(String)) 1356 if (type == typeof (String))
1341 { 1357 {
1342 return DbType.String; 1358 return DbType.String;
1343 } 1359 }
1344 else if (type == typeof(Int32)) 1360 else if (type == typeof (Int32))
1345 { 1361 {
1346 return DbType.Int32; 1362 return DbType.Int32;
1347 } 1363 }
1348 else if (type == typeof(Double)) 1364 else if (type == typeof (Double))
1349 { 1365 {
1350 return DbType.Double; 1366 return DbType.Double;
1351 } 1367 }
1352 else if (type == typeof(Byte)) 1368 else if (type == typeof (Byte))
1353 { 1369 {
1354 return DbType.Byte; 1370 return DbType.Byte;
1355 } 1371 }
1356 else if (type == typeof(Double)) 1372 else if (type == typeof (Double))
1357 { 1373 {
1358 return DbType.Double; 1374 return DbType.Double;
1359 } 1375 }
1360 else if (type == typeof(Byte[])) 1376 else if (type == typeof (Byte[]))
1361 { 1377 {
1362 return DbType.Binary; 1378 return DbType.Binary;
1363 } 1379 }
@@ -1371,19 +1387,19 @@ namespace OpenSim.Framework.Data.MySQL
1371 // slightly differently. 1387 // slightly differently.
1372 private string MySqlType(Type type) 1388 private string MySqlType(Type type)
1373 { 1389 {
1374 if (type == typeof(String)) 1390 if (type == typeof (String))
1375 { 1391 {
1376 return "varchar(255)"; 1392 return "varchar(255)";
1377 } 1393 }
1378 else if (type == typeof(Int32)) 1394 else if (type == typeof (Int32))
1379 { 1395 {
1380 return "integer"; 1396 return "integer";
1381 } 1397 }
1382 else if (type == typeof(Double)) 1398 else if (type == typeof (Double))
1383 { 1399 {
1384 return "float"; 1400 return "float";
1385 } 1401 }
1386 else if (type == typeof(Byte[])) 1402 else if (type == typeof (Byte[]))
1387 { 1403 {
1388 return "longblob"; 1404 return "longblob";
1389 } 1405 }
@@ -1393,4 +1409,4 @@ namespace OpenSim.Framework.Data.MySQL
1393 } 1409 }
1394 } 1410 }
1395 } 1411 }
1396} 1412} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index 7843562..7cfac12 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.Security.Cryptography; 32using System.Security.Cryptography;
33using System.Text; 33using System.Text;
34using System.Text.RegularExpressions;
34using libsecondlife; 35using libsecondlife;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
36 37
@@ -62,7 +63,7 @@ namespace OpenSim.Framework.Data.MySQL
62 database = 63 database =
63 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, 64 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
64 settingPort); 65 settingPort);
65 66
66 TestTables(); 67 TestTables();
67 } 68 }
68 69
@@ -80,7 +81,7 @@ namespace OpenSim.Framework.Data.MySQL
80 81
81 UpgradeRegionsTable(tableList["regions"]); 82 UpgradeRegionsTable(tableList["regions"]);
82 } 83 }
83 84
84 /// <summary> 85 /// <summary>
85 /// Create or upgrade the table if necessary 86 /// Create or upgrade the table if necessary
86 /// </summary> 87 /// </summary>
@@ -94,10 +95,10 @@ namespace OpenSim.Framework.Data.MySQL
94 database.ExecuteResourceSql("CreateRegionsTable.sql"); 95 database.ExecuteResourceSql("CreateRegionsTable.sql");
95 return; 96 return;
96 } 97 }
97 } 98 }
98 99
99 #endregion 100 #endregion
100 101
101 /// <summary> 102 /// <summary>
102 /// Shuts down the grid interface 103 /// Shuts down the grid interface
103 /// </summary> 104 /// </summary>
@@ -203,42 +204,41 @@ namespace OpenSim.Framework.Data.MySQL
203 return null; 204 return null;
204 } 205 }
205 } 206 }
207
206 /// <summary> 208 /// <summary>
207 /// // Returns a list of avatar and UUIDs that match the query 209 /// // Returns a list of avatar and UUIDs that match the query
208 /// </summary> 210 /// </summary>
209
210 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 211 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
211 { 212 {
212 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 213 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
213 214
214 System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); 215 Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
215 216
216 string[] querysplit; 217 string[] querysplit;
217 querysplit = query.Split(' '); 218 querysplit = query.Split(' ');
218 if (querysplit.Length == 2) 219 if (querysplit.Length == 2)
219 { 220 {
220 Dictionary<string, string> param = new Dictionary<string, string>(); 221 Dictionary<string, string> param = new Dictionary<string, string>();
221 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%"; 222 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
222 param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%"; 223 param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%";
223 try 224 try
224 { 225 {
225 lock (database) 226 lock (database)
226 { 227 {
227
228
229 IDbCommand result = 228 IDbCommand result =
230 database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param); 229 database.Query(
230 "SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100",
231 param);
231 IDataReader reader = result.ExecuteReader(); 232 IDataReader reader = result.ExecuteReader();
232 233
233 234
234 while (reader.Read()) 235 while (reader.Read())
235 { 236 {
236 AvatarPickerAvatar user = new AvatarPickerAvatar(); 237 AvatarPickerAvatar user = new AvatarPickerAvatar();
237 user.AvatarID = new LLUUID((string)reader["UUID"]); 238 user.AvatarID = new LLUUID((string) reader["UUID"]);
238 user.firstName = (string)reader["username"]; 239 user.firstName = (string) reader["username"];
239 user.lastName = (string)reader["surname"]; 240 user.lastName = (string) reader["surname"];
240 returnlist.Add(user); 241 returnlist.Add(user);
241
242 } 242 }
243 reader.Close(); 243 reader.Close();
244 result.Dispose(); 244 result.Dispose();
@@ -250,33 +250,30 @@ namespace OpenSim.Framework.Data.MySQL
250 MainLog.Instance.Error(e.ToString()); 250 MainLog.Instance.Error(e.ToString());
251 return returnlist; 251 return returnlist;
252 } 252 }
253
254
255
256 } 253 }
257 else if (querysplit.Length == 1) 254 else if (querysplit.Length == 1)
258 { 255 {
259
260 try 256 try
261 { 257 {
262 lock (database) 258 lock (database)
263 { 259 {
264 Dictionary<string, string> param = new Dictionary<string, string>(); 260 Dictionary<string, string> param = new Dictionary<string, string>();
265 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%"; 261 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
266 262
267 IDbCommand result = 263 IDbCommand result =
268 database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second", param); 264 database.Query(
265 "SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second",
266 param);
269 IDataReader reader = result.ExecuteReader(); 267 IDataReader reader = result.ExecuteReader();
270 268
271 269
272 while (reader.Read()) 270 while (reader.Read())
273 { 271 {
274 AvatarPickerAvatar user = new AvatarPickerAvatar(); 272 AvatarPickerAvatar user = new AvatarPickerAvatar();
275 user.AvatarID = new LLUUID((string)reader["UUID"]); 273 user.AvatarID = new LLUUID((string) reader["UUID"]);
276 user.firstName = (string)reader["username"]; 274 user.firstName = (string) reader["username"];
277 user.lastName = (string)reader["surname"]; 275 user.lastName = (string) reader["surname"];
278 returnlist.Add(user); 276 returnlist.Add(user);
279
280 } 277 }
281 reader.Close(); 278 reader.Close();
282 result.Dispose(); 279 result.Dispose();
@@ -413,4 +410,4 @@ namespace OpenSim.Framework.Data.MySQL
413 } 410 }
414 } 411 }
415 } 412 }
416} 413} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index a47a126..c317f4a 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -232,7 +232,7 @@ namespace OpenSim.Framework.Data.MySQL
232 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 232 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
233 while (reader.Read()) 233 while (reader.Read())
234 items.Add(readInventoryFolder(reader)); 234 items.Add(readInventoryFolder(reader));
235 235
236 InventoryFolderBase rootFolder = null; 236 InventoryFolderBase rootFolder = null;
237 237
238 // There should only ever be one root folder for a user. However, if there's more 238 // There should only ever be one root folder for a user. However, if there's more
@@ -637,4 +637,4 @@ namespace OpenSim.Framework.Data.MySQL
637 } 637 }
638 } 638 }
639 } 639 }
640} 640} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs
index eda5cc5..d2605fa 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs
@@ -103,4 +103,4 @@ namespace OpenSim.Framework.Data.MySQL
103 return "0.1"; 103 return "0.1";
104 } 104 }
105 } 105 }
106} 106} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index d652db8..96f0c4d 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -666,4 +666,4 @@ namespace OpenSim.Framework.Data.MySQL
666 return returnval; 666 return returnval;
667 } 667 }
668 } 668 }
669} 669} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 4b86d80..2d96f6e 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Text.RegularExpressions;
31using libsecondlife; 32using libsecondlife;
32using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
33 34
@@ -61,7 +62,7 @@ namespace OpenSim.Framework.Data.MySQL
61 database = 62 database =
62 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, 63 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
63 settingPort); 64 settingPort);
64 65
65 TestTables(); 66 TestTables();
66 } 67 }
67 68
@@ -81,7 +82,7 @@ namespace OpenSim.Framework.Data.MySQL
81 UpgradeAgentsTable(tableList["agents"]); 82 UpgradeAgentsTable(tableList["agents"]);
82 UpgradeUsersTable(tableList["users"]); 83 UpgradeUsersTable(tableList["users"]);
83 } 84 }
84 85
85 /// <summary> 86 /// <summary>
86 /// Create or upgrade the table if necessary 87 /// Create or upgrade the table if necessary
87 /// </summary> 88 /// </summary>
@@ -95,8 +96,8 @@ namespace OpenSim.Framework.Data.MySQL
95 database.ExecuteResourceSql("CreateAgentsTable.sql"); 96 database.ExecuteResourceSql("CreateAgentsTable.sql");
96 return; 97 return;
97 } 98 }
98 } 99 }
99 100
100 /// <summary> 101 /// <summary>
101 /// Create or upgrade the table if necessary 102 /// Create or upgrade the table if necessary
102 /// </summary> 103 /// </summary>
@@ -110,8 +111,8 @@ namespace OpenSim.Framework.Data.MySQL
110 database.ExecuteResourceSql("CreateUsersTable.sql"); 111 database.ExecuteResourceSql("CreateUsersTable.sql");
111 return; 112 return;
112 } 113 }
113 } 114 }
114 115
115 #endregion 116 #endregion
116 117
117 // see IUserData 118 // see IUserData
@@ -144,11 +145,11 @@ namespace OpenSim.Framework.Data.MySQL
144 } 145 }
145 } 146 }
146 147
147 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 148 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
148 { 149 {
149 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); 150 List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
150 151
151 System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); 152 Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
152 153
153 string[] querysplit; 154 string[] querysplit;
154 querysplit = query.Split(' '); 155 querysplit = query.Split(' ');
@@ -161,21 +162,20 @@ namespace OpenSim.Framework.Data.MySQL
161 { 162 {
162 lock (database) 163 lock (database)
163 { 164 {
164
165
166 IDbCommand result = 165 IDbCommand result =
167 database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param); 166 database.Query(
167 "SELECT UUID,username,lastname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100",
168 param);
168 IDataReader reader = result.ExecuteReader(); 169 IDataReader reader = result.ExecuteReader();
169 170
170 171
171 while (reader.Read()) 172 while (reader.Read())
172 { 173 {
173 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 174 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
174 user.AvatarID = new LLUUID((string)reader["UUID"]); 175 user.AvatarID = new LLUUID((string) reader["UUID"]);
175 user.firstName = (string)reader["username"]; 176 user.firstName = (string) reader["username"];
176 user.lastName = (string)reader["lastname"]; 177 user.lastName = (string) reader["lastname"];
177 returnlist.Add(user); 178 returnlist.Add(user);
178
179 } 179 }
180 reader.Close(); 180 reader.Close();
181 result.Dispose(); 181 result.Dispose();
@@ -187,13 +187,9 @@ namespace OpenSim.Framework.Data.MySQL
187 MainLog.Instance.Error(e.ToString()); 187 MainLog.Instance.Error(e.ToString());
188 return returnlist; 188 return returnlist;
189 } 189 }
190
191
192
193 } 190 }
194 else if (querysplit.Length == 1) 191 else if (querysplit.Length == 1)
195 { 192 {
196
197 try 193 try
198 { 194 {
199 lock (database) 195 lock (database)
@@ -202,18 +198,19 @@ namespace OpenSim.Framework.Data.MySQL
202 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%"; 198 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
203 199
204 IDbCommand result = 200 IDbCommand result =
205 database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first OR lastname like ?first LIMIT 100", param); 201 database.Query(
202 "SELECT UUID,username,lastname FROM users WHERE username like ?first OR lastname like ?first LIMIT 100",
203 param);
206 IDataReader reader = result.ExecuteReader(); 204 IDataReader reader = result.ExecuteReader();
207 205
208 206
209 while (reader.Read()) 207 while (reader.Read())
210 { 208 {
211 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 209 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
212 user.AvatarID = new LLUUID((string)reader["UUID"]); 210 user.AvatarID = new LLUUID((string) reader["UUID"]);
213 user.firstName = (string)reader["username"]; 211 user.firstName = (string) reader["username"];
214 user.lastName = (string)reader["lastname"]; 212 user.lastName = (string) reader["lastname"];
215 returnlist.Add(user); 213 returnlist.Add(user);
216
217 } 214 }
218 reader.Close(); 215 reader.Close();
219 result.Dispose(); 216 result.Dispose();
@@ -402,4 +399,4 @@ namespace OpenSim.Framework.Data.MySQL
402 return "0.1"; 399 return "0.1";
403 } 400 }
404 } 401 }
405} 402} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs
index 3723343..462c433 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs
@@ -313,4 +313,4 @@ namespace OpenSim.Framework.Data.SQLite
313 313
314 #endregion 314 #endregion
315 } 315 }
316} 316} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs
index d9aaa97..2e8d341 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs
@@ -263,4 +263,4 @@ namespace OpenSim.Framework.Data.SQLite
263 } 263 }
264 } 264 }
265 } 265 }
266} 266} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
index dddc085..4b790c3 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
@@ -130,16 +130,17 @@ namespace OpenSim.Framework.Data.SQLite
130 130
131 return row; 131 return row;
132 } 132 }
133
133 /// <summary> 134 /// <summary>
134 /// // Returns a list of avatar and UUIDs that match the query 135 /// // Returns a list of avatar and UUIDs that match the query
135 /// </summary> 136 /// </summary>
136
137 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 137 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
138 { 138 {
139 //Do nothing yet 139 //Do nothing yet
140 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 140 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
141 return returnlist; 141 return returnlist;
142 } 142 }
143
143 /// <summary> 144 /// <summary>
144 /// Adds a new specified region to the database 145 /// Adds a new specified region to the database
145 /// </summary> 146 /// </summary>
@@ -201,4 +202,4 @@ namespace OpenSim.Framework.Data.SQLite
201 return null; 202 return null;
202 } 203 }
203 } 204 }
204} 205} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index c696259..64a27f0 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -159,6 +159,7 @@ namespace OpenSim.Framework.Data.SQLite
159 159
160 invFoldersDa.Update(ds, "inventoryfolders"); 160 invFoldersDa.Update(ds, "inventoryfolders");
161 } 161 }
162
162 private void addItem(InventoryItemBase item) 163 private void addItem(InventoryItemBase item)
163 { 164 {
164 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 165 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
@@ -248,7 +249,8 @@ namespace OpenSim.Framework.Data.SQLite
248 { 249 {
249 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 250 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
250 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 251 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
251 string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" + Util.ToRawUuidString(LLUUID.Zero) + "'"; 252 string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" +
253 Util.ToRawUuidString(LLUUID.Zero) + "'";
252 DataRow[] rows = inventoryFolderTable.Select(selectExp); 254 DataRow[] rows = inventoryFolderTable.Select(selectExp);
253 foreach (DataRow row in rows) 255 foreach (DataRow row in rows)
254 { 256 {
@@ -627,4 +629,4 @@ namespace OpenSim.Framework.Data.SQLite
627 return true; 629 return true;
628 } 630 }
629 } 631 }
630} 632} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs
index cac37d4..a97b146 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs
@@ -275,4 +275,4 @@ namespace OpenSim.Framework.Data.SQLite
275 return returnval; 275 return returnval;
276 } 276 }
277 } 277 }
278} 278} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
index 811e0fa..a719fa2 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using libsecondlife; 31using libsecondlife;
32using Mono.Data.SqliteClient; 32using Mono.Data.SqliteClient;
33using OpenSim.Framework;
34using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
35 34
36namespace OpenSim.Framework.Data.SQLite 35namespace OpenSim.Framework.Data.SQLite
@@ -38,7 +37,6 @@ namespace OpenSim.Framework.Data.SQLite
38 /// <summary> 37 /// <summary>
39 /// A User storage interface for the SQLite database system 38 /// A User storage interface for the SQLite database system
40 /// </summary> 39 /// </summary>
41
42 public class SQLiteUserData : SQLiteBase, IUserData 40 public class SQLiteUserData : SQLiteBase, IUserData
43 { 41 {
44 /// <summary> 42 /// <summary>
@@ -119,46 +117,46 @@ namespace OpenSim.Framework.Data.SQLite
119 } 117 }
120 } 118 }
121 119
122 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 120 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
123 { 121 {
124 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); 122 List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
125 string[] querysplit; 123 string[] querysplit;
126 querysplit = query.Split(' '); 124 querysplit = query.Split(' ');
127 if (querysplit.Length == 2) 125 if (querysplit.Length == 2)
128 { 126 {
129 string select = "username like '" + querysplit[0] + "%' and surname like '" + querysplit[1] + "%'"; 127 string select = "username like '" + querysplit[0] + "%' and surname like '" + querysplit[1] + "%'";
130 lock(ds) 128 lock (ds)
131 { 129 {
132 DataRow[] rows = ds.Tables["users"].Select(select); 130 DataRow[] rows = ds.Tables["users"].Select(select);
133 if (rows.Length > 0) 131 if (rows.Length > 0)
134 { 132 {
135 for (int i = 0; i < rows.Length; i++) 133 for (int i = 0; i < rows.Length; i++)
136 { 134 {
137 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 135 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
138 DataRow row = rows[i]; 136 DataRow row = rows[i];
139 user.AvatarID = new LLUUID((string)row["UUID"]); 137 user.AvatarID = new LLUUID((string) row["UUID"]);
140 user.firstName = (string)row["username"]; 138 user.firstName = (string) row["username"];
141 user.lastName = (string)row["surname"]; 139 user.lastName = (string) row["surname"];
142 returnlist.Add(user); 140 returnlist.Add(user);
143 } 141 }
144 } 142 }
145 } 143 }
146 } 144 }
147 else if (querysplit.Length == 1) 145 else if (querysplit.Length == 1)
148 { 146 {
149
150 string select = "username like '" + querysplit[0] + "%' OR surname like '" + querysplit[0] + "%'"; 147 string select = "username like '" + querysplit[0] + "%' OR surname like '" + querysplit[0] + "%'";
151 lock(ds) 148 lock (ds)
152 { 149 {
153 DataRow[] rows = ds.Tables["users"].Select(select); 150 DataRow[] rows = ds.Tables["users"].Select(select);
154 if (rows.Length > 0) 151 if (rows.Length > 0)
155 { 152 {
156 for (int i = 0;i<rows.Length;i++) { 153 for (int i = 0; i < rows.Length; i++)
157 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 154 {
155 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
158 DataRow row = rows[i]; 156 DataRow row = rows[i];
159 user.AvatarID = new LLUUID((string)row[0]); 157 user.AvatarID = new LLUUID((string) row[0]);
160 user.firstName = (string)row[1]; 158 user.firstName = (string) row[1];
161 user.lastName = (string)row[2]; 159 user.lastName = (string) row[2];
162 returnlist.Add(user); 160 returnlist.Add(user);
163 } 161 }
164 } 162 }
@@ -166,6 +164,7 @@ namespace OpenSim.Framework.Data.SQLite
166 } 164 }
167 return returnlist; 165 return returnlist;
168 } 166 }
167
169 /// <summary> 168 /// <summary>
170 /// Returns a user by UUID direct 169 /// Returns a user by UUID direct
171 /// </summary> 170 /// </summary>
@@ -263,7 +262,6 @@ namespace OpenSim.Framework.Data.SQLite
263 } 262 }
264 else 263 else
265 { 264 {
266
267 row.Delete(); 265 row.Delete();
268 ua.AcceptChanges(); 266 ua.AcceptChanges();
269 } 267 }
@@ -595,4 +593,4 @@ namespace OpenSim.Framework.Data.SQLite
595 return true; 593 return true;
596 } 594 }
597 } 595 }
598} 596} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs
index 7864dda..6072600 100644
--- a/OpenSim/Framework/Data/GridData.cs
+++ b/OpenSim/Framework/Data/GridData.cs
@@ -25,8 +25,8 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife;
29using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife;
30 30
31namespace OpenSim.Framework.Data 31namespace OpenSim.Framework.Data
32{ 32{
@@ -35,10 +35,12 @@ namespace OpenSim.Framework.Data
35 public LLUUID AvatarID; 35 public LLUUID AvatarID;
36 public string firstName; 36 public string firstName;
37 public string lastName; 37 public string lastName;
38
38 public AvatarPickerAvatar() 39 public AvatarPickerAvatar()
39 { 40 {
40 } 41 }
41 } 42 }
43
42 public enum DataResponse 44 public enum DataResponse
43 { 45 {
44 RESPONSE_OK, 46 RESPONSE_OK,
@@ -78,6 +80,7 @@ namespace OpenSim.Framework.Data
78 80
79 81
80 List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); 82 List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
83
81 /// <summary> 84 /// <summary>
82 /// Authenticates a sim by use of its recv key. 85 /// Authenticates a sim by use of its recv key.
83 /// WARNING: Insecure 86 /// WARNING: Insecure
@@ -119,4 +122,4 @@ namespace OpenSim.Framework.Data
119 122
120 ReservationData GetReservationAtPoint(uint x, uint y); 123 ReservationData GetReservationAtPoint(uint x, uint y);
121 } 124 }
122} 125} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/ILogData.cs b/OpenSim/Framework/Data/ILogData.cs
index 2c05f4f..8765b5c 100644
--- a/OpenSim/Framework/Data/ILogData.cs
+++ b/OpenSim/Framework/Data/ILogData.cs
@@ -88,4 +88,4 @@ namespace OpenSim.Framework.Data
88 /// <returns>A string containing the plugin version</returns> 88 /// <returns>A string containing the plugin version</returns>
89 string getVersion(); 89 string getVersion();
90 } 90 }
91} 91} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/IniConfig.cs b/OpenSim/Framework/Data/IniConfig.cs
index 6b02553..6af9770 100644
--- a/OpenSim/Framework/Data/IniConfig.cs
+++ b/OpenSim/Framework/Data/IniConfig.cs
@@ -95,4 +95,4 @@ namespace OpenSim.Framework.Data
95 95
96 private string _iniFileName; 96 private string _iniFileName;
97 } 97 }
98} 98} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs
index a1fe901..ec50baa 100644
--- a/OpenSim/Framework/Data/RegionProfileData.cs
+++ b/OpenSim/Framework/Data/RegionProfileData.cs
@@ -198,4 +198,4 @@ namespace OpenSim.Framework.Data
198 return simData; 198 return simData;
199 } 199 }
200 } 200 }
201} 201} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/ReservationData.cs b/OpenSim/Framework/Data/ReservationData.cs
index acab400..285f9ca 100644
--- a/OpenSim/Framework/Data/ReservationData.cs
+++ b/OpenSim/Framework/Data/ReservationData.cs
@@ -44,4 +44,4 @@ namespace OpenSim.Framework.Data
44 public string gridSendKey = ""; 44 public string gridSendKey = "";
45 public string gridRecvKey = ""; 45 public string gridRecvKey = "";
46 } 46 }
47} 47} \ No newline at end of file