aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs46
1 files changed, 21 insertions, 25 deletions
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