Reverting the memory leak patch for MySQL. Problems have been reported with the grid server after running for several hours
parent
f4e9809b7d
commit
6309fcc5b4
|
@ -197,11 +197,20 @@ namespace OpenSim.Data.MSSQL
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
SqlConnection conn = realCommand.Connection;
|
SqlConnection conn = realCommand.Connection;
|
||||||
try { realCommand.Dispose(); }
|
try
|
||||||
|
{
|
||||||
|
realCommand.Dispose();
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try { conn.Dispose(); }
|
try
|
||||||
finally { }
|
{
|
||||||
|
conn.Close();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
conn.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,6 +348,8 @@ namespace OpenSim.Data.MSSQL
|
||||||
//Delete the actual row
|
//Delete the actual row
|
||||||
DeleteOneFolder(folderID, connection);
|
DeleteOneFolder(folderID, connection);
|
||||||
DeleteItemsInFolder(folderID, connection);
|
DeleteItemsInFolder(folderID, connection);
|
||||||
|
|
||||||
|
connection.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -340,6 +340,8 @@ namespace OpenSim.Data.MSSQL
|
||||||
MSSQLMigration migration = new MSSQLMigration(connection, assem, migrationStore);
|
MSSQLMigration migration = new MSSQLMigration(connection, assem, migrationStore);
|
||||||
|
|
||||||
migration.Update();
|
migration.Update();
|
||||||
|
|
||||||
|
connection.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +385,9 @@ namespace OpenSim.Data.MSSQL
|
||||||
m_log.Error(e.ToString());
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tables.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -56,6 +56,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
{
|
{
|
||||||
version = Convert.ToInt32(reader["version"]);
|
version = Convert.ToInt32(reader["version"]);
|
||||||
}
|
}
|
||||||
|
reader.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
@ -131,8 +131,7 @@ namespace OpenSim.Data
|
||||||
m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision.", _type);
|
m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision.", _type);
|
||||||
m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!");
|
m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!");
|
||||||
|
|
||||||
using (DbCommand cmd = _conn.CreateCommand())
|
DbCommand cmd = _conn.CreateCommand();
|
||||||
{
|
|
||||||
foreach (KeyValuePair<int, string> kvp in migrations)
|
foreach (KeyValuePair<int, string> kvp in migrations)
|
||||||
{
|
{
|
||||||
int newversion = kvp.Key;
|
int newversion = kvp.Key;
|
||||||
|
@ -150,7 +149,7 @@ namespace OpenSim.Data
|
||||||
UpdateVersion(_type, newversion);
|
UpdateVersion(_type, newversion);
|
||||||
}
|
}
|
||||||
version = newversion;
|
version = newversion;
|
||||||
}
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,45 +189,43 @@ namespace OpenSim.Data
|
||||||
protected virtual int FindVersion(DbConnection conn, string type)
|
protected virtual int FindVersion(DbConnection conn, string type)
|
||||||
{
|
{
|
||||||
int version = 0;
|
int version = 0;
|
||||||
|
DbCommand cmd = conn.CreateCommand();
|
||||||
using (DbCommand cmd = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc";
|
cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc";
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
|
{
|
||||||
version = Convert.ToInt32(reader["version"]);
|
version = Convert.ToInt32(reader["version"]);
|
||||||
}
|
}
|
||||||
|
reader.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// Something went wrong, so we're version 0
|
// Something went wrong, so we're version 0
|
||||||
}
|
}
|
||||||
}
|
cmd.Dispose();
|
||||||
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InsertVersion(string type, int version)
|
private void InsertVersion(string type, int version)
|
||||||
{
|
{
|
||||||
using (DbCommand cmd = _conn.CreateCommand())
|
DbCommand cmd = _conn.CreateCommand();
|
||||||
{
|
|
||||||
cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")";
|
cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")";
|
||||||
m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version);
|
m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateVersion(string type, int version)
|
private void UpdateVersion(string type, int version)
|
||||||
{
|
{
|
||||||
using (DbCommand cmd = _conn.CreateCommand())
|
DbCommand cmd = _conn.CreateCommand();
|
||||||
{
|
|
||||||
cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'";
|
cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'";
|
||||||
m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version);
|
m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// private SortedList<int, string> GetAllMigrations()
|
// private SortedList<int, string> GetAllMigrations()
|
||||||
|
|
|
@ -139,10 +139,10 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
_dbConnection.CheckConnection();
|
_dbConnection.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(
|
MySqlCommand cmd =
|
||||||
|
new MySqlCommand(
|
||||||
"SELECT name, description, assetType, local, temporary, data FROM assets WHERE id=?id",
|
"SELECT name, description, assetType, local, temporary, data FROM assets WHERE id=?id",
|
||||||
_dbConnection.Connection))
|
_dbConnection.Connection);
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue("?id", assetID.ToString());
|
cmd.Parameters.AddWithValue("?id", assetID.ToString());
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -166,7 +166,11 @@ namespace OpenSim.Data.MySQL
|
||||||
asset.Type = (sbyte) dbReader["assetType"];
|
asset.Type = (sbyte) dbReader["assetType"];
|
||||||
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
||||||
}
|
}
|
||||||
|
dbReader.Close();
|
||||||
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
|
if (asset != null)
|
||||||
|
UpdateAccessTime(asset);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -176,7 +180,6 @@ namespace OpenSim.Data.MySQL
|
||||||
_dbConnection.Reconnect();
|
_dbConnection.Reconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,10 +294,11 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
_dbConnection.CheckConnection();
|
_dbConnection.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(
|
MySqlCommand cmd =
|
||||||
|
new MySqlCommand(
|
||||||
"SELECT id FROM assets WHERE id=?id",
|
"SELECT id FROM assets WHERE id=?id",
|
||||||
_dbConnection.Connection))
|
_dbConnection.Connection);
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue("?id", uuid.ToString());
|
cmd.Parameters.AddWithValue("?id", uuid.ToString());
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -302,8 +306,13 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||||
{
|
{
|
||||||
if (dbReader.Read())
|
if (dbReader.Read())
|
||||||
|
{
|
||||||
assetExists = true;
|
assetExists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbReader.Close();
|
||||||
|
cmd.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -313,7 +322,6 @@ namespace OpenSim.Data.MySQL
|
||||||
_dbConnection.Reconnect();
|
_dbConnection.Reconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return assetExists;
|
return assetExists;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,9 @@ namespace OpenSim.Data.MySQL
|
||||||
AuthenticationData ret = new AuthenticationData();
|
AuthenticationData ret = new AuthenticationData();
|
||||||
ret.Data = new Dictionary<string, object>();
|
ret.Data = new Dictionary<string, object>();
|
||||||
|
|
||||||
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());
|
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||||
|
|
||||||
|
@ -82,15 +84,17 @@ namespace OpenSim.Data.MySQL
|
||||||
ret.Data[s] = result[s].ToString();
|
ret.Data[s] = result[s].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseDBConnection(result, cmd);
|
result.Close();
|
||||||
|
CloseReaderCommand(cmd);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
result.Close();
|
||||||
CloseDBConnection(result, cmd);
|
CloseReaderCommand(cmd);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public bool Store(AuthenticationData data)
|
public bool Store(AuthenticationData data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,9 +95,11 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
protected void GetWaitTimeout()
|
protected void GetWaitTimeout()
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, m_connection))
|
MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect,
|
||||||
{
|
m_connection);
|
||||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
|
||||||
|
using (MySqlDataReader dbReader =
|
||||||
|
cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||||
{
|
{
|
||||||
if (dbReader.Read())
|
if (dbReader.Read())
|
||||||
{
|
{
|
||||||
|
@ -105,7 +107,9 @@ namespace OpenSim.Data.MySQL
|
||||||
= Convert.ToInt32(dbReader["@@wait_timeout"]) *
|
= Convert.ToInt32(dbReader["@@wait_timeout"]) *
|
||||||
TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
|
TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
dbReader.Close();
|
||||||
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastConnectionUse = DateTime.Now.Ticks;
|
m_lastConnectionUse = DateTime.Now.Ticks;
|
||||||
|
@ -143,19 +147,15 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
|
|
||||||
bool migration = true;
|
MySqlCommand cmd = m_connection.CreateCommand();
|
||||||
|
|
||||||
using (MySqlCommand cmd = m_connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||||
|
|
||||||
using (IDataReader r = cmd.ExecuteReader())
|
IDataReader r = cmd.ExecuteReader();
|
||||||
{
|
|
||||||
if (r.Read())
|
if (r.Read())
|
||||||
{
|
{
|
||||||
migration = false;
|
|
||||||
|
|
||||||
foreach (string name in FieldList)
|
foreach (string name in FieldList)
|
||||||
{
|
{
|
||||||
if (m_FieldMap[name].GetValue(es) is bool)
|
if (m_FieldMap[name].GetValue(es) is bool)
|
||||||
|
@ -178,21 +178,20 @@ namespace OpenSim.Data.MySQL
|
||||||
m_FieldMap[name].SetValue(es, r[name]);
|
m_FieldMap[name].SetValue(es, r[name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
r.Close();
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
}
|
|
||||||
|
|
||||||
if (migration)
|
|
||||||
{
|
{
|
||||||
// Migration case
|
// Migration case
|
||||||
|
//
|
||||||
|
r.Close();
|
||||||
|
|
||||||
List<string> names = new List<string>(FieldList);
|
List<string> names = new List<string>(FieldList);
|
||||||
|
|
||||||
names.Remove("EstateID");
|
names.Remove("EstateID");
|
||||||
|
|
||||||
sql = "insert into estate_settings (" + String.Join(",", names.ToArray()) + ") values ( ?" + String.Join(", ?", names.ToArray()) + ")";
|
sql = "insert into estate_settings (" + String.Join(",", names.ToArray()) + ") values ( ?" + String.Join(", ?", names.ToArray()) + ")";
|
||||||
|
|
||||||
using (MySqlCommand cmd = m_connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
|
||||||
|
@ -216,31 +215,43 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.CommandText = "select LAST_INSERT_ID() as id";
|
cmd.CommandText = "select LAST_INSERT_ID() as id";
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
|
||||||
using (IDataReader r = cmd.ExecuteReader())
|
r = cmd.ExecuteReader();
|
||||||
{
|
|
||||||
r.Read();
|
r.Read();
|
||||||
|
|
||||||
es.EstateID = Convert.ToUInt32(r["id"]);
|
es.EstateID = Convert.ToUInt32(r["id"]);
|
||||||
}
|
|
||||||
|
r.Close();
|
||||||
|
|
||||||
cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)";
|
cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)";
|
||||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
|
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
|
||||||
|
|
||||||
// This will throw on dupe key
|
// This will throw on dupe key
|
||||||
try { cmd.ExecuteNonQuery(); }
|
try
|
||||||
catch (Exception) { }
|
{
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Munge and transfer the ban list
|
// Munge and transfer the ban list
|
||||||
|
//
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
cmd.CommandText = "insert into estateban select " + es.EstateID.ToString() + ", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = ?UUID";
|
cmd.CommandText = "insert into estateban select " + es.EstateID.ToString() + ", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = ?UUID";
|
||||||
cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
|
cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
|
||||||
|
|
||||||
try { cmd.ExecuteNonQuery(); }
|
try
|
||||||
catch (Exception) { }
|
{
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
es.Save();
|
es.Save();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
LoadBanList(es);
|
LoadBanList(es);
|
||||||
|
|
||||||
|
@ -256,8 +267,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand cmd = m_connection.CreateCommand())
|
MySqlCommand cmd = m_connection.CreateCommand();
|
||||||
{
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
|
|
||||||
foreach (string name in FieldList)
|
foreach (string name in FieldList)
|
||||||
|
@ -276,7 +287,6 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
|
||||||
|
|
||||||
SaveBanList(es);
|
SaveBanList(es);
|
||||||
SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
|
SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
|
||||||
|
@ -290,13 +300,13 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand cmd = m_connection.CreateCommand())
|
MySqlCommand cmd = m_connection.CreateCommand();
|
||||||
{
|
|
||||||
cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID";
|
cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID";
|
||||||
cmd.Parameters.AddWithValue("?EstateID", es.EstateID);
|
cmd.Parameters.AddWithValue("?EstateID", es.EstateID);
|
||||||
|
|
||||||
using (IDataReader r = cmd.ExecuteReader())
|
IDataReader r = cmd.ExecuteReader();
|
||||||
{
|
|
||||||
while (r.Read())
|
while (r.Read())
|
||||||
{
|
{
|
||||||
EstateBan eb = new EstateBan();
|
EstateBan eb = new EstateBan();
|
||||||
|
@ -309,16 +319,15 @@ namespace OpenSim.Data.MySQL
|
||||||
eb.BannedHostIPMask = "0.0.0.0";
|
eb.BannedHostIPMask = "0.0.0.0";
|
||||||
es.AddBan(eb);
|
es.AddBan(eb);
|
||||||
}
|
}
|
||||||
}
|
r.Close();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveBanList(EstateSettings es)
|
private void SaveBanList(EstateSettings es)
|
||||||
{
|
{
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand cmd = m_connection.CreateCommand())
|
MySqlCommand cmd = m_connection.CreateCommand();
|
||||||
{
|
|
||||||
cmd.CommandText = "delete from estateban where EstateID = ?EstateID";
|
cmd.CommandText = "delete from estateban where EstateID = ?EstateID";
|
||||||
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
|
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
|
||||||
|
|
||||||
|
@ -337,14 +346,13 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void SaveUUIDList(uint EstateID, string table, UUID[] data)
|
void SaveUUIDList(uint EstateID, string table, UUID[] data)
|
||||||
{
|
{
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand cmd = m_connection.CreateCommand())
|
MySqlCommand cmd = m_connection.CreateCommand();
|
||||||
{
|
|
||||||
cmd.CommandText = "delete from " + table + " where EstateID = ?EstateID";
|
cmd.CommandText = "delete from " + table + " where EstateID = ?EstateID";
|
||||||
cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString());
|
cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString());
|
||||||
|
|
||||||
|
@ -363,7 +371,6 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
UUID[] LoadUUIDList(uint EstateID, string table)
|
UUID[] LoadUUIDList(uint EstateID, string table)
|
||||||
{
|
{
|
||||||
|
@ -371,13 +378,13 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand cmd = m_connection.CreateCommand())
|
MySqlCommand cmd = m_connection.CreateCommand();
|
||||||
{
|
|
||||||
cmd.CommandText = "select uuid from " + table + " where EstateID = ?EstateID";
|
cmd.CommandText = "select uuid from " + table + " where EstateID = ?EstateID";
|
||||||
cmd.Parameters.AddWithValue("?EstateID", EstateID);
|
cmd.Parameters.AddWithValue("?EstateID", EstateID);
|
||||||
|
|
||||||
using (IDataReader r = cmd.ExecuteReader())
|
IDataReader r = cmd.ExecuteReader();
|
||||||
{
|
|
||||||
while (r.Read())
|
while (r.Read())
|
||||||
{
|
{
|
||||||
// EstateBan eb = new EstateBan();
|
// EstateBan eb = new EstateBan();
|
||||||
|
@ -387,8 +394,7 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
uuids.Add(uuid);
|
uuids.Add(uuid);
|
||||||
}
|
}
|
||||||
}
|
r.Close();
|
||||||
}
|
|
||||||
|
|
||||||
return uuids.ToArray();
|
return uuids.ToArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,6 @@ namespace OpenSim.Data.MySQL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MySqlFramework
|
public class MySqlFramework
|
||||||
{
|
{
|
||||||
private static readonly log4net.ILog m_log =
|
|
||||||
log4net.LogManager.GetLogger(
|
|
||||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
protected MySqlConnection m_Connection;
|
protected MySqlConnection m_Connection;
|
||||||
|
|
||||||
protected MySqlFramework(string connectionString)
|
protected MySqlFramework(string connectionString)
|
||||||
|
@ -73,11 +69,12 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
m_log.Error(e.Message, e);
|
Console.WriteLine(e.ToString());
|
||||||
if (errorSeen)
|
if (errorSeen)
|
||||||
throw;
|
throw;
|
||||||
|
|
||||||
// This is "Server has gone away" and "Server lost"
|
// This is "Server has gone away" and "Server lost"
|
||||||
|
//
|
||||||
if (e.Number == 2006 || e.Number == 2013)
|
if (e.Number == 2006 || e.Number == 2013)
|
||||||
{
|
{
|
||||||
errorSeen = true;
|
errorSeen = true;
|
||||||
|
@ -96,7 +93,7 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error(e.Message, e);
|
Console.WriteLine(e.ToString());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,11 +110,11 @@ namespace OpenSim.Data.MySQL
|
||||||
return cmd.ExecuteReader();
|
return cmd.ExecuteReader();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CloseDBConnection(IDataReader reader, MySqlCommand cmd)
|
protected void CloseReaderCommand(MySqlCommand cmd)
|
||||||
{
|
{
|
||||||
reader.Close();
|
|
||||||
cmd.Connection.Close();
|
cmd.Connection.Close();
|
||||||
cmd.Connection.Dispose();
|
cmd.Connection.Dispose();
|
||||||
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,27 +197,29 @@ namespace OpenSim.Data.MySQL
|
||||||
param["?xmax"] = xmax.ToString();
|
param["?xmax"] = xmax.ToString();
|
||||||
param["?ymax"] = ymax.ToString();
|
param["?ymax"] = ymax.ToString();
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query(
|
IDbCommand result =
|
||||||
|
dbm.Manager.Query(
|
||||||
"SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax",
|
"SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax",
|
||||||
param))
|
param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
RegionProfileData row;
|
RegionProfileData row;
|
||||||
|
|
||||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||||
|
|
||||||
while ((row = dbm.Manager.readSimRow(reader)) != null)
|
while ((row = dbm.Manager.readSimRow(reader)) != null)
|
||||||
|
{
|
||||||
rows.Add(row);
|
rows.Add(row);
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return rows.ToArray();
|
return rows.ToArray();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -241,27 +243,29 @@ namespace OpenSim.Data.MySQL
|
||||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||||
param["?name"] = namePrefix + "%";
|
param["?name"] = namePrefix + "%";
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query(
|
IDbCommand result =
|
||||||
|
dbm.Manager.Query(
|
||||||
"SELECT * FROM regions WHERE regionName LIKE ?name",
|
"SELECT * FROM regions WHERE regionName LIKE ?name",
|
||||||
param))
|
param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
RegionProfileData row;
|
RegionProfileData row;
|
||||||
|
|
||||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||||
|
|
||||||
while (rows.Count < maxNum && (row = dbm.Manager.readSimRow(reader)) != null)
|
while (rows.Count < maxNum && (row = dbm.Manager.readSimRow(reader)) != null)
|
||||||
|
{
|
||||||
rows.Add(row);
|
rows.Add(row);
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -284,19 +288,19 @@ namespace OpenSim.Data.MySQL
|
||||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||||
param["?handle"] = handle.ToString();
|
param["?handle"] = handle.ToString();
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param))
|
IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -319,22 +323,21 @@ namespace OpenSim.Data.MySQL
|
||||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||||
param["?uuid"] = uuid.ToString();
|
param["?uuid"] = uuid.ToString();
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE uuid = ?uuid", param))
|
IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
} finally
|
||||||
finally
|
|
||||||
{
|
{
|
||||||
dbm.Release();
|
dbm.Release();
|
||||||
}
|
}
|
||||||
|
@ -356,21 +359,22 @@ namespace OpenSim.Data.MySQL
|
||||||
// Add % because this is a like query.
|
// Add % because this is a like query.
|
||||||
param["?regionName"] = regionName + "%";
|
param["?regionName"] = regionName + "%";
|
||||||
// Order by statement will return shorter matches first. Only returns one record or no record.
|
// Order by statement will return shorter matches first. Only returns one record or no record.
|
||||||
using (IDbCommand result = dbm.Manager.Query(
|
IDbCommand result =
|
||||||
|
dbm.Manager.Query(
|
||||||
"SELECT * FROM regions WHERE regionName like ?regionName order by LENGTH(regionName) asc LIMIT 1",
|
"SELECT * FROM regions WHERE regionName like ?regionName order by LENGTH(regionName) asc LIMIT 1",
|
||||||
param))
|
param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -378,7 +382,6 @@ namespace OpenSim.Data.MySQL
|
||||||
dbm.Release();
|
dbm.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters");
|
m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -391,11 +394,11 @@ namespace OpenSim.Data.MySQL
|
||||||
override public DataResponse StoreProfile(RegionProfileData profile)
|
override public DataResponse StoreProfile(RegionProfileData profile)
|
||||||
{
|
{
|
||||||
MySQLSuperManager dbm = GetLockedConnection();
|
MySQLSuperManager dbm = GetLockedConnection();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
if (dbm.Manager.insertRegion(profile))
|
if (dbm.Manager.insertRegion(profile))
|
||||||
|
{
|
||||||
return DataResponse.RESPONSE_OK;
|
return DataResponse.RESPONSE_OK;
|
||||||
else
|
}
|
||||||
return DataResponse.RESPONSE_ERROR;
|
return DataResponse.RESPONSE_ERROR;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -414,14 +417,14 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
MySQLSuperManager dbm = GetLockedConnection();
|
MySQLSuperManager dbm = GetLockedConnection();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
try {
|
||||||
if (dbm.Manager.deleteRegion(uuid))
|
if (dbm.Manager.deleteRegion(uuid))
|
||||||
|
{
|
||||||
return DataResponse.RESPONSE_OK;
|
return DataResponse.RESPONSE_OK;
|
||||||
else
|
|
||||||
return DataResponse.RESPONSE_ERROR;
|
|
||||||
}
|
}
|
||||||
finally
|
return DataResponse.RESPONSE_ERROR;
|
||||||
|
} finally
|
||||||
{
|
{
|
||||||
dbm.Release();
|
dbm.Release();
|
||||||
}
|
}
|
||||||
|
@ -481,24 +484,24 @@ namespace OpenSim.Data.MySQL
|
||||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||||
param["?x"] = x.ToString();
|
param["?x"] = x.ToString();
|
||||||
param["?y"] = y.ToString();
|
param["?y"] = y.ToString();
|
||||||
using (IDbCommand result = dbm.Manager.Query(
|
IDbCommand result =
|
||||||
|
dbm.Manager.Query(
|
||||||
"SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y",
|
"SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y",
|
||||||
param))
|
param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
ReservationData row = dbm.Manager.readReservationRow(reader);
|
ReservationData row = dbm.Manager.readReservationRow(reader);
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
} finally
|
||||||
finally
|
|
||||||
{
|
{
|
||||||
dbm.Release();
|
dbm.Release();
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,13 +135,12 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid",
|
MySqlCommand result =
|
||||||
database.Connection))
|
new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid",
|
||||||
{
|
database.Connection);
|
||||||
result.Parameters.AddWithValue("?uuid", folderID.ToString());
|
result.Parameters.AddWithValue("?uuid", folderID.ToString());
|
||||||
|
MySqlDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
using (MySqlDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
// A null item (because something went wrong) breaks everything in the folder
|
// A null item (because something went wrong) breaks everything in the folder
|
||||||
|
@ -150,15 +149,16 @@ namespace OpenSim.Data.MySQL
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
database.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,28 +176,29 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand result = new MySqlCommand(
|
MySqlCommand result =
|
||||||
|
new MySqlCommand(
|
||||||
"SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
|
"SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
|
||||||
database.Connection))
|
database.Connection);
|
||||||
{
|
|
||||||
result.Parameters.AddWithValue("?uuid", user.ToString());
|
result.Parameters.AddWithValue("?uuid", user.ToString());
|
||||||
result.Parameters.AddWithValue("?zero", UUID.Zero.ToString());
|
result.Parameters.AddWithValue("?zero", UUID.Zero.ToString());
|
||||||
|
MySqlDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
using (MySqlDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
|
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
items.Add(readInventoryFolder(reader));
|
items.Add(readInventoryFolder(reader));
|
||||||
|
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
database.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,15 +217,15 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand result = new MySqlCommand(
|
MySqlCommand result =
|
||||||
|
new MySqlCommand(
|
||||||
"SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
|
"SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
|
||||||
database.Connection))
|
database.Connection);
|
||||||
{
|
|
||||||
result.Parameters.AddWithValue("?uuid", user.ToString());
|
result.Parameters.AddWithValue("?uuid", user.ToString());
|
||||||
result.Parameters.AddWithValue("?zero", UUID.Zero.ToString());
|
result.Parameters.AddWithValue("?zero", UUID.Zero.ToString());
|
||||||
|
|
||||||
using (MySqlDataReader reader = result.ExecuteReader())
|
MySqlDataReader reader = result.ExecuteReader();
|
||||||
{
|
|
||||||
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
|
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
items.Add(readInventoryFolder(reader));
|
items.Add(readInventoryFolder(reader));
|
||||||
|
@ -237,17 +238,20 @@ namespace OpenSim.Data.MySQL
|
||||||
// to put such a message out, and it's too minor right now to spare the time to
|
// to put such a message out, and it's too minor right now to spare the time to
|
||||||
// suitably refactor.
|
// suitably refactor.
|
||||||
if (items.Count > 0)
|
if (items.Count > 0)
|
||||||
|
{
|
||||||
rootFolder = items[0];
|
rootFolder = items[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return rootFolder;
|
return rootFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
database.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,26 +271,27 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid",
|
MySqlCommand result =
|
||||||
database.Connection))
|
new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid",
|
||||||
{
|
database.Connection);
|
||||||
result.Parameters.AddWithValue("?uuid", parentID.ToString());
|
result.Parameters.AddWithValue("?uuid", parentID.ToString());
|
||||||
using (MySqlDataReader reader = result.ExecuteReader())
|
MySqlDataReader reader = result.ExecuteReader();
|
||||||
{
|
|
||||||
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
|
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
|
||||||
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
items.Add(readInventoryFolder(reader));
|
items.Add(readInventoryFolder(reader));
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
database.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,25 +370,25 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection))
|
MySqlCommand result =
|
||||||
{
|
new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection);
|
||||||
result.Parameters.AddWithValue("?uuid", itemID.ToString());
|
result.Parameters.AddWithValue("?uuid", itemID.ToString());
|
||||||
|
MySqlDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
using (MySqlDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
InventoryItemBase item = null;
|
InventoryItemBase item = null;
|
||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
item = readInventoryItem(reader);
|
item = readInventoryItem(reader);
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
database.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +413,7 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -428,25 +433,24 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection))
|
MySqlCommand result =
|
||||||
{
|
new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection);
|
||||||
result.Parameters.AddWithValue("?uuid", folderID.ToString());
|
result.Parameters.AddWithValue("?uuid", folderID.ToString());
|
||||||
|
MySqlDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
using (MySqlDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
InventoryFolderBase folder = null;
|
InventoryFolderBase folder = null;
|
||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
folder = readInventoryFolder(reader);
|
folder = readInventoryFolder(reader);
|
||||||
|
reader.Close();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
database.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -694,58 +698,54 @@ namespace OpenSim.Data.MySQL
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||||
Dictionary<UUID, List<InventoryFolderBase>> hashtable = new Dictionary<UUID, List<InventoryFolderBase>>(); ;
|
Dictionary<UUID, List<InventoryFolderBase>> hashtable
|
||||||
|
= new Dictionary<UUID, List<InventoryFolderBase>>(); ;
|
||||||
List<InventoryFolderBase> parentFolder = new List<InventoryFolderBase>();
|
List<InventoryFolderBase> parentFolder = new List<InventoryFolderBase>();
|
||||||
bool buildResultsFromHashTable = false;
|
|
||||||
|
|
||||||
lock (database)
|
lock (database)
|
||||||
{
|
{
|
||||||
|
MySqlCommand result;
|
||||||
|
MySqlDataReader reader;
|
||||||
|
bool buildResultsFromHashTable = false;
|
||||||
|
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
|
||||||
/* Fetch the parent folder from the database to determine the agent ID, and if
|
/* Fetch the parent folder from the database to determine the agent ID, and if
|
||||||
* we're querying the root of the inventory folder tree */
|
* we're querying the root of the inventory folder tree */
|
||||||
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection))
|
result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid",
|
||||||
{
|
database.Connection);
|
||||||
result.Parameters.AddWithValue("?uuid", parentID.ToString());
|
result.Parameters.AddWithValue("?uuid", parentID.ToString());
|
||||||
|
reader = result.ExecuteReader();
|
||||||
using (MySqlDataReader reader = result.ExecuteReader())
|
while (reader.Read()) // Should be at most 1 result
|
||||||
{
|
|
||||||
// Should be at most 1 result
|
|
||||||
while (reader.Read())
|
|
||||||
parentFolder.Add(readInventoryFolder(reader));
|
parentFolder.Add(readInventoryFolder(reader));
|
||||||
}
|
reader.Close();
|
||||||
}
|
result.Dispose();
|
||||||
|
|
||||||
if (parentFolder.Count >= 1) // No result means parent folder does not exist
|
if (parentFolder.Count >= 1) // No result means parent folder does not exist
|
||||||
{
|
{
|
||||||
if (parentFolder[0].ParentID == UUID.Zero) // We are querying the root folder
|
if (parentFolder[0].ParentID == UUID.Zero) // We are querying the root folder
|
||||||
{
|
{
|
||||||
/* Get all of the agent's folders from the database, put them in a list and return it */
|
/* Get all of the agent's folders from the database, put them in a list and return it */
|
||||||
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE agentID = ?uuid", database.Connection))
|
result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE agentID = ?uuid",
|
||||||
{
|
database.Connection);
|
||||||
result.Parameters.AddWithValue("?uuid", parentFolder[0].Owner.ToString());
|
result.Parameters.AddWithValue("?uuid", parentFolder[0].Owner.ToString());
|
||||||
|
reader = result.ExecuteReader();
|
||||||
using (MySqlDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
InventoryFolderBase curFolder = readInventoryFolder(reader);
|
InventoryFolderBase curFolder = readInventoryFolder(reader);
|
||||||
if (curFolder.ID != parentID) // Do not need to add the root node of the tree to the list
|
if (curFolder.ID != parentID) // Do not need to add the root node of the tree to the list
|
||||||
folders.Add(curFolder);
|
folders.Add(curFolder);
|
||||||
}
|
}
|
||||||
}
|
reader.Close();
|
||||||
}
|
result.Dispose();
|
||||||
} // if we are querying the root folder
|
} // if we are querying the root folder
|
||||||
else // else we are querying a subtree of the inventory folder tree
|
else // else we are querying a subtree of the inventory folder tree
|
||||||
{
|
{
|
||||||
/* Get all of the agent's folders from the database, put them all in a hash table
|
/* Get all of the agent's folders from the database, put them all in a hash table
|
||||||
* indexed by their parent ID */
|
* indexed by their parent ID */
|
||||||
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE agentID = ?uuid", database.Connection))
|
result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE agentID = ?uuid",
|
||||||
{
|
database.Connection);
|
||||||
result.Parameters.AddWithValue("?uuid", parentFolder[0].Owner.ToString());
|
result.Parameters.AddWithValue("?uuid", parentFolder[0].Owner.ToString());
|
||||||
|
reader = result.ExecuteReader();
|
||||||
using (MySqlDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
InventoryFolderBase curFolder = readInventoryFolder(reader);
|
InventoryFolderBase curFolder = readInventoryFolder(reader);
|
||||||
|
@ -759,8 +759,8 @@ namespace OpenSim.Data.MySQL
|
||||||
hashtable.Add(curFolder.ParentID, siblingList);
|
hashtable.Add(curFolder.ParentID, siblingList);
|
||||||
}
|
}
|
||||||
} // while more items to read from the database
|
} // while more items to read from the database
|
||||||
}
|
reader.Close();
|
||||||
}
|
result.Dispose();
|
||||||
|
|
||||||
// Set flag so we know we need to build the results from the hash table after
|
// Set flag so we know we need to build the results from the hash table after
|
||||||
// we unlock the database
|
// we unlock the database
|
||||||
|
@ -781,13 +781,12 @@ namespace OpenSim.Data.MySQL
|
||||||
folders.AddRange(hashtable[folders[i].ID]);
|
folders.AddRange(hashtable[folders[i].ID]);
|
||||||
}
|
}
|
||||||
} // lock (database)
|
} // lock (database)
|
||||||
|
|
||||||
return folders;
|
return folders;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
database.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -802,18 +801,19 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection))
|
MySqlCommand cmd =
|
||||||
{
|
new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection);
|
||||||
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
|
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
|
||||||
|
|
||||||
lock (database)
|
lock (database)
|
||||||
|
{
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
database.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,11 +827,12 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection))
|
MySqlCommand cmd =
|
||||||
{
|
new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection);
|
||||||
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
|
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
|
||||||
|
|
||||||
lock (database)
|
lock (database)
|
||||||
|
{
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -864,21 +865,20 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
|
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
|
||||||
{
|
{
|
||||||
|
MySqlDataReader result = null;
|
||||||
|
MySqlCommand sqlCmd = null;
|
||||||
lock (database)
|
lock (database)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
database.CheckConnection();
|
database.CheckConnection();
|
||||||
|
sqlCmd = new MySqlCommand(
|
||||||
using (MySqlCommand sqlCmd = new MySqlCommand(
|
|
||||||
"SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags = 1",
|
"SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags = 1",
|
||||||
database.Connection))
|
database.Connection);
|
||||||
{
|
|
||||||
sqlCmd.Parameters.AddWithValue("?uuid", avatarID.ToString());
|
sqlCmd.Parameters.AddWithValue("?uuid", avatarID.ToString());
|
||||||
sqlCmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
|
sqlCmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
|
||||||
|
result = sqlCmd.ExecuteReader();
|
||||||
|
|
||||||
using (MySqlDataReader result = sqlCmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
List<InventoryItemBase> list = new List<InventoryItemBase>();
|
List<InventoryItemBase> list = new List<InventoryItemBase>();
|
||||||
while (result.Read())
|
while (result.Read())
|
||||||
{
|
{
|
||||||
|
@ -888,14 +888,17 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
database.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (result != null) result.Close();
|
||||||
|
if (sqlCmd != null) sqlCmd.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,8 +134,8 @@ namespace OpenSim.Data.MySQL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void GetWaitTimeout()
|
protected void GetWaitTimeout()
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, dbcon))
|
MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, dbcon);
|
||||||
{
|
|
||||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||||
{
|
{
|
||||||
if (dbReader.Read())
|
if (dbReader.Read())
|
||||||
|
@ -143,7 +143,9 @@ namespace OpenSim.Data.MySQL
|
||||||
m_waitTimeout
|
m_waitTimeout
|
||||||
= Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
|
= Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
dbReader.Close();
|
||||||
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastConnectionUse = DateTime.Now.Ticks;
|
m_lastConnectionUse = DateTime.Now.Ticks;
|
||||||
|
@ -301,10 +303,10 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
|
|
||||||
using (MySqlCommand tablesCmd = new MySqlCommand(
|
MySqlCommand tablesCmd =
|
||||||
|
new MySqlCommand(
|
||||||
"SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname",
|
"SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname",
|
||||||
dbcon))
|
dbcon);
|
||||||
{
|
|
||||||
tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database);
|
tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database);
|
||||||
|
|
||||||
using (MySqlDataReader tables = tablesCmd.ExecuteReader())
|
using (MySqlDataReader tables = tablesCmd.ExecuteReader())
|
||||||
|
@ -322,10 +324,10 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tables.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,7 +358,7 @@ namespace OpenSim.Data.MySQL
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
// Return null if it fails.
|
// Return null if it fails.
|
||||||
m_log.Error("Failed during Query generation: " + e.Message, e);
|
m_log.Error("Failed during Query generation: " + e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -692,6 +694,8 @@ namespace OpenSim.Data.MySQL
|
||||||
ret.Add(attachpoint, item);
|
ret.Add(attachpoint, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.Close();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,14 +56,13 @@ namespace OpenSim.Data.MySQL
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
command += " and ScopeID = ?scopeID";
|
command += " and ScopeID = ?scopeID";
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
MySqlCommand cmd = new MySqlCommand(command);
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue("?regionName", regionName);
|
cmd.Parameters.AddWithValue("?regionName", regionName);
|
||||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||||
|
|
||||||
return RunCommand(cmd);
|
return RunCommand(cmd);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public RegionData Get(int posX, int posY, UUID scopeID)
|
public RegionData Get(int posX, int posY, UUID scopeID)
|
||||||
{
|
{
|
||||||
|
@ -71,8 +70,8 @@ namespace OpenSim.Data.MySQL
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
command += " and ScopeID = ?scopeID";
|
command += " and ScopeID = ?scopeID";
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
MySqlCommand cmd = new MySqlCommand(command);
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue("?posX", posX.ToString());
|
cmd.Parameters.AddWithValue("?posX", posX.ToString());
|
||||||
cmd.Parameters.AddWithValue("?posY", posY.ToString());
|
cmd.Parameters.AddWithValue("?posY", posY.ToString());
|
||||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||||
|
@ -83,7 +82,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
return ret[0];
|
return ret[0];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public RegionData Get(UUID regionID, UUID scopeID)
|
public RegionData Get(UUID regionID, UUID scopeID)
|
||||||
{
|
{
|
||||||
|
@ -91,8 +89,8 @@ namespace OpenSim.Data.MySQL
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
command += " and ScopeID = ?scopeID";
|
command += " and ScopeID = ?scopeID";
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
MySqlCommand cmd = new MySqlCommand(command);
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||||
|
|
||||||
|
@ -102,7 +100,6 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
return ret[0];
|
return ret[0];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
|
public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
|
||||||
{
|
{
|
||||||
|
@ -110,8 +107,8 @@ namespace OpenSim.Data.MySQL
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
command += " and ScopeID = ?scopeID";
|
command += " and ScopeID = ?scopeID";
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
MySqlCommand cmd = new MySqlCommand(command);
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue("?startX", startX.ToString());
|
cmd.Parameters.AddWithValue("?startX", startX.ToString());
|
||||||
cmd.Parameters.AddWithValue("?startY", startY.ToString());
|
cmd.Parameters.AddWithValue("?startY", startY.ToString());
|
||||||
cmd.Parameters.AddWithValue("?endX", endX.ToString());
|
cmd.Parameters.AddWithValue("?endX", endX.ToString());
|
||||||
|
@ -120,14 +117,13 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
return RunCommand(cmd);
|
return RunCommand(cmd);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public List<RegionData> RunCommand(MySqlCommand cmd)
|
public List<RegionData> RunCommand(MySqlCommand cmd)
|
||||||
{
|
{
|
||||||
List<RegionData> retList = new List<RegionData>();
|
List<RegionData> retList = new List<RegionData>();
|
||||||
|
|
||||||
using (IDataReader result = ExecuteReader(cmd))
|
IDataReader result = ExecuteReader(cmd);
|
||||||
{
|
|
||||||
while (result.Read())
|
while (result.Read())
|
||||||
{
|
{
|
||||||
RegionData ret = new RegionData();
|
RegionData ret = new RegionData();
|
||||||
|
@ -176,8 +172,8 @@ namespace OpenSim.Data.MySQL
|
||||||
retList.Add(ret);
|
retList.Add(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseDBConnection(result, cmd);
|
result.Close();
|
||||||
}
|
CloseReaderCommand(cmd);
|
||||||
|
|
||||||
return retList;
|
return retList;
|
||||||
}
|
}
|
||||||
|
@ -205,8 +201,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
MySqlCommand cmd = new MySqlCommand();
|
||||||
{
|
|
||||||
string update = "update `"+m_Realm+"` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY";
|
string update = "update `"+m_Realm+"` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY";
|
||||||
foreach (string field in fields)
|
foreach (string field in fields)
|
||||||
{
|
{
|
||||||
|
@ -240,37 +236,41 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) < 1)
|
if (ExecuteNonQuery(cmd) < 1)
|
||||||
{
|
{
|
||||||
|
cmd.Dispose();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
cmd.Dispose();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetDataItem(UUID regionID, string item, string value)
|
public bool SetDataItem(UUID regionID, string item, string value)
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand("update `" + m_Realm + "` set `" + item + "` = ?" + item + " where uuid = ?UUID"))
|
MySqlCommand cmd = new MySqlCommand("update `" + m_Realm +
|
||||||
{
|
"` set `" + item + "` = ?" + item + " where uuid = ?UUID");
|
||||||
|
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?"+item, value);
|
cmd.Parameters.AddWithValue("?"+item, value);
|
||||||
cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
|
cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) > 0)
|
if (ExecuteNonQuery(cmd) > 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(UUID regionID)
|
public bool Delete(UUID regionID)
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand("delete from `" + m_Realm + "` where uuid = ?UUID"))
|
MySqlCommand cmd = new MySqlCommand("delete from `" + m_Realm +
|
||||||
{
|
"` where uuid = ?UUID");
|
||||||
|
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
|
cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) > 0)
|
if (ExecuteNonQuery(cmd) > 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,15 +97,17 @@ namespace OpenSim.Data.MySQL
|
||||||
ret.Data[s] = result[s].ToString();
|
ret.Data[s] = result[s].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseDBConnection(result, cmd);
|
result.Close();
|
||||||
|
CloseReaderCommand(cmd);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
result.Close();
|
||||||
CloseDBConnection(result, cmd);
|
CloseReaderCommand(cmd);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public bool Store(UserAccountData data)
|
public bool Store(UserAccountData data)
|
||||||
{
|
{
|
||||||
|
@ -116,8 +118,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
MySqlCommand cmd = new MySqlCommand();
|
||||||
{
|
|
||||||
string update = "update `"+m_Realm+"` set ";
|
string update = "update `"+m_Realm+"` set ";
|
||||||
bool first = true;
|
bool first = true;
|
||||||
foreach (string field in fields)
|
foreach (string field in fields)
|
||||||
|
@ -154,22 +156,23 @@ namespace OpenSim.Data.MySQL
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
cmd.Dispose();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetDataItem(UUID principalID, string item, string value)
|
public bool SetDataItem(UUID principalID, string item, string value)
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand("update `" + m_Realm + "` set `" +
|
MySqlCommand cmd = new MySqlCommand("update `" + m_Realm +
|
||||||
item + "` = ?" + item + " where UUID = ?UUID"))
|
"` set `" + item + "` = ?" + item + " where UUID = ?UUID");
|
||||||
{
|
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?"+item, value);
|
cmd.Parameters.AddWithValue("?"+item, value);
|
||||||
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
|
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) > 0)
|
if (ExecuteNonQuery(cmd) > 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,20 +181,21 @@ namespace OpenSim.Data.MySQL
|
||||||
param["?first"] = user;
|
param["?first"] = user;
|
||||||
param["?second"] = last;
|
param["?second"] = last;
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query(
|
IDbCommand result =
|
||||||
"SELECT * FROM " + m_usersTableName + " WHERE username = ?first AND lastname = ?second", param))
|
dbm.Manager.Query(
|
||||||
{
|
"SELECT * FROM " + m_usersTableName + " WHERE username = ?first AND lastname = ?second", param);
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
IDataReader reader = result.ExecuteReader();
|
||||||
{
|
|
||||||
UserProfileData row = dbm.Manager.readUserRow(reader);
|
UserProfileData row = dbm.Manager.readUserRow(reader);
|
||||||
|
|
||||||
|
reader.Dispose();
|
||||||
|
result.Dispose();
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -219,30 +220,28 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (IDbCommand adder = dbm.Manager.Query(
|
IDbCommand adder =
|
||||||
|
dbm.Manager.Query(
|
||||||
"INSERT INTO `" + m_userFriendsTableName + "` " +
|
"INSERT INTO `" + m_userFriendsTableName + "` " +
|
||||||
"(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " +
|
"(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " +
|
||||||
"VALUES " +
|
"VALUES " +
|
||||||
"(?ownerID,?friendID,?friendPerms,?datetimestamp)",
|
"(?ownerID,?friendID,?friendPerms,?datetimestamp)",
|
||||||
param))
|
param);
|
||||||
{
|
|
||||||
adder.ExecuteNonQuery();
|
adder.ExecuteNonQuery();
|
||||||
}
|
|
||||||
|
|
||||||
using (IDbCommand adder = dbm.Manager.Query(
|
adder =
|
||||||
|
dbm.Manager.Query(
|
||||||
"INSERT INTO `" + m_userFriendsTableName + "` " +
|
"INSERT INTO `" + m_userFriendsTableName + "` " +
|
||||||
"(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " +
|
"(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " +
|
||||||
"VALUES " +
|
"VALUES " +
|
||||||
"(?friendID,?ownerID,?friendPerms,?datetimestamp)",
|
"(?friendID,?ownerID,?friendPerms,?datetimestamp)",
|
||||||
param))
|
param);
|
||||||
{
|
|
||||||
adder.ExecuteNonQuery();
|
adder.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -261,24 +260,22 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (IDbCommand updater = dbm.Manager.Query(
|
IDbCommand updater =
|
||||||
|
dbm.Manager.Query(
|
||||||
"delete from " + m_userFriendsTableName + " where ownerID = ?ownerID and friendID = ?friendID",
|
"delete from " + m_userFriendsTableName + " where ownerID = ?ownerID and friendID = ?friendID",
|
||||||
param))
|
param);
|
||||||
{
|
|
||||||
updater.ExecuteNonQuery();
|
updater.ExecuteNonQuery();
|
||||||
}
|
|
||||||
|
|
||||||
using (IDbCommand updater = dbm.Manager.Query(
|
updater =
|
||||||
|
dbm.Manager.Query(
|
||||||
"delete from " + m_userFriendsTableName + " where ownerID = ?friendID and friendID = ?ownerID",
|
"delete from " + m_userFriendsTableName + " where ownerID = ?friendID and friendID = ?ownerID",
|
||||||
param))
|
param);
|
||||||
{
|
|
||||||
updater.ExecuteNonQuery();
|
updater.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -298,19 +295,18 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (IDbCommand updater = dbm.Manager.Query(
|
IDbCommand updater =
|
||||||
|
dbm.Manager.Query(
|
||||||
"update " + m_userFriendsTableName +
|
"update " + m_userFriendsTableName +
|
||||||
" SET friendPerms = ?friendPerms " +
|
" SET friendPerms = ?friendPerms " +
|
||||||
"where ownerID = ?ownerID and friendID = ?friendID",
|
"where ownerID = ?ownerID and friendID = ?friendID",
|
||||||
param))
|
param);
|
||||||
{
|
|
||||||
updater.ExecuteNonQuery();
|
updater.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -331,14 +327,14 @@ namespace OpenSim.Data.MySQL
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Left Join userfriends to itself
|
//Left Join userfriends to itself
|
||||||
using (IDbCommand result = dbm.Manager.Query(
|
IDbCommand result =
|
||||||
|
dbm.Manager.Query(
|
||||||
"select a.ownerID,a.friendID,a.friendPerms,b.friendPerms as ownerperms from " +
|
"select a.ownerID,a.friendID,a.friendPerms,b.friendPerms as ownerperms from " +
|
||||||
m_userFriendsTableName + " as a, " + m_userFriendsTableName + " as b" +
|
m_userFriendsTableName + " as a, " + m_userFriendsTableName + " as b" +
|
||||||
" where a.ownerID = ?ownerID and b.ownerID = a.friendID and b.friendID = a.ownerID",
|
" where a.ownerID = ?ownerID and b.ownerID = a.friendID and b.friendID = a.ownerID",
|
||||||
param))
|
param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
FriendListItem fli = new FriendListItem();
|
FriendListItem fli = new FriendListItem();
|
||||||
|
@ -351,13 +347,14 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
Lfli.Add(fli);
|
Lfli.Add(fli);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
reader.Dispose();
|
||||||
|
result.Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return Lfli;
|
return Lfli;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -379,12 +376,11 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||||
param["?uuid"] = uuid.ToString();
|
param["?uuid"] = uuid.ToString();
|
||||||
|
IDbCommand result =
|
||||||
|
dbm.Manager.Query("select agentOnline,currentHandle from " + m_agentsTableName +
|
||||||
|
" where UUID = ?uuid", param);
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query("select agentOnline,currentHandle from " + m_agentsTableName +
|
IDataReader reader = result.ExecuteReader();
|
||||||
" where UUID = ?uuid", param))
|
|
||||||
{
|
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
FriendRegionInfo fri = new FriendRegionInfo();
|
FriendRegionInfo fri = new FriendRegionInfo();
|
||||||
|
@ -393,15 +389,16 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
infos[uuid] = fri;
|
infos[uuid] = fri;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
reader.Dispose();
|
||||||
|
result.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[MYSQL]: Got exception on trying to find friends regions:", e);
|
m_log.Warn("[MYSQL]: Got exception on trying to find friends regions:", e);
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -430,13 +427,13 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (IDbCommand result = dbm.Manager.Query(
|
IDbCommand result =
|
||||||
|
dbm.Manager.Query(
|
||||||
"SELECT UUID,username,lastname FROM " + m_usersTableName +
|
"SELECT UUID,username,lastname FROM " + m_usersTableName +
|
||||||
" WHERE username like ?first AND lastname like ?second LIMIT 100",
|
" WHERE username like ?first AND lastname like ?second LIMIT 100",
|
||||||
param))
|
param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
AvatarPickerAvatar user = new AvatarPickerAvatar();
|
AvatarPickerAvatar user = new AvatarPickerAvatar();
|
||||||
|
@ -445,13 +442,13 @@ namespace OpenSim.Data.MySQL
|
||||||
user.lastName = (string) reader["lastname"];
|
user.lastName = (string) reader["lastname"];
|
||||||
returnlist.Add(user);
|
returnlist.Add(user);
|
||||||
}
|
}
|
||||||
}
|
reader.Dispose();
|
||||||
}
|
result.Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return returnlist;
|
return returnlist;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -468,13 +465,13 @@ namespace OpenSim.Data.MySQL
|
||||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||||
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
|
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query(
|
IDbCommand result =
|
||||||
|
dbm.Manager.Query(
|
||||||
"SELECT UUID,username,lastname FROM " + m_usersTableName +
|
"SELECT UUID,username,lastname FROM " + m_usersTableName +
|
||||||
" WHERE username like ?first OR lastname like ?first LIMIT 100",
|
" WHERE username like ?first OR lastname like ?first LIMIT 100",
|
||||||
param))
|
param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
AvatarPickerAvatar user = new AvatarPickerAvatar();
|
AvatarPickerAvatar user = new AvatarPickerAvatar();
|
||||||
|
@ -483,13 +480,13 @@ namespace OpenSim.Data.MySQL
|
||||||
user.lastName = (string) reader["lastname"];
|
user.lastName = (string) reader["lastname"];
|
||||||
returnlist.Add(user);
|
returnlist.Add(user);
|
||||||
}
|
}
|
||||||
}
|
reader.Dispose();
|
||||||
}
|
result.Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return returnlist;
|
return returnlist;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -513,19 +510,20 @@ namespace OpenSim.Data.MySQL
|
||||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||||
param["?uuid"] = uuid.ToString();
|
param["?uuid"] = uuid.ToString();
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_usersTableName + " WHERE UUID = ?uuid", param))
|
IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_usersTableName + " WHERE UUID = ?uuid", param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
UserProfileData row = dbm.Manager.readUserRow(reader);
|
UserProfileData row = dbm.Manager.readUserRow(reader);
|
||||||
|
|
||||||
|
reader.Dispose();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -579,7 +577,7 @@ namespace OpenSim.Data.MySQL
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -602,19 +600,21 @@ namespace OpenSim.Data.MySQL
|
||||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||||
param["?uuid"] = uuid.ToString();
|
param["?uuid"] = uuid.ToString();
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_agentsTableName + " WHERE UUID = ?uuid", param))
|
IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_agentsTableName + " WHERE UUID = ?uuid",
|
||||||
{
|
param);
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
IDataReader reader = result.ExecuteReader();
|
||||||
{
|
|
||||||
UserAgentData row = dbm.Manager.readAgentRow(reader);
|
UserAgentData row = dbm.Manager.readAgentRow(reader);
|
||||||
|
|
||||||
|
reader.Dispose();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -638,8 +638,7 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dbm.Manager.insertUserRow(
|
dbm.Manager.insertUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
|
||||||
user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
|
|
||||||
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y,
|
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y,
|
||||||
user.HomeLocation.Z,
|
user.HomeLocation.Z,
|
||||||
user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created,
|
user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created,
|
||||||
|
@ -651,7 +650,7 @@ namespace OpenSim.Data.MySQL
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -677,7 +676,7 @@ namespace OpenSim.Data.MySQL
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -694,8 +693,7 @@ namespace OpenSim.Data.MySQL
|
||||||
MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile");
|
MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dbm.Manager.updateUserRow(
|
dbm.Manager.updateUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
|
||||||
user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
|
|
||||||
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y,
|
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y,
|
||||||
user.HomeLocation.Z, user.HomeLookAt.X,
|
user.HomeLocation.Z, user.HomeLookAt.X,
|
||||||
user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin,
|
user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin,
|
||||||
|
@ -750,29 +748,29 @@ namespace OpenSim.Data.MySQL
|
||||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||||
param["?owner"] = user.ToString();
|
param["?owner"] = user.ToString();
|
||||||
|
|
||||||
using (IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_appearanceTableName + " WHERE owner = ?owner", param))
|
IDbCommand result = dbm.Manager.Query(
|
||||||
{
|
"SELECT * FROM " + m_appearanceTableName + " WHERE owner = ?owner", param);
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
IDataReader reader = result.ExecuteReader();
|
||||||
{
|
|
||||||
AvatarAppearance appearance = dbm.Manager.readAppearanceRow(reader);
|
AvatarAppearance appearance = dbm.Manager.readAppearanceRow(reader);
|
||||||
|
|
||||||
if (appearance == null)
|
reader.Dispose();
|
||||||
|
result.Dispose();
|
||||||
|
|
||||||
|
if (null == appearance)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[USER DB] No appearance found for user {0}", user.ToString());
|
m_log.WarnFormat("[USER DB] No appearance found for user {0}", user.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
appearance.SetAttachments(GetUserAttachments(user));
|
appearance.SetAttachments(GetUserAttachments(user));
|
||||||
|
|
||||||
return appearance;
|
return appearance;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -800,7 +798,7 @@ namespace OpenSim.Data.MySQL
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -835,20 +833,20 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (IDbCommand result = dbm.Manager.Query(
|
IDbCommand result = dbm.Manager.Query(
|
||||||
"SELECT attachpoint, item, asset from " + m_attachmentsTableName + " WHERE UUID = ?uuid", param))
|
"SELECT attachpoint, item, asset from " + m_attachmentsTableName + " WHERE UUID = ?uuid", param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
using (IDataReader reader = result.ExecuteReader())
|
|
||||||
{
|
|
||||||
Hashtable ret = dbm.Manager.readAttachments(reader);
|
Hashtable ret = dbm.Manager.readAttachments(reader);
|
||||||
|
|
||||||
|
reader.Dispose();
|
||||||
|
result.Dispose();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -907,7 +905,7 @@ namespace OpenSim.Data.MySQL
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
dbm.Manager.Reconnect();
|
dbm.Manager.Reconnect();
|
||||||
m_log.Error(e.Message, e);
|
m_log.Error(e.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
Loading…
Reference in New Issue