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