mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 08:06:27 +08:00
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim into htb-throttle
This commit is contained in:
@@ -55,42 +55,40 @@ namespace OpenSim.Data.MySQL
|
||||
AuthenticationData ret = new AuthenticationData();
|
||||
ret.Data = new Dictionary<string, object>();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID"))
|
||||
MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID");
|
||||
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
|
||||
if (result.Read())
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
ret.PrincipalID = principalID;
|
||||
|
||||
using (IDataReader result = ExecuteReader(cmd))
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
if (result.Read())
|
||||
{
|
||||
ret.PrincipalID = principalID;
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
|
||||
CloseDBConnection(cmd);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseDBConnection(cmd);
|
||||
return null;
|
||||
}
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
|
||||
CloseDBConnection(result, cmd);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseDBConnection(result, cmd);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,9 @@ namespace OpenSim.Data.MySQL
|
||||
/// </summary>
|
||||
public class MySqlFramework
|
||||
{
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly log4net.ILog m_log =
|
||||
log4net.LogManager.GetLogger(
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected MySqlConnection m_Connection;
|
||||
|
||||
@@ -81,7 +83,8 @@ namespace OpenSim.Data.MySQL
|
||||
errorSeen = true;
|
||||
|
||||
m_Connection.Close();
|
||||
MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone();
|
||||
MySqlConnection newConnection =
|
||||
(MySqlConnection)((ICloneable)m_Connection).Clone();
|
||||
m_Connection.Dispose();
|
||||
m_Connection = newConnection;
|
||||
m_Connection.Open();
|
||||
@@ -102,15 +105,18 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
protected IDataReader ExecuteReader(MySqlCommand cmd)
|
||||
{
|
||||
MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone();
|
||||
MySqlConnection newConnection =
|
||||
(MySqlConnection)((ICloneable)m_Connection).Clone();
|
||||
newConnection.Open();
|
||||
|
||||
cmd.Connection = newConnection;
|
||||
return cmd.ExecuteReader();
|
||||
}
|
||||
|
||||
protected void CloseDBConnection(MySqlCommand cmd)
|
||||
protected void CloseDBConnection(IDataReader reader, MySqlCommand cmd)
|
||||
{
|
||||
reader.Close();
|
||||
cmd.Connection.Close();
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace OpenSim.Data.MySQL
|
||||
retList.Add(ret);
|
||||
}
|
||||
|
||||
CloseDBConnection(cmd);
|
||||
CloseDBConnection(result, cmd);
|
||||
}
|
||||
|
||||
return retList;
|
||||
|
||||
@@ -64,48 +64,46 @@ namespace OpenSim.Data.MySQL
|
||||
if (scopeID != UUID.Zero)
|
||||
command += " and ScopeID = ?scopeID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
MySqlCommand cmd = new MySqlCommand(command);
|
||||
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
|
||||
if (result.Read())
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
ret.PrincipalID = principalID;
|
||||
UUID scope;
|
||||
UUID.TryParse(result["ScopeID"].ToString(), out scope);
|
||||
ret.ScopeID = scope;
|
||||
|
||||
using (IDataReader result = ExecuteReader(cmd))
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
if (result.Read())
|
||||
{
|
||||
ret.PrincipalID = principalID;
|
||||
UUID scope;
|
||||
UUID.TryParse(result["ScopeID"].ToString(), out scope);
|
||||
ret.ScopeID = scope;
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
if (s == "ScopeID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
|
||||
CloseDBConnection(cmd);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseDBConnection(cmd);
|
||||
return null;
|
||||
}
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
if (s == "ScopeID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
|
||||
CloseDBConnection(result, cmd);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseDBConnection(result, cmd);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user