aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712008-02-13 13:39:51 +0000
committerlbsa712008-02-13 13:39:51 +0000
commit4880bd121e737e0a5c384fddf61bd220c77ef88a (patch)
treec3597cb34642611869ff26c559708a45956fa4cc
parent* Added openlifegrid.com to testers and patchers (diff)
downloadopensim-SC_OLD-4880bd121e737e0a5c384fddf61bd220c77ef88a.zip
opensim-SC_OLD-4880bd121e737e0a5c384fddf61bd220c77ef88a.tar.gz
opensim-SC_OLD-4880bd121e737e0a5c384fddf61bd220c77ef88a.tar.bz2
opensim-SC_OLD-4880bd121e737e0a5c384fddf61bd220c77ef88a.tar.xz
* Split out MSSQLManager Test/Init into each provider.
* Made regions table name configurable (MSSQL only) * Added a note in ini.example pointing out that the sql resources have to change if you change table names * Removed duplicate picker method from GridData interface [Provided by openlifegrid.com]
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs127
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs15
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLManager.cs67
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs54
-rw-r--r--OpenSim/Framework/Data.MSSQL/Resources/Mssql-regions.sql41
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs86
-rw-r--r--OpenSim/Framework/Data/GridData.cs3
-rw-r--r--bin/mssql_connection.ini.example4
-rw-r--r--bin/mysql_connection.ini.example1
9 files changed, 142 insertions, 256 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
index 28eec3e..0df88b6 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
@@ -47,21 +47,48 @@ namespace OpenSim.Framework.Data.MSSQL
47 /// </summary> 47 /// </summary>
48 private MSSQLManager database; 48 private MSSQLManager database;
49 49
50 private string m_regionsTableName;
51
50 /// <summary> 52 /// <summary>
51 /// Initialises the Grid Interface 53 /// Initialises the Grid Interface
52 /// </summary> 54 /// </summary>
53 public void Initialise() 55 public void Initialise()
54 { 56 {
55 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); 57 IniFile iniFile = new IniFile("mssql_connection.ini");
56 string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); 58
57 string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); 59 string settingDataSource = iniFile.ParseFileReadValue("data_source");
58 string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info"); 60 string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
59 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 61 string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info");
60 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 62 string settingUserId = iniFile.ParseFileReadValue("user_id");
63 string settingPassword = iniFile.ParseFileReadValue("password");
64
65 m_regionsTableName = iniFile.ParseFileReadValue("regionstablename");
66 if (m_regionsTableName == null)
67 {
68 m_regionsTableName = "regions";
69 }
61 70
62 database = 71 database =
63 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, 72 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
64 settingPassword); 73 settingPassword);
74
75 TestTables();
76 }
77
78 private void TestTables()
79 {
80 IDbCommand cmd = database.Query("SELECT * FROM "+m_regionsTableName, new Dictionary<string, string>());
81
82 try
83 {
84 cmd.ExecuteNonQuery();
85 cmd.Dispose();
86 }
87 catch (Exception)
88 {
89 m_log.Info("[DATASTORE]: MSSQL Database doesn't exist... creating");
90 database.ExecuteResourceSql("Mssql-regions.sql");
91 }
65 } 92 }
66 93
67 /// <summary> 94 /// <summary>
@@ -115,7 +142,7 @@ namespace OpenSim.Framework.Data.MSSQL
115 { 142 {
116 Dictionary<string, string> param = new Dictionary<string, string>(); 143 Dictionary<string, string> param = new Dictionary<string, string>();
117 param["handle"] = handle.ToString(); 144 param["handle"] = handle.ToString();
118 IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = @handle", param); 145 IDbCommand result = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE regionHandle = @handle", param);
119 reader = result.ExecuteReader(); 146 reader = result.ExecuteReader();
120 147
121 RegionProfileData row = database.getRegionRow(reader); 148 RegionProfileData row = database.getRegionRow(reader);
@@ -134,89 +161,7 @@ namespace OpenSim.Framework.Data.MSSQL
134 return null; 161 return null;
135 } 162 }
136 163
137 /// <summary> 164
138 /// // Returns a list of avatar and UUIDs that match the query
139 /// </summary>
140 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
141 {
142 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
143 string[] querysplit;
144 querysplit = query.Split(' ');
145 if (querysplit.Length == 2)
146 {
147 try
148 {
149 lock (database)
150 {
151 Dictionary<string, string> param = new Dictionary<string, string>();
152 param["first"] = querysplit[0];
153 param["second"] = querysplit[1];
154
155 IDbCommand result =
156 database.Query(
157 "SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second",
158 param);
159 IDataReader reader = result.ExecuteReader();
160
161
162 while (reader.Read())
163 {
164 AvatarPickerAvatar user = new AvatarPickerAvatar();
165 user.AvatarID = new LLUUID((string) reader["UUID"]);
166 user.firstName = (string) reader["username"];
167 user.lastName = (string) reader["surname"];
168 returnlist.Add(user);
169 }
170 reader.Close();
171 result.Dispose();
172 }
173 }
174 catch (Exception e)
175 {
176 database.Reconnect();
177 m_log.Error(e.ToString());
178 return returnlist;
179 }
180 }
181 else if (querysplit.Length == 1)
182 {
183 try
184 {
185 lock (database)
186 {
187 Dictionary<string, string> param = new Dictionary<string, string>();
188 param["first"] = querysplit[0];
189 param["second"] = querysplit[1];
190
191 IDbCommand result =
192 database.Query(
193 "SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second",
194 param);
195 IDataReader reader = result.ExecuteReader();
196
197
198 while (reader.Read())
199 {
200 AvatarPickerAvatar user = new AvatarPickerAvatar();
201 user.AvatarID = new LLUUID((string) reader["UUID"]);
202 user.firstName = (string) reader["username"];
203 user.lastName = (string) reader["surname"];
204 returnlist.Add(user);
205 }
206 reader.Close();
207 result.Dispose();
208 }
209 }
210 catch (Exception e)
211 {
212 database.Reconnect();
213 m_log.Error(e.ToString());
214 return returnlist;
215 }
216 }
217 return returnlist;
218 }
219
220 /// <summary> 165 /// <summary>
221 /// Returns a sim profile from it's UUID 166 /// Returns a sim profile from it's UUID
222 /// </summary> 167 /// </summary>
@@ -226,7 +171,7 @@ namespace OpenSim.Framework.Data.MSSQL
226 { 171 {
227 Dictionary<string, string> param = new Dictionary<string, string>(); 172 Dictionary<string, string> param = new Dictionary<string, string>();
228 param["uuid"] = uuid.ToString(); 173 param["uuid"] = uuid.ToString();
229 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); 174 IDbCommand result = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE uuid = @uuid", param);
230 IDataReader reader = result.ExecuteReader(); 175 IDataReader reader = result.ExecuteReader();
231 176
232 RegionProfileData row = database.getRegionRow(reader); 177 RegionProfileData row = database.getRegionRow(reader);
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs
index c3ec7c6..1e83496 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs
@@ -25,6 +25,9 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic;
29using System.Data;
30
28namespace OpenSim.Framework.Data.MSSQL 31namespace OpenSim.Framework.Data.MSSQL
29{ 32{
30 /// <summary> 33 /// <summary>
@@ -52,6 +55,18 @@ namespace OpenSim.Framework.Data.MSSQL
52 database = 55 database =
53 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, 56 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
54 settingPassword); 57 settingPassword);
58
59 IDbCommand cmd = database.Query("select top 1 * from logs", new Dictionary<string, string>());
60 try
61 {
62 cmd.ExecuteNonQuery();
63 cmd.Dispose();
64 }
65 catch
66 {
67 database.ExecuteResourceSql("Mssql-logs.sql");
68 }
69
55 } 70 }
56 71
57 /// <summary> 72 /// <summary>
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
index e54cde1..5c3e94f 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
@@ -52,16 +52,8 @@ namespace OpenSim.Framework.Data.MSSQL
52 /// <summary> 52 /// <summary>
53 /// Connection string for ADO.net 53 /// Connection string for ADO.net
54 /// </summary> 54 /// </summary>
55 private string connectionString; 55 private readonly string connectionString;
56 56
57 /// <summary>
58 /// Initialises and creates a new Sql connection and maintains it.
59 /// </summary>
60 /// <param name="hostname">The Sql server being connected to</param>
61 /// <param name="database">The name of the Sql database being used</param>
62 /// <param name="username">The username logging into the database</param>
63 /// <param name="password">The password for the user logging in</param>
64 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
65 public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId, 57 public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId,
66 string password) 58 string password)
67 { 59 {
@@ -71,7 +63,6 @@ namespace OpenSim.Framework.Data.MSSQL
71 ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" + 63 ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" +
72 password + ";"; 64 password + ";";
73 dbcon = new SqlConnection(connectionString); 65 dbcon = new SqlConnection(connectionString);
74 TestTables(dbcon);
75 dbcon.Open(); 66 dbcon.Open();
76 } 67 }
77 catch (Exception e) 68 catch (Exception e)
@@ -80,61 +71,6 @@ namespace OpenSim.Framework.Data.MSSQL
80 } 71 }
81 } 72 }
82 73
83 private bool TestTables(IDbConnection conn)
84 {
85 IDbCommand cmd = Query("SELECT * FROM regions", new Dictionary<string, string>());
86 //SqlCommand cmd = (SqlCommand)dbcon.CreateCommand();
87 //cmd.CommandText = "SELECT * FROM regions";
88 try
89 {
90 conn.Open();
91 cmd.ExecuteNonQuery();
92 cmd.Dispose();
93 conn.Close();
94 }
95 catch (Exception)
96 {
97 m_log.Info("[DATASTORE]: MSSQL Database doesn't exist... creating");
98 InitDB(conn);
99 }
100 cmd = Query("select top 1 webLoginKey from users", new Dictionary<string, string>());
101 try
102 {
103 conn.Open();
104 cmd.ExecuteNonQuery();
105 cmd.Dispose();
106 conn.Close();
107 }
108 catch (Exception)
109 {
110 conn.Open();
111 cmd = Query("alter table users add column [webLoginKey] varchar(36) default NULL", new Dictionary<string, string>());
112 cmd.ExecuteNonQuery();
113 cmd.Dispose();
114 conn.Close();
115 }
116 return true;
117 }
118
119 private void InitDB(IDbConnection conn)
120 {
121 string createRegions = defineTable(createRegionsTable());
122 Dictionary<string, string> param = new Dictionary<string, string>();
123 IDbCommand pcmd = Query(createRegions, param);
124 if (conn.State == ConnectionState.Closed)
125 {
126 conn.Open();
127 }
128 pcmd.ExecuteNonQuery();
129 pcmd.Dispose();
130
131 ExecuteResourceSql("Mssql-users.sql");
132 ExecuteResourceSql("Mssql-agents.sql");
133 ExecuteResourceSql("Mssql-logs.sql");
134
135 conn.Close();
136 }
137
138 private DataTable createRegionsTable() 74 private DataTable createRegionsTable()
139 { 75 {
140 DataTable regions = new DataTable("regions"); 76 DataTable regions = new DataTable("regions");
@@ -253,7 +189,6 @@ namespace OpenSim.Framework.Data.MSSQL
253 { 189 {
254 try 190 try
255 { 191 {
256 //string connectionString = "Data Source=WRK-OU-738\\SQLEXPRESS;Initial Catalog=rex;Persist Security Info=True;User ID=sa;Password=rex";
257 // Close the DB connection 192 // Close the DB connection
258 dbcon.Close(); 193 dbcon.Close();
259 // Try reopen it 194 // Try reopen it
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index 60e6df4..aacbb2d 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -85,8 +85,42 @@ namespace OpenSim.Framework.Data.MSSQL
85 database = 85 database =
86 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, 86 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
87 settingPassword); 87 settingPassword);
88
89 if (!TestTables())
90 {
91 database.ExecuteResourceSql("Mssql-agents.sql");
92 database.ExecuteResourceSql("Mssql-users.sql");
93 database.ExecuteResourceSql("Mssql-userfriends.sql");
94 }
88 } 95 }
89 96
97 private bool TestTables()
98 {
99 IDbCommand cmd = database.Query("select top 1 webLoginKey from "+m_usersTableName, new Dictionary<string, string>());
100 try
101 {
102 cmd.ExecuteNonQuery();
103 cmd.Dispose();
104 }
105 catch
106 {
107 database.Query("alter table "+m_usersTableName+" add column [webLoginKey] varchar(36) default NULL", new Dictionary<string, string>());
108 cmd.ExecuteNonQuery();
109 cmd.Dispose();
110 }
111
112 cmd = database.Query("select top 1 * from "+m_usersTableName, new Dictionary<string, string>());
113 try
114 {
115 cmd.ExecuteNonQuery();
116 }
117 catch
118 {
119 return false;
120 }
121
122 return true;
123 }
90 /// <summary> 124 /// <summary>
91 /// Searches the database for a specified user profile by name components 125 /// Searches the database for a specified user profile by name components
92 /// </summary> 126 /// </summary>
@@ -104,7 +138,7 @@ namespace OpenSim.Framework.Data.MSSQL
104 param["second"] = last; 138 param["second"] = last;
105 139
106 IDbCommand result = 140 IDbCommand result =
107 database.Query("SELECT * FROM "+m_usersTableName+" WHERE username = @first AND lastname = @second", param); 141 database.Query("SELECT * FROM " + m_usersTableName + " WHERE username = @first AND lastname = @second", param);
108 IDataReader reader = result.ExecuteReader(); 142 IDataReader reader = result.ExecuteReader();
109 143
110 UserProfileData row = database.readUserRow(reader); 144 UserProfileData row = database.readUserRow(reader);
@@ -153,7 +187,7 @@ namespace OpenSim.Framework.Data.MSSQL
153 m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); 187 m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called");
154 } 188 }
155 189
156 190
157 191
158 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 192 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
159 { 193 {
@@ -180,9 +214,9 @@ namespace OpenSim.Framework.Data.MSSQL
180 while (reader.Read()) 214 while (reader.Read())
181 { 215 {
182 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); 216 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
183 user.AvatarID = new LLUUID((string) reader["UUID"]); 217 user.AvatarID = new LLUUID((string)reader["UUID"]);
184 user.firstName = (string) reader["username"]; 218 user.firstName = (string)reader["username"];
185 user.lastName = (string) reader["surname"]; 219 user.lastName = (string)reader["surname"];
186 returnlist.Add(user); 220 returnlist.Add(user);
187 } 221 }
188 reader.Close(); 222 reader.Close();
@@ -216,9 +250,9 @@ namespace OpenSim.Framework.Data.MSSQL
216 while (reader.Read()) 250 while (reader.Read())
217 { 251 {
218 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); 252 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
219 user.AvatarID = new LLUUID((string) reader["UUID"]); 253 user.AvatarID = new LLUUID((string)reader["UUID"]);
220 user.firstName = (string) reader["username"]; 254 user.firstName = (string)reader["username"];
221 user.lastName = (string) reader["surname"]; 255 user.lastName = (string)reader["surname"];
222 returnlist.Add(user); 256 returnlist.Add(user);
223 } 257 }
224 reader.Close(); 258 reader.Close();
@@ -323,7 +357,7 @@ namespace OpenSim.Framework.Data.MSSQL
323 UserProfileData user = GetUserByUUID(AgentID); 357 UserProfileData user = GetUserByUUID(AgentID);
324 user.webLoginKey = WebLoginKey; 358 user.webLoginKey = WebLoginKey;
325 UpdateUserProfile(user); 359 UpdateUserProfile(user);
326 360
327 } 361 }
328 /// <summary> 362 /// <summary>
329 /// Creates a new users profile 363 /// Creates a new users profile
@@ -342,7 +376,7 @@ namespace OpenSim.Framework.Data.MSSQL
342 user.lastLogin, user.userInventoryURI, user.userAssetURI, 376 user.lastLogin, user.userInventoryURI, user.userAssetURI,
343 user.profileCanDoMask, user.profileWantDoMask, 377 user.profileCanDoMask, user.profileWantDoMask,
344 user.profileAboutText, user.profileFirstText, user.profileImage, 378 user.profileAboutText, user.profileFirstText, user.profileImage,
345 user.profileFirstImage,user.webLoginKey); 379 user.profileFirstImage, user.webLoginKey);
346 } 380 }
347 } 381 }
348 catch (Exception e) 382 catch (Exception e)
diff --git a/OpenSim/Framework/Data.MSSQL/Resources/Mssql-regions.sql b/OpenSim/Framework/Data.MSSQL/Resources/Mssql-regions.sql
new file mode 100644
index 0000000..b46da16
--- /dev/null
+++ b/OpenSim/Framework/Data.MSSQL/Resources/Mssql-regions.sql
@@ -0,0 +1,41 @@
1SET ANSI_NULLS ON
2GO
3SET QUOTED_IDENTIFIER ON
4GO
5SET ANSI_PADDING ON
6GO
7CREATE TABLE [db_owner].[regions](
8 [regionHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
9 [regionName] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
10 [uuid] [varchar](255) COLLATE Latin1_General_CI_AS NOT NULL,
11 [regionRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
12 [regionSecret] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
13 [regionSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
14 [regionDataURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
15 [serverIP] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
16 [serverPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
17 [serverURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
18 [locX] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
19 [locY] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
20 [locZ] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
21 [eastOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
22 [westOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
23 [southOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
24 [northOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
25 [regionAssetURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
26 [regionAssetRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
27 [regionAssetSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
28 [regionUserURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
29 [regionUserRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
30 [regionUserSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
31 [regionMapTexture] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
32 [serverHttpPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
33 [serverRemotingPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
34PRIMARY KEY CLUSTERED
35(
36 [uuid] ASC
37)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
38) ON [PRIMARY]
39
40GO
41SET ANSI_PADDING OFF
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index d62c286..3737e48 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -206,91 +206,7 @@ namespace OpenSim.Framework.Data.MySQL
206 return null; 206 return null;
207 } 207 }
208 } 208 }
209 209
210 /// <summary>
211 /// // Returns a list of avatar and UUIDs that match the query
212 /// </summary>
213 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
214 {
215 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
216
217 Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
218
219 string[] querysplit;
220 querysplit = query.Split(' ');
221 if (querysplit.Length == 2)
222 {
223 Dictionary<string, string> param = new Dictionary<string, string>();
224 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
225 param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], String.Empty) + "%";
226 try
227 {
228 lock (database)
229 {
230 IDbCommand result =
231 database.Query(
232 "SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100",
233 param);
234 IDataReader reader = result.ExecuteReader();
235
236
237 while (reader.Read())
238 {
239 AvatarPickerAvatar user = new AvatarPickerAvatar();
240 user.AvatarID = new LLUUID((string) reader["UUID"]);
241 user.firstName = (string) reader["username"];
242 user.lastName = (string) reader["surname"];
243 returnlist.Add(user);
244 }
245 reader.Close();
246 result.Dispose();
247 }
248 }
249 catch (Exception e)
250 {
251 database.Reconnect();
252 m_log.Error(e.ToString());
253 return returnlist;
254 }
255 }
256 else if (querysplit.Length == 1)
257 {
258 try
259 {
260 lock (database)
261 {
262 Dictionary<string, string> param = new Dictionary<string, string>();
263 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], System.String.Empty) + "%";
264
265 IDbCommand result =
266 database.Query(
267 "SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second",
268 param);
269 IDataReader reader = result.ExecuteReader();
270
271
272 while (reader.Read())
273 {
274 AvatarPickerAvatar user = new AvatarPickerAvatar();
275 user.AvatarID = new LLUUID((string) reader["UUID"]);
276 user.firstName = (string) reader["username"];
277 user.lastName = (string) reader["surname"];
278 returnlist.Add(user);
279 }
280 reader.Close();
281 result.Dispose();
282 }
283 }
284 catch (Exception e)
285 {
286 database.Reconnect();
287 m_log.Error(e.ToString());
288 return returnlist;
289 }
290 }
291 return returnlist;
292 }
293
294 /// <summary> 210 /// <summary>
295 /// Returns a sim profile from it's UUID 211 /// Returns a sim profile from it's UUID
296 /// </summary> 212 /// </summary>
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs
index 6072600..ee6f18a 100644
--- a/OpenSim/Framework/Data/GridData.cs
+++ b/OpenSim/Framework/Data/GridData.cs
@@ -78,9 +78,6 @@ namespace OpenSim.Framework.Data
78 /// <returns>An array containing all the sim profiles in the specified range</returns> 78 /// <returns>An array containing all the sim profiles in the specified range</returns>
79 RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); 79 RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
80 80
81
82 List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
83
84 /// <summary> 81 /// <summary>
85 /// Authenticates a sim by use of its recv key. 82 /// Authenticates a sim by use of its recv key.
86 /// WARNING: Insecure 83 /// WARNING: Insecure
diff --git a/bin/mssql_connection.ini.example b/bin/mssql_connection.ini.example
index ceb277f..e0ae7ba 100644
--- a/bin/mssql_connection.ini.example
+++ b/bin/mssql_connection.ini.example
@@ -9,8 +9,10 @@ user_id=username
9password=password 9password=password
10 10
11; These entries are only for if you, for some reason, wish to customize your user server table names. 11; These entries are only for if you, for some reason, wish to customize your user server table names.
12; Do note that if you change the table names, you might have to change the sql resources too manually
12; If ommitted, default values will be used. 13; If ommitted, default values will be used.
13 14
14userstablename=users 15userstablename=users
15userfriendstablename=userfriends 16userfriendstablename=userfriends
16agentstablename=agents \ No newline at end of file 17agentstablename=agents
18regionstablename=regions
diff --git a/bin/mysql_connection.ini.example b/bin/mysql_connection.ini.example
index 2fe469c..4ad43dd 100644
--- a/bin/mysql_connection.ini.example
+++ b/bin/mysql_connection.ini.example
@@ -10,6 +10,7 @@ pooling=false
10port=3306 10port=3306
11 11
12; These entries are only for if you, for some reason, wish to customize your user server table names. 12; These entries are only for if you, for some reason, wish to customize your user server table names.
13; Do note that if you change the table names, you might have to change the sql resources too manually
13; If ommitted, default values will be used. 14; If ommitted, default values will be used.
14 15
15userstablename=users 16userstablename=users