MySQLConnector is not a MS product

httptests
UbitUmarov 2017-05-06 01:25:54 +01:00
parent 8e30016841
commit d9038e650a
12 changed files with 110 additions and 14 deletions

View File

@ -75,6 +75,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open(); dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AssetStore"); Migration m = new Migration(dbcon, Assembly, "AssetStore");
m.Update(); m.Update();
dbcon.Close();
} }
} }
@ -144,6 +145,7 @@ namespace OpenSim.Data.MySQL
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e); string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e);
} }
} }
dbcon.Close();
} }
return asset; return asset;
@ -209,6 +211,7 @@ namespace OpenSim.Data.MySQL
return false; return false;
} }
} }
dbcon.Close();
} }
} }
@ -238,6 +241,7 @@ namespace OpenSim.Data.MySQL
e); e);
} }
} }
dbcon.Close();
} }
} }
@ -270,6 +274,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
bool[] results = new bool[uuids.Length]; bool[] results = new bool[uuids.Length];
@ -334,6 +339,7 @@ namespace OpenSim.Data.MySQL
e); e);
} }
} }
dbcon.Close();
} }
return retList; return retList;
@ -350,6 +356,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?id", id); cmd.Parameters.AddWithValue("?id", id);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
return true; return true;

View File

@ -59,6 +59,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open(); dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AuthStore"); Migration m = new Migration(dbcon, Assembly, "AuthStore");
m.Update(); m.Update();
dbcon.Close();
} }
} }
@ -99,6 +100,7 @@ namespace OpenSim.Data.MySQL
return null; return null;
} }
} }
dbcon.Close();
} }
} }

View File

@ -171,12 +171,13 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
if (!found && create) if (!found && create)
{ {
DoCreate(es); DoCreate(es);
LinkRegion(regionID, (int)es.EstateID); LinkRegion(regionID, (int)es.EstateID);
} }
cmd.Connection = null;
dbcon.Close();
} }
LoadBanList(es); LoadBanList(es);
@ -231,6 +232,7 @@ namespace OpenSim.Data.MySQL
es.Save(); es.Save();
} }
dbcon.Close();
} }
} }
@ -263,6 +265,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
SaveBanList(es); SaveBanList(es);
@ -300,6 +303,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
@ -329,6 +333,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear(); cmd.Parameters.Clear();
} }
} }
dbcon.Close();
} }
} }
@ -358,6 +363,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear(); cmd.Parameters.Clear();
} }
} }
dbcon.Close();
} }
} }
@ -383,6 +389,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
return uuids.ToArray(); return uuids.ToArray();
@ -437,7 +444,6 @@ namespace OpenSim.Data.MySQL
reader.Close(); reader.Close();
} }
} }
dbcon.Close(); dbcon.Close();
} }
@ -466,7 +472,6 @@ namespace OpenSim.Data.MySQL
reader.Close(); reader.Close();
} }
} }
dbcon.Close(); dbcon.Close();
} }

View File

@ -121,9 +121,13 @@ namespace OpenSim.Data.MySQL
} }
catch (MySqlException e) catch (MySqlException e)
{ {
cmd.Connection = null;
conn.Close();
m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString()); m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString());
return false; return false;
} }
cmd.Connection = null;
conn.Close();
} }
return true; return true;
@ -175,7 +179,7 @@ namespace OpenSim.Data.MySQL
UpdateAccessTime(id, AccessTime); UpdateAccessTime(id, AccessTime);
} }
} }
conn.Close();
} }
return meta; return meta;
@ -206,6 +210,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?id", AssetID); cmd.Parameters.AddWithValue("?id", AssetID);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
conn.Close();
} }
} }
@ -299,6 +304,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
conn.Close();
} }
for (int i = 0; i < uuids.Length; i++) for (int i = 0; i < uuids.Length; i++)
@ -333,6 +339,7 @@ namespace OpenSim.Data.MySQL
count = Convert.ToInt32(reader["count"]); count = Convert.ToInt32(reader["count"]);
} }
} }
conn.Close();
} }
return count; return count;
@ -413,8 +420,8 @@ namespace OpenSim.Data.MySQL
imported++; imported++;
} }
} }
} }
importConn.Close();
} }
MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported)); MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported));

View File

@ -74,7 +74,9 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
dbcon.Open(); dbcon.Open();
return ExecuteNonQueryWithConnection(cmd, dbcon); int ret = ExecuteNonQueryWithConnection(cmd, dbcon);
dbcon.Close();
return ret;
} }
} }
else else
@ -97,12 +99,15 @@ namespace OpenSim.Data.MySQL
try try
{ {
return cmd.ExecuteNonQuery(); int ret = cmd.ExecuteNonQuery();
cmd.Connection = null;
return ret;
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error(e.Message, e); m_log.Error(e.Message, e);
m_log.Error(Environment.StackTrace.ToString()); m_log.Error(Environment.StackTrace.ToString());
cmd.Connection = null;
return 0; return 0;
} }
} }

View File

@ -160,8 +160,9 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
dbcon.Open(); dbcon.Open();
T[] ret = DoQueryWithConnection(cmd, dbcon);
return DoQueryWithConnection(cmd, dbcon); dbcon.Close();
return ret;
} }
} }
else else
@ -243,7 +244,7 @@ namespace OpenSim.Data.MySQL
result.Add(row); result.Add(row);
} }
} }
cmd.Connection = null;
return result.ToArray(); return result.ToArray();
} }
@ -402,7 +403,10 @@ namespace OpenSim.Data.MySQL
dbcon.Open(); dbcon.Open();
cmd.Connection = dbcon; cmd.Connection = dbcon;
return cmd.ExecuteScalar(); Object ret = cmd.ExecuteScalar();
cmd.Connection = null;
dbcon.Close();
return ret;
} }
} }
else else

View File

@ -78,6 +78,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open(); dbcon.Open();
Migration m = new Migration(dbcon, assem, "InventoryStore"); Migration m = new Migration(dbcon, assem, "InventoryStore");
m.Update(); m.Update();
dbcon.Close();
} }
} }
@ -133,6 +134,7 @@ namespace OpenSim.Data.MySQL
return items; return items;
} }
} }
dbcon.Close();
} }
} }
} }
@ -173,6 +175,7 @@ namespace OpenSim.Data.MySQL
return items; return items;
} }
} }
dbcon.Close();
} }
} }
} }
@ -224,6 +227,7 @@ namespace OpenSim.Data.MySQL
return rootFolder; return rootFolder;
} }
} }
dbcon.Close();
} }
} }
} }
@ -264,6 +268,7 @@ namespace OpenSim.Data.MySQL
return items; return items;
} }
} }
dbcon.Close();
} }
} }
} }
@ -355,6 +360,7 @@ namespace OpenSim.Data.MySQL
return item; return item;
} }
} }
dbcon.Close();
} }
} }
} }
@ -420,6 +426,7 @@ namespace OpenSim.Data.MySQL
return folder; return folder;
} }
} }
dbcon.Close();
} }
} }
} }
@ -497,6 +504,8 @@ namespace OpenSim.Data.MySQL
result.Dispose(); result.Dispose();
} }
dbcon.Close();
using (MySqlCommand result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon)) using (MySqlCommand result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon))
{ {
result.Parameters.AddWithValue("?folderID", item.Folder.ToString()); result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
@ -540,6 +549,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock) lock (m_dbLock)
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (MySqlException e) catch (MySqlException e)
@ -600,6 +610,7 @@ namespace OpenSim.Data.MySQL
m_log.Error(e.ToString()); m_log.Error(e.ToString());
} }
} }
dbcon.Close();
} }
} }
@ -643,6 +654,7 @@ namespace OpenSim.Data.MySQL
m_log.Error(e.ToString()); m_log.Error(e.ToString());
} }
} }
dbcon.Close();
} }
} }
@ -806,6 +818,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock) lock (m_dbLock)
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (MySqlException e) catch (MySqlException e)
@ -833,6 +846,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock) lock (m_dbLock)
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (MySqlException e) catch (MySqlException e)
@ -889,6 +903,7 @@ namespace OpenSim.Data.MySQL
return list; return list;
} }
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -60,6 +60,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open(); dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "GridStore"); Migration m = new Migration(dbcon, Assembly, "GridStore");
m.Update(); m.Update();
dbcon.Close();
} }
} }
@ -260,6 +261,8 @@ namespace OpenSim.Data.MySQL
retList.Add(ret); retList.Add(ret);
} }
} }
cmd.Connection = null;
dbcon.Close();
} }
return retList; return retList;

View File

@ -88,6 +88,7 @@ namespace OpenSim.Data.MySQL
// //
Migration m = new Migration(dbcon, Assembly, "RegionStore"); Migration m = new Migration(dbcon, Assembly, "RegionStore");
m.Update(); m.Update();
dbcon.Close();
} }
} }
@ -334,6 +335,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
} }
} }
} }
@ -372,6 +374,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
} }
} }
} }
@ -411,6 +414,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
} }
} }
} }
@ -460,6 +464,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
@ -535,6 +540,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
@ -580,6 +586,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
prim.Inventory.RestoreInventoryItems(inventory); prim.Inventory.RestoreInventoryItems(inventory);
@ -634,6 +641,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
}); });
@ -681,6 +689,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
}); });
@ -727,6 +736,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
@ -762,6 +772,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
@ -783,6 +794,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
} }
} }
} }
@ -842,6 +854,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear(); cmd.Parameters.Clear();
} }
} }
dbcon.Close();
} }
} }
} }
@ -939,6 +952,7 @@ namespace OpenSim.Data.MySQL
nWP.valid = true; nWP.valid = true;
} }
} }
dbcon.Close();
} }
return nWP; return nWP;
@ -976,6 +990,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
@ -1084,6 +1099,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
} }
} }
@ -1099,6 +1115,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
} }
} }
@ -1127,6 +1144,7 @@ namespace OpenSim.Data.MySQL
return Convert.ToString(result["llsd_settings"]); return Convert.ToString(result["llsd_settings"]);
} }
} }
dbcon.Close();
} }
} }
@ -1145,6 +1163,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
} }
} }
@ -1160,6 +1179,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
} }
} }
#endregion #endregion
@ -1212,7 +1232,7 @@ namespace OpenSim.Data.MySQL
FillRegionSettingsCommand(cmd, rs); FillRegionSettingsCommand(cmd, rs);
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
SaveSpawnPoints(rs); SaveSpawnPoints(rs);
} }
} }
@ -1259,6 +1279,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
@ -2123,6 +2144,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
} }
dbcon.Close();
} }
} }
} }
@ -2152,6 +2174,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
@ -2187,6 +2210,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
} }
@ -2221,6 +2245,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear(); cmd.Parameters.Clear();
} }
} }
dbcon.Close();
} }
} }
} }
@ -2240,6 +2265,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
@ -2257,6 +2283,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
@ -2280,6 +2307,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
return ret; return ret;

View File

@ -69,6 +69,7 @@ namespace OpenSim.Data.MySQL
Migration m = new Migration(dbcon, Assembly, "UserProfiles"); Migration m = new Migration(dbcon, Assembly, "UserProfiles");
m.Update(); m.Update();
dbcon.Close();
} }
} }
#endregion Member Functions #endregion Member Functions
@ -121,6 +122,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
return data; return data;
} }
@ -228,6 +230,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -258,6 +261,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?recordId", recordId.ToString()); cmd.Parameters.AddWithValue("?recordId", recordId.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -352,6 +356,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -474,6 +479,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -504,6 +510,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -548,6 +555,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -596,6 +604,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -719,6 +728,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -759,6 +769,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -884,6 +895,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -939,6 +951,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -975,6 +988,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -1035,6 +1049,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)
@ -1072,6 +1087,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
dbcon.Close();
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -97,6 +97,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open(); dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "XAssetStore"); Migration m = new Migration(dbcon, Assembly, "XAssetStore");
m.Update(); m.Update();
dbcon.Close();
} }
} }
@ -184,6 +185,7 @@ namespace OpenSim.Data.MySQL
m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e); m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e);
} }
} }
dbcon.Close();
} }
return asset; return asset;
@ -303,6 +305,7 @@ namespace OpenSim.Data.MySQL
transaction.Commit(); transaction.Commit();
} }
dbcon.Close();
} }
} }
@ -344,6 +347,7 @@ namespace OpenSim.Data.MySQL
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}", "[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
assetMetadata.ID, assetMetadata.Name); assetMetadata.ID, assetMetadata.Name);
} }
dbcon.Close();
} }
} }
@ -474,6 +478,7 @@ namespace OpenSim.Data.MySQL
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString()); m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
} }
} }
dbcon.Close();
} }
return retList; return retList;
@ -492,9 +497,9 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?ID", id); cmd.Parameters.AddWithValue("?ID", id);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we // TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
// keep a reference count (?) // keep a reference count (?)
dbcon.Close();
} }
return true; return true;

View File

@ -328,7 +328,6 @@ namespace OpenSim.Data.MySQL
{ {
return false; return false;
} }
cmd.Dispose();
} }
dbcon.Close(); dbcon.Close();