diff options
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 28 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/XMute.migrations | 16 |
3 files changed, 15 insertions, 31 deletions
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 9bd3c0c..1564140 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -29,11 +29,9 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using System.Text; |
33 | using MySql.Data.MySqlClient; | 33 | using MySql.Data.MySqlClient; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | 35 | ||
38 | namespace OpenSim.Data.MySQL | 36 | namespace OpenSim.Data.MySQL |
39 | { | 37 | { |
@@ -129,25 +127,27 @@ namespace OpenSim.Data.MySQL | |||
129 | 127 | ||
130 | public virtual T[] Get(string[] fields, string[] keys, string options) | 128 | public virtual T[] Get(string[] fields, string[] keys, string options) |
131 | { | 129 | { |
132 | if (fields.Length != keys.Length) | 130 | int flen = fields.Length; |
131 | if (flen == 0 || flen != keys.Length) | ||
133 | return new T[0]; | 132 | return new T[0]; |
134 | 133 | ||
135 | List<string> terms = new List<string>(); | 134 | int flast = flen - 1; |
135 | StringBuilder sb = new StringBuilder(1024); | ||
136 | sb.AppendFormat("select * from {0} where ", m_Realm); | ||
136 | 137 | ||
137 | using (MySqlCommand cmd = new MySqlCommand()) | 138 | using (MySqlCommand cmd = new MySqlCommand()) |
138 | { | 139 | { |
139 | for (int i = 0 ; i < fields.Length ; i++) | 140 | for (int i = 0 ; i < flen ; i++) |
140 | { | 141 | { |
141 | cmd.Parameters.AddWithValue(fields[i], keys[i]); | 142 | cmd.Parameters.AddWithValue(fields[i], keys[i]); |
142 | terms.Add("`" + fields[i] + "` = ?" + fields[i]); | 143 | if(i< flast) |
144 | sb.AppendFormat("`{0}` = ?{0} and ", fields[i]); | ||
145 | else | ||
146 | sb.AppendFormat("`{0}` = ?{0} ", fields[i]); | ||
143 | } | 147 | } |
144 | 148 | ||
145 | string where = String.Join(" and ", terms.ToArray()); | 149 | sb.Append(options); |
146 | 150 | cmd.CommandText = sb.ToString(); | |
147 | string query = String.Format("select * from {0} where {1} {2}", | ||
148 | m_Realm, where, options); | ||
149 | |||
150 | cmd.CommandText = query; | ||
151 | 151 | ||
152 | return DoQuery(cmd); | 152 | return DoQuery(cmd); |
153 | } | 153 | } |
@@ -204,7 +204,7 @@ namespace OpenSim.Data.MySQL | |||
204 | if (m_Fields[name].FieldType == typeof(bool)) | 204 | if (m_Fields[name].FieldType == typeof(bool)) |
205 | { | 205 | { |
206 | int v = Convert.ToInt32(reader[name]); | 206 | int v = Convert.ToInt32(reader[name]); |
207 | m_Fields[name].SetValue(row, v != 0 ? true : false); | 207 | m_Fields[name].SetValue(row, v != 0); |
208 | } | 208 | } |
209 | else if (m_Fields[name].FieldType == typeof(UUID)) | 209 | else if (m_Fields[name].FieldType == typeof(UUID)) |
210 | { | 210 | { |
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index 16637c3..2669aca 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -836,7 +836,7 @@ namespace OpenSim.Data.MySQL | |||
836 | 836 | ||
837 | const string queryB = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id"; | 837 | const string queryB = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id"; |
838 | 838 | ||
839 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryB,"`userpicks`"), dbcon)) | 839 | using (MySqlCommand cmd = new MySqlCommand(queryB, dbcon)) |
840 | { | 840 | { |
841 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 841 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
842 | 842 | ||
diff --git a/OpenSim/Data/MySQL/Resources/XMute.migrations b/OpenSim/Data/MySQL/Resources/XMute.migrations deleted file mode 100644 index 4ac7f82..0000000 --- a/OpenSim/Data/MySQL/Resources/XMute.migrations +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN; | ||
4 | |||
5 | CREATE TABLE `XMute` ( | ||
6 | `AgentID` char(36) NOT NULL, | ||
7 | `MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
8 | `MuteName` varchar(64) NOT NULL DEFAULT '', | ||
9 | `MuteType` int(11) NOT NULL DEFAULT '1', | ||
10 | `MuteFlags` int(11) NOT NULL DEFAULT '0', | ||
11 | `Stamp` int(11) NOT NULL, | ||
12 | UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`), | ||
13 | KEY `AgentID` (`AgentID`) | ||
14 | ); | ||
15 | |||
16 | COMMIT; | ||