diff options
Diffstat (limited to 'OpenSim/Framework/Data.SQLite')
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | 11 | ||||
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | 53 |
2 files changed, 63 insertions, 1 deletions
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index 8f3e8aa..b8fc639 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | |||
@@ -130,7 +130,16 @@ namespace OpenSim.Framework.Data.SQLite | |||
130 | 130 | ||
131 | return row; | 131 | return row; |
132 | } | 132 | } |
133 | 133 | /// <summary> | |
134 | /// // Returns a list of avatar and UUIDs that match the query | ||
135 | /// </summary> | ||
136 | |||
137 | public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) | ||
138 | { | ||
139 | //Do nothing yet | ||
140 | List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); | ||
141 | return returnlist; | ||
142 | } | ||
134 | /// <summary> | 143 | /// <summary> |
135 | /// Adds a new specified region to the database | 144 | /// Adds a new specified region to the database |
136 | /// </summary> | 145 | /// </summary> |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index d7a6b39..1385ffc 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | |||
@@ -26,16 +26,22 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Data; | 30 | using System.Data; |
30 | using libsecondlife; | 31 | using libsecondlife; |
31 | using Mono.Data.SqliteClient; | 32 | using Mono.Data.SqliteClient; |
33 | using OpenSim.Framework; | ||
32 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
33 | 35 | ||
36 | |||
34 | namespace OpenSim.Framework.Data.SQLite | 37 | namespace OpenSim.Framework.Data.SQLite |
35 | { | 38 | { |
36 | /// <summary> | 39 | /// <summary> |
37 | /// A User storage interface for the DB4o database system | 40 | /// A User storage interface for the DB4o database system |
38 | /// </summary> | 41 | /// </summary> |
42 | /// | ||
43 | |||
44 | |||
39 | public class SQLiteUserData : SQLiteBase, IUserData | 45 | public class SQLiteUserData : SQLiteBase, IUserData |
40 | { | 46 | { |
41 | /// <summary> | 47 | /// <summary> |
@@ -135,6 +141,53 @@ namespace OpenSim.Framework.Data.SQLite | |||
135 | } | 141 | } |
136 | } | 142 | } |
137 | 143 | ||
144 | public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) | ||
145 | { | ||
146 | List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); | ||
147 | string[] querysplit; | ||
148 | querysplit = query.Split(' '); | ||
149 | if (querysplit.Length == 2) | ||
150 | { | ||
151 | string select = "username like '" + querysplit[0] + "%' and surname like '" + querysplit[1] + "%'"; | ||
152 | lock(ds) | ||
153 | { | ||
154 | DataRow[] rows = ds.Tables["users"].Select(select); | ||
155 | if (rows.Length > 0) | ||
156 | { | ||
157 | for (int i = 0; i < rows.Length; i++) | ||
158 | { | ||
159 | OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); | ||
160 | DataRow row = rows[i]; | ||
161 | user.AvatarID = new LLUUID((string)row["UUID"]); | ||
162 | user.firstName = (string)row["username"]; | ||
163 | user.lastName = (string)row["surname"]; | ||
164 | returnlist.Add(user); | ||
165 | } | ||
166 | } | ||
167 | } | ||
168 | } | ||
169 | else if (querysplit.Length == 1) | ||
170 | { | ||
171 | |||
172 | string select = "username like '" + querysplit[0] + "%' OR surname like '" + querysplit[0] + "%'"; | ||
173 | lock(ds) | ||
174 | { | ||
175 | DataRow[] rows = ds.Tables["users"].Select(select); | ||
176 | if (rows.Length > 0) | ||
177 | { | ||
178 | for (int i = 0;i<rows.Length;i++) { | ||
179 | OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); | ||
180 | DataRow row = rows[i]; | ||
181 | user.AvatarID = new LLUUID((string)row[0]); | ||
182 | user.firstName = (string)row[1]; | ||
183 | user.lastName = (string)row[2]; | ||
184 | returnlist.Add(user); | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | } | ||
189 | return returnlist; | ||
190 | } | ||
138 | /// <summary> | 191 | /// <summary> |
139 | /// Returns a user by UUID direct | 192 | /// Returns a user by UUID direct |
140 | /// </summary> | 193 | /// </summary> |