cosmetics (or not)
parent
56535cdb47
commit
cb5a7246a2
|
@ -29,11 +29,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using System.Text;
|
||||
using MySql.Data.MySqlClient;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Data.MySQL
|
||||
{
|
||||
|
@ -129,25 +127,27 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
public virtual T[] Get(string[] fields, string[] keys, string options)
|
||||
{
|
||||
if (fields.Length != keys.Length)
|
||||
int flen = fields.Length;
|
||||
if (flen == 0 || flen != keys.Length)
|
||||
return new T[0];
|
||||
|
||||
List<string> terms = new List<string>();
|
||||
int flast = flen - 1;
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
sb.AppendFormat("select * from {0} where ", m_Realm);
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
for (int i = 0 ; i < fields.Length ; i++)
|
||||
for (int i = 0 ; i < flen ; i++)
|
||||
{
|
||||
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
||||
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
|
||||
if(i< flast)
|
||||
sb.AppendFormat("`{0}` = ?{0} and ", fields[i]);
|
||||
else
|
||||
sb.AppendFormat("`{0}` = ?{0} ", fields[i]);
|
||||
}
|
||||
|
||||
string where = String.Join(" and ", terms.ToArray());
|
||||
|
||||
string query = String.Format("select * from {0} where {1} {2}",
|
||||
m_Realm, where, options);
|
||||
|
||||
cmd.CommandText = query;
|
||||
sb.Append(options);
|
||||
cmd.CommandText = sb.ToString();
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ namespace OpenSim.Data.MySQL
|
|||
if (m_Fields[name].FieldType == typeof(bool))
|
||||
{
|
||||
int v = Convert.ToInt32(reader[name]);
|
||||
m_Fields[name].SetValue(row, v != 0 ? true : false);
|
||||
m_Fields[name].SetValue(row, v != 0);
|
||||
}
|
||||
else if (m_Fields[name].FieldType == typeof(UUID))
|
||||
{
|
||||
|
|
|
@ -43,16 +43,16 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
private static byte[] ulongToByteArray(ulong uLongValue)
|
||||
{
|
||||
// Reverse endianness of RegionHandle
|
||||
return new byte[]
|
||||
return new byte[8]
|
||||
{
|
||||
(byte)((uLongValue >> 56) % 256),
|
||||
(byte)((uLongValue >> 48) % 256),
|
||||
(byte)((uLongValue >> 40) % 256),
|
||||
(byte)((uLongValue >> 32) % 256),
|
||||
(byte)((uLongValue >> 24) % 256),
|
||||
(byte)((uLongValue >> 16) % 256),
|
||||
(byte)((uLongValue >> 8) % 256),
|
||||
(byte)(uLongValue % 256)
|
||||
(byte)((uLongValue >> 56) & 0xff),
|
||||
(byte)((uLongValue >> 48) & 0xff),
|
||||
(byte)((uLongValue >> 40) & 0xff),
|
||||
(byte)((uLongValue >> 32) & 0xff),
|
||||
(byte)((uLongValue >> 24) & 0xff),
|
||||
(byte)((uLongValue >> 16) & 0xff),
|
||||
(byte)((uLongValue >> 8) & 0xff),
|
||||
(byte)(uLongValue & 0xff)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -86,30 +86,29 @@ namespace OpenSim.Services.UserAccountService
|
|||
|
||||
m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false);
|
||||
|
||||
// create a system grid god account
|
||||
UserAccount ggod = GetUserAccount(UUID.Zero, UUID_GRID_GOD);
|
||||
if(ggod == null)
|
||||
{
|
||||
UserAccountData d = new UserAccountData();
|
||||
|
||||
d.FirstName = "GRID";
|
||||
d.LastName = "SERVICES";
|
||||
d.PrincipalID = UUID_GRID_GOD;
|
||||
d.ScopeID = UUID.Zero;
|
||||
d.Data = new Dictionary<string, string>();
|
||||
d.Data["Email"] = string.Empty;
|
||||
d.Data["Created"] = Util.UnixTimeSinceEpoch().ToString();
|
||||
d.Data["UserLevel"] = "240";
|
||||
d.Data["UserFlags"] = "0";
|
||||
d.Data["ServiceURLs"] = string.Empty;
|
||||
|
||||
m_Database.Store(d);
|
||||
}
|
||||
|
||||
if (m_RootInstance == null)
|
||||
{
|
||||
m_RootInstance = this;
|
||||
|
||||
// create a system grid god account
|
||||
UserAccount ggod = GetUserAccount(UUID.Zero, UUID_GRID_GOD);
|
||||
if(ggod == null)
|
||||
{
|
||||
UserAccountData d = new UserAccountData();
|
||||
d.FirstName = "GRID";
|
||||
d.LastName = "SERVICES";
|
||||
d.PrincipalID = UUID_GRID_GOD;
|
||||
d.ScopeID = UUID.Zero;
|
||||
d.Data = new Dictionary<string, string>();
|
||||
d.Data["Email"] = string.Empty;
|
||||
d.Data["Created"] = Util.UnixTimeSinceEpoch().ToString();
|
||||
d.Data["UserLevel"] = "240";
|
||||
d.Data["UserFlags"] = "0";
|
||||
d.Data["ServiceURLs"] = string.Empty;
|
||||
|
||||
m_Database.Store(d);
|
||||
}
|
||||
|
||||
// In case there are several instances of this class in the same process,
|
||||
// the console commands are only registered for the root instance
|
||||
if (MainConsole.Instance != null)
|
||||
|
|
Loading…
Reference in New Issue