Mantis #2099
Thank you, cmickeyb, for a patch that corrects the database connection handling in the multithreaded user server.0.6.0-stable
parent
36dcedce31
commit
e98780fea5
|
@ -280,6 +280,19 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void ExecuteParameterizedSql(string sql, Dictionary<string, string> parameters)
|
||||
{
|
||||
CheckConnection();
|
||||
|
||||
MySqlCommand cmd = (MySqlCommand)dbcon.CreateCommand();
|
||||
cmd.CommandText = sql;
|
||||
foreach (KeyValuePair<string, string> param in parameters)
|
||||
{
|
||||
cmd.Parameters.AddWithValue(param.Key, param.Value);
|
||||
}
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Given a list of tables, return the version of the tables, as seen in the database
|
||||
/// </summary>
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace OpenSim.Data.MySQL
|
|||
private string m_usersTableName;
|
||||
private string m_userFriendsTableName;
|
||||
private string m_appearanceTableName = "avatarappearance";
|
||||
private string m_attachmentsTableName = "avatarattachments";
|
||||
private string m_connectString;
|
||||
|
||||
public override void Initialise()
|
||||
|
@ -542,12 +543,10 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
try
|
||||
{
|
||||
IDbCommand updater =
|
||||
dbm.Manager.Query(
|
||||
dbm.Manager.ExecuteParameterizedSql(
|
||||
"update " + m_usersTableName + " SET webLoginKey = ?webLoginKey " +
|
||||
"where UUID = ?UUID",
|
||||
param);
|
||||
updater.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -788,19 +787,27 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?uuid"] = agentID.ToString();
|
||||
|
||||
try
|
||||
{
|
||||
MySqlCommand cmd = dbm.Manager.Connection.CreateCommand();
|
||||
cmd.CommandText = "select attachpoint, item, asset from avatarattachments where UUID = ?uuid";
|
||||
cmd.Parameters.AddWithValue("?uuid", agentID.ToString());
|
||||
IDbCommand result = dbm.Manager.Query(
|
||||
"SELECT attachpoint, item, asset from " + m_attachmentsTableName + " WHERE UUID = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
Hashtable ret = dbm.Manager.readAttachments(reader);
|
||||
|
||||
Hashtable ret = dbm.Manager.readAttachments(r);
|
||||
|
||||
r.Close();
|
||||
reader.Dispose();
|
||||
result.Dispose();
|
||||
return ret;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dbm.Manager.Reconnect();
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
dbm.Release();
|
||||
|
@ -823,14 +830,16 @@ namespace OpenSim.Data.MySQL
|
|||
public override void ResetAttachments(LLUUID userID)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?uuid"] = userID.ToString();
|
||||
|
||||
try
|
||||
{
|
||||
MySqlCommand cmd = dbm.Manager.Connection.CreateCommand();
|
||||
cmd.CommandText =
|
||||
"update avatarattachments set asset = '00000000-0000-0000-0000-000000000000' where UUID = ?uuid";
|
||||
cmd.Parameters.AddWithValue("?uuid", userID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
dbm.Manager.ExecuteParameterizedSql(
|
||||
"UPDATE " + m_attachmentsTableName +
|
||||
" SET asset = '00000000-0000-0000-0000-000000000000' WHERE UUID = ?uuid",
|
||||
param);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue