diff options
author | UbitUmarov | 2012-07-17 00:54:23 +0100 |
---|---|---|
committer | UbitUmarov | 2012-07-17 00:54:23 +0100 |
commit | d5f4fb7b50fb7c594b018f8241399e22f88fc951 (patch) | |
tree | 8f3dab3d170596f02b1d1d836a0bc08a3e6b8ebd /OpenSim/Data/MySQL/MySQLUserAccountData.cs | |
parent | UbitOde: remove useless water collider from active code. (diff) | |
parent | Merge branch 'avination' into careminster (diff) | |
download | opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.zip opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.tar.gz opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.tar.bz2 opensim-SC-d5f4fb7b50fb7c594b018f8241399e22f88fc951.tar.xz |
Merge branch 'avination' into ubitwork
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLUserAccountData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserAccountData.cs | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index a18ac66..4ff3175 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -66,38 +66,40 @@ namespace OpenSim.Data.MySQL | |||
66 | if (words.Length > 2) | 66 | if (words.Length > 2) |
67 | return new UserAccountData[0]; | 67 | return new UserAccountData[0]; |
68 | 68 | ||
69 | MySqlCommand cmd = new MySqlCommand(); | 69 | using (MySqlCommand cmd = new MySqlCommand()) |
70 | |||
71 | if (words.Length == 1) | ||
72 | { | ||
73 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm); | ||
74 | cmd.Parameters.AddWithValue("?search", words[0] + "%"); | ||
75 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | ||
76 | } | ||
77 | else | ||
78 | { | 70 | { |
79 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm); | 71 | if (words.Length == 1) |
80 | cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%"); | 72 | { |
81 | cmd.Parameters.AddWithValue("?searchLast", words[1] + "%"); | 73 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm); |
82 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | 74 | cmd.Parameters.AddWithValue("?search", words[0] + "%"); |
83 | } | 75 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); |
76 | } | ||
77 | else | ||
78 | { | ||
79 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm); | ||
80 | cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%"); | ||
81 | cmd.Parameters.AddWithValue("?searchLast", words[1] + "%"); | ||
82 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | ||
83 | } | ||
84 | 84 | ||
85 | return DoQuery(cmd); | 85 | return DoQuery(cmd); |
86 | } | ||
86 | } | 87 | } |
87 | 88 | ||
88 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | 89 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) |
89 | { | 90 | { |
90 | MySqlCommand cmd = new MySqlCommand(); | 91 | using (MySqlCommand cmd = new MySqlCommand()) |
91 | |||
92 | if (scopeID != UUID.Zero) | ||
93 | { | 92 | { |
94 | where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")"; | 93 | if (scopeID != UUID.Zero) |
95 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | 94 | { |
96 | } | 95 | where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")"; |
96 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | ||
97 | } | ||
97 | 98 | ||
98 | cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm); | 99 | cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm); |
99 | 100 | ||
100 | return DoQuery(cmd); | 101 | return DoQuery(cmd); |
102 | } | ||
101 | } | 103 | } |
102 | } | 104 | } |
103 | } | 105 | } |