aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-04 16:07:59 +0000
committerTeravus Ovares2007-12-04 16:07:59 +0000
commita553e6f67ce2595868ceba0184f730af640961cf (patch)
tree38de3c5b956d829064e541f671a5d8f0b2d935f4 /OpenSim/Framework/Data.MySQL/MySQLUserData.cs
parent* ApplyPhysics now creates the PhysActor as well. (diff)
downloadopensim-SC_OLD-a553e6f67ce2595868ceba0184f730af640961cf.zip
opensim-SC_OLD-a553e6f67ce2595868ceba0184f730af640961cf.tar.gz
opensim-SC_OLD-a553e6f67ce2595868ceba0184f730af640961cf.tar.bz2
opensim-SC_OLD-a553e6f67ce2595868ceba0184f730af640961cf.tar.xz
* Avatar picker works in grid mode now.
* To test, click the communicate button, then click the 'add' button and type a name. You will get a list of closely matching avatar names. * Before this'll work on your sim in grid mode, the UGA needs to be updated. If it isn't updated, then you'll get a message on the sim console when searching like, 'got invalid queryid'.
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLUserData.cs')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs27
1 files changed, 15 insertions, 12 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 3ae1fba..3138911 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -110,31 +110,35 @@ namespace OpenSim.Framework.Data.MySQL
110 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 110 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
111 { 111 {
112 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); 112 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>();
113
114 System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]");
115
113 string[] querysplit; 116 string[] querysplit;
114 querysplit = query.Split(' '); 117 querysplit = query.Split(' ');
115 if (querysplit.Length == 2) 118 if (querysplit.Length == 2)
116 { 119 {
120 Dictionary<string, string> param = new Dictionary<string, string>();
121 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
122 param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%";
117 try 123 try
118 { 124 {
119 lock (database) 125 lock (database)
120 { 126 {
121 Dictionary<string, string> param = new Dictionary<string, string>(); 127
122 param["?first"] = querysplit[0];
123 param["?second"] = querysplit[1];
124 128
125 IDbCommand result = 129 IDbCommand result =
126 database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param); 130 database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param);
127 IDataReader reader = result.ExecuteReader(); 131 IDataReader reader = result.ExecuteReader();
128 132
129 133
130 while (reader.Read()) 134 while (reader.Read())
131 { 135 {
132 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 136 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
133 user.AvatarID = new LLUUID((string)reader["UUID"]); 137 user.AvatarID = new LLUUID((string)reader["UUID"]);
134 user.firstName = (string)reader["username"]; 138 user.firstName = (string)reader["username"];
135 user.lastName = (string)reader["surname"]; 139 user.lastName = (string)reader["lastname"];
136 returnlist.Add(user); 140 returnlist.Add(user);
137 141
138 } 142 }
139 reader.Close(); 143 reader.Close();
140 result.Dispose(); 144 result.Dispose();
@@ -148,7 +152,7 @@ namespace OpenSim.Framework.Data.MySQL
148 } 152 }
149 153
150 154
151 155
152 } 156 }
153 else if (querysplit.Length == 1) 157 else if (querysplit.Length == 1)
154 { 158 {
@@ -158,11 +162,10 @@ namespace OpenSim.Framework.Data.MySQL
158 lock (database) 162 lock (database)
159 { 163 {
160 Dictionary<string, string> param = new Dictionary<string, string>(); 164 Dictionary<string, string> param = new Dictionary<string, string>();
161 param["?first"] = querysplit[0]; 165 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
162 param["?second"] = querysplit[1];
163 166
164 IDbCommand result = 167 IDbCommand result =
165 database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param); 168 database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first OR lastname like ?first LIMIT 100", param);
166 IDataReader reader = result.ExecuteReader(); 169 IDataReader reader = result.ExecuteReader();
167 170
168 171
@@ -171,7 +174,7 @@ namespace OpenSim.Framework.Data.MySQL
171 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 174 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
172 user.AvatarID = new LLUUID((string)reader["UUID"]); 175 user.AvatarID = new LLUUID((string)reader["UUID"]);
173 user.firstName = (string)reader["username"]; 176 user.firstName = (string)reader["username"];
174 user.lastName = (string)reader["surname"]; 177 user.lastName = (string)reader["lastname"];
175 returnlist.Add(user); 178 returnlist.Add(user);
176 179
177 } 180 }