diff options
Diffstat (limited to 'OpenSim')
3 files changed, 42 insertions, 43 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/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index 461f776..52cfd48 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | |||
@@ -43,16 +43,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
43 | private static byte[] ulongToByteArray(ulong uLongValue) | 43 | private static byte[] ulongToByteArray(ulong uLongValue) |
44 | { | 44 | { |
45 | // Reverse endianness of RegionHandle | 45 | // Reverse endianness of RegionHandle |
46 | return new byte[] | 46 | return new byte[8] |
47 | { | 47 | { |
48 | (byte)((uLongValue >> 56) % 256), | 48 | (byte)((uLongValue >> 56) & 0xff), |
49 | (byte)((uLongValue >> 48) % 256), | 49 | (byte)((uLongValue >> 48) & 0xff), |
50 | (byte)((uLongValue >> 40) % 256), | 50 | (byte)((uLongValue >> 40) & 0xff), |
51 | (byte)((uLongValue >> 32) % 256), | 51 | (byte)((uLongValue >> 32) & 0xff), |
52 | (byte)((uLongValue >> 24) % 256), | 52 | (byte)((uLongValue >> 24) & 0xff), |
53 | (byte)((uLongValue >> 16) % 256), | 53 | (byte)((uLongValue >> 16) & 0xff), |
54 | (byte)((uLongValue >> 8) % 256), | 54 | (byte)((uLongValue >> 8) & 0xff), |
55 | (byte)(uLongValue % 256) | 55 | (byte)(uLongValue & 0xff) |
56 | }; | 56 | }; |
57 | } | 57 | } |
58 | 58 | ||
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 48929ee..5561287 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -86,30 +86,29 @@ namespace OpenSim.Services.UserAccountService | |||
86 | 86 | ||
87 | m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false); | 87 | m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false); |
88 | 88 | ||
89 | // create a system grid god account | ||
90 | UserAccount ggod = GetUserAccount(UUID.Zero, UUID_GRID_GOD); | ||
91 | if(ggod == null) | ||
92 | { | ||
93 | UserAccountData d = new UserAccountData(); | ||
94 | |||
95 | d.FirstName = "GRID"; | ||
96 | d.LastName = "SERVICES"; | ||
97 | d.PrincipalID = UUID_GRID_GOD; | ||
98 | d.ScopeID = UUID.Zero; | ||
99 | d.Data = new Dictionary<string, string>(); | ||
100 | d.Data["Email"] = string.Empty; | ||
101 | d.Data["Created"] = Util.UnixTimeSinceEpoch().ToString(); | ||
102 | d.Data["UserLevel"] = "240"; | ||
103 | d.Data["UserFlags"] = "0"; | ||
104 | d.Data["ServiceURLs"] = string.Empty; | ||
105 | |||
106 | m_Database.Store(d); | ||
107 | } | ||
108 | |||
109 | if (m_RootInstance == null) | 89 | if (m_RootInstance == null) |
110 | { | 90 | { |
111 | m_RootInstance = this; | 91 | m_RootInstance = this; |
112 | 92 | ||
93 | // create a system grid god account | ||
94 | UserAccount ggod = GetUserAccount(UUID.Zero, UUID_GRID_GOD); | ||
95 | if(ggod == null) | ||
96 | { | ||
97 | UserAccountData d = new UserAccountData(); | ||
98 | d.FirstName = "GRID"; | ||
99 | d.LastName = "SERVICES"; | ||
100 | d.PrincipalID = UUID_GRID_GOD; | ||
101 | d.ScopeID = UUID.Zero; | ||
102 | d.Data = new Dictionary<string, string>(); | ||
103 | d.Data["Email"] = string.Empty; | ||
104 | d.Data["Created"] = Util.UnixTimeSinceEpoch().ToString(); | ||
105 | d.Data["UserLevel"] = "240"; | ||
106 | d.Data["UserFlags"] = "0"; | ||
107 | d.Data["ServiceURLs"] = string.Empty; | ||
108 | |||
109 | m_Database.Store(d); | ||
110 | } | ||
111 | |||
113 | // In case there are several instances of this class in the same process, | 112 | // In case there are several instances of this class in the same process, |
114 | // the console commands are only registered for the root instance | 113 | // the console commands are only registered for the root instance |
115 | if (MainConsole.Instance != null) | 114 | if (MainConsole.Instance != null) |