aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/PGSQL/PGSQLUserAccountData.cs')
-rw-r--r--OpenSim/Data/PGSQL/PGSQLUserAccountData.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs b/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs
index a5868fe..a2b5a2a 100644
--- a/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs
@@ -298,22 +298,26 @@ namespace OpenSim.Data.PGSQL
298 return new UserAccountData[0]; 298 return new UserAccountData[0];
299 299
300 string sql = ""; 300 string sql = "";
301 UUID scope_id;
302 UUID.TryParse(scopeID.ToString(), out scope_id);
301 303
302 using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) 304 using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
303 using (NpgsqlCommand cmd = new NpgsqlCommand()) 305 using (NpgsqlCommand cmd = new NpgsqlCommand())
304 { 306 {
305 if (words.Length == 1) 307 if (words.Length == 1)
306 { 308 {
307 sql = String.Format(@"select * from {0} where (""ScopeID""=:ScopeID or ""ScopeID""='00000000-0000-0000-0000-000000000000') and (""FirstName"" ilike :search or ""LastName"" ilike :search)", m_Realm); 309 sql = String.Format(@"select * from {0} where (""ScopeID""=:ScopeID or ""ScopeID""=:UUIDZero) and (""FirstName"" ilike :search or ""LastName"" ilike :search)", m_Realm);
308 cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); 310 cmd.Parameters.Add(m_database.CreateParameter("scopeID", (UUID)scope_id));
311 cmd.Parameters.Add (m_database.CreateParameter("UUIDZero", (UUID)UUID.Zero));
309 cmd.Parameters.Add(m_database.CreateParameter("search", "%" + words[0] + "%")); 312 cmd.Parameters.Add(m_database.CreateParameter("search", "%" + words[0] + "%"));
310 } 313 }
311 else 314 else
312 { 315 {
313 sql = String.Format(@"select * from {0} where (""ScopeID""=:ScopeID or ""ScopeID""='00000000-0000-0000-0000-000000000000') and (""FirstName"" ilike :searchFirst or ""LastName"" ilike :searchLast)", m_Realm); 316 sql = String.Format(@"select * from {0} where (""ScopeID""=:ScopeID or ""ScopeID""=:UUIDZero) and (""FirstName"" ilike :searchFirst or ""LastName"" ilike :searchLast)", m_Realm);
314 cmd.Parameters.Add(m_database.CreateParameter("searchFirst", "%" + words[0] + "%")); 317 cmd.Parameters.Add(m_database.CreateParameter("searchFirst", "%" + words[0] + "%"));
315 cmd.Parameters.Add(m_database.CreateParameter("searchLast", "%" + words[1] + "%")); 318 cmd.Parameters.Add(m_database.CreateParameter("searchLast", "%" + words[1] + "%"));
316 cmd.Parameters.Add(m_database.CreateParameter("ScopeID", scopeID.ToString())); 319 cmd.Parameters.Add (m_database.CreateParameter("UUIDZero", (UUID)UUID.Zero));
320 cmd.Parameters.Add(m_database.CreateParameter("ScopeID", (UUID)scope_id));
317 } 321 }
318 cmd.Connection = conn; 322 cmd.Connection = conn;
319 cmd.CommandText = sql; 323 cmd.CommandText = sql;