Consistently use using() to make sure we dispose of used MySqlCommands where this is not already being done.
parent
8380166251
commit
522eff6138
|
@ -163,52 +163,51 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
MySqlCommand cmd =
|
using (MySqlCommand cmd =
|
||||||
new MySqlCommand(
|
new MySqlCommand(
|
||||||
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
|
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
|
||||||
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
|
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
|
||||||
dbcon);
|
dbcon))
|
||||||
|
|
||||||
string assetName = asset.Name;
|
|
||||||
if (asset.Name.Length > 64)
|
|
||||||
{
|
{
|
||||||
assetName = asset.Name.Substring(0, 64);
|
string assetName = asset.Name;
|
||||||
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add");
|
if (asset.Name.Length > 64)
|
||||||
}
|
|
||||||
|
|
||||||
string assetDescription = asset.Description;
|
|
||||||
if (asset.Description.Length > 64)
|
|
||||||
{
|
|
||||||
assetDescription = asset.Description.Substring(0, 64);
|
|
||||||
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
|
|
||||||
}
|
|
||||||
|
|
||||||
// need to ensure we dispose
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (cmd)
|
|
||||||
{
|
{
|
||||||
// create unix epoch time
|
assetName = asset.Name.Substring(0, 64);
|
||||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add");
|
||||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
}
|
||||||
cmd.Parameters.AddWithValue("?name", assetName);
|
|
||||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
string assetDescription = asset.Description;
|
||||||
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
if (asset.Description.Length > 64)
|
||||||
cmd.Parameters.AddWithValue("?local", asset.Local);
|
{
|
||||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
assetDescription = asset.Description.Substring(0, 64);
|
||||||
cmd.Parameters.AddWithValue("?create_time", now);
|
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
|
||||||
cmd.Parameters.AddWithValue("?access_time", now);
|
}
|
||||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
|
||||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
try
|
||||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
{
|
||||||
cmd.ExecuteNonQuery();
|
using (cmd)
|
||||||
cmd.Dispose();
|
{
|
||||||
|
// create unix epoch time
|
||||||
|
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||||
|
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||||
|
cmd.Parameters.AddWithValue("?name", assetName);
|
||||||
|
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||||
|
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
||||||
|
cmd.Parameters.AddWithValue("?local", asset.Local);
|
||||||
|
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||||
|
cmd.Parameters.AddWithValue("?create_time", now);
|
||||||
|
cmd.Parameters.AddWithValue("?access_time", now);
|
||||||
|
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||||
|
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||||
|
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
||||||
|
asset.FullID, asset.Name, e.Message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
|
||||||
asset.FullID, asset.Name, e.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,33 +220,31 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
MySqlCommand cmd =
|
|
||||||
new MySqlCommand("update assets set access_time=?access_time where id=?id",
|
|
||||||
dbcon);
|
|
||||||
|
|
||||||
// need to ensure we dispose
|
using (MySqlCommand cmd
|
||||||
try
|
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
|
||||||
{
|
{
|
||||||
using (cmd)
|
try
|
||||||
{
|
{
|
||||||
// create unix epoch time
|
using (cmd)
|
||||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
{
|
||||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
// create unix epoch time
|
||||||
cmd.Parameters.AddWithValue("?access_time", now);
|
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||||
cmd.Dispose();
|
cmd.Parameters.AddWithValue("?access_time", now);
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[ASSETS DB]: " +
|
||||||
|
"MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString()
|
||||||
|
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"[ASSETS DB]: " +
|
|
||||||
"MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString()
|
|
||||||
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -310,35 +307,41 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count", dbcon);
|
|
||||||
cmd.Parameters.AddWithValue("?start", start);
|
|
||||||
cmd.Parameters.AddWithValue("?count", count);
|
|
||||||
|
|
||||||
try
|
using (MySqlCommand cmd
|
||||||
|
= new MySqlCommand(
|
||||||
|
"SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count",
|
||||||
|
dbcon))
|
||||||
{
|
{
|
||||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
cmd.Parameters.AddWithValue("?start", start);
|
||||||
|
cmd.Parameters.AddWithValue("?count", count);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
while (dbReader.Read())
|
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
AssetMetadata metadata = new AssetMetadata();
|
while (dbReader.Read())
|
||||||
metadata.Name = (string)dbReader["name"];
|
{
|
||||||
metadata.Description = (string)dbReader["description"];
|
AssetMetadata metadata = new AssetMetadata();
|
||||||
metadata.Type = (sbyte)dbReader["assetType"];
|
metadata.Name = (string)dbReader["name"];
|
||||||
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
metadata.Description = (string)dbReader["description"];
|
||||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
metadata.Type = (sbyte)dbReader["assetType"];
|
||||||
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
||||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||||
|
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
||||||
// Current SHA1s are not stored/computed.
|
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||||
metadata.SHA1 = new byte[] { };
|
|
||||||
|
// Current SHA1s are not stored/computed.
|
||||||
retList.Add(metadata);
|
metadata.SHA1 = new byte[] { };
|
||||||
|
|
||||||
|
retList.Add(metadata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
m_log.Error("[ASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||||
m_log.Error("[ASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,11 +356,12 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon);
|
|
||||||
cmd.Parameters.AddWithValue("?id", id);
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
|
|
||||||
cmd.Dispose();
|
using (MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue("?id", id);
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,4 +370,4 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -70,30 +70,34 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID", dbcon);
|
|
||||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
|
||||||
|
|
||||||
IDataReader result = cmd.ExecuteReader();
|
using (MySqlCommand cmd
|
||||||
|
= new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID", dbcon))
|
||||||
if (result.Read())
|
|
||||||
{
|
{
|
||||||
ret.PrincipalID = principalID;
|
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||||
|
|
||||||
CheckColumnNames(result);
|
IDataReader result = cmd.ExecuteReader();
|
||||||
|
|
||||||
foreach (string s in m_ColumnNames)
|
if (result.Read())
|
||||||
{
|
{
|
||||||
if (s == "UUID")
|
ret.PrincipalID = principalID;
|
||||||
continue;
|
|
||||||
|
CheckColumnNames(result);
|
||||||
ret.Data[s] = result[s].ToString();
|
|
||||||
|
foreach (string s in m_ColumnNames)
|
||||||
|
{
|
||||||
|
if (s == "UUID")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ret.Data[s] = result[s].ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,57 +123,53 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
|
|
||||||
string update = "update `"+m_Realm+"` set ";
|
|
||||||
bool first = true;
|
|
||||||
foreach (string field in fields)
|
|
||||||
{
|
{
|
||||||
if (!first)
|
string update = "update `"+m_Realm+"` set ";
|
||||||
update += ", ";
|
bool first = true;
|
||||||
update += "`" + field + "` = ?"+field;
|
foreach (string field in fields)
|
||||||
|
{
|
||||||
first = false;
|
if (!first)
|
||||||
|
update += ", ";
|
||||||
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
|
update += "`" + field + "` = ?"+field;
|
||||||
}
|
|
||||||
|
first = false;
|
||||||
update += " where UUID = ?principalID";
|
|
||||||
|
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
|
||||||
cmd.CommandText = update;
|
}
|
||||||
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
|
|
||||||
|
update += " where UUID = ?principalID";
|
||||||
if (ExecuteNonQuery(cmd) < 1)
|
|
||||||
{
|
cmd.CommandText = update;
|
||||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
|
||||||
String.Join("`, `", fields) +
|
|
||||||
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
|
|
||||||
|
|
||||||
cmd.CommandText = insert;
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) < 1)
|
if (ExecuteNonQuery(cmd) < 1)
|
||||||
{
|
{
|
||||||
cmd.Dispose();
|
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
||||||
return false;
|
String.Join("`, `", fields) +
|
||||||
|
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
|
||||||
|
|
||||||
|
cmd.CommandText = insert;
|
||||||
|
|
||||||
|
if (ExecuteNonQuery(cmd) < 1)
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand("update `" + m_Realm +
|
using (MySqlCommand cmd
|
||||||
"` set `" + item + "` = ?" + item + " where UUID = ?UUID");
|
= 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", principalID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
|
|
||||||
|
if (ExecuteNonQuery(cmd) > 0)
|
||||||
if (ExecuteNonQuery(cmd) > 0)
|
return true;
|
||||||
return true;
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -179,18 +179,18 @@ namespace OpenSim.Data.MySQL
|
||||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||||
DoExpire();
|
DoExpire();
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand("insert into tokens (UUID, token, validity) values (?principalID, ?token, date_add(now(), interval ?lifetime minute))");
|
using (MySqlCommand cmd
|
||||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
= new MySqlCommand(
|
||||||
cmd.Parameters.AddWithValue("?token", token);
|
"insert into tokens (UUID, token, validity) values (?principalID, ?token, date_add(now(), interval ?lifetime minute))"))
|
||||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) > 0)
|
|
||||||
{
|
{
|
||||||
cmd.Dispose();
|
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||||
return true;
|
cmd.Parameters.AddWithValue("?token", token);
|
||||||
|
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||||
|
|
||||||
|
if (ExecuteNonQuery(cmd) > 0)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,30 +199,29 @@ namespace OpenSim.Data.MySQL
|
||||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||||
DoExpire();
|
DoExpire();
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand("update tokens set validity = date_add(now(), interval ?lifetime minute) where UUID = ?principalID and token = ?token and validity > now()");
|
using (MySqlCommand cmd
|
||||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
= new MySqlCommand(
|
||||||
cmd.Parameters.AddWithValue("?token", token);
|
"update tokens set validity = date_add(now(), interval ?lifetime minute) where UUID = ?principalID and token = ?token and validity > now()"))
|
||||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) > 0)
|
|
||||||
{
|
{
|
||||||
cmd.Dispose();
|
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||||
return true;
|
cmd.Parameters.AddWithValue("?token", token);
|
||||||
}
|
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||||
|
|
||||||
cmd.Dispose();
|
if (ExecuteNonQuery(cmd) > 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoExpire()
|
private void DoExpire()
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand("delete from tokens where validity < now()");
|
using (MySqlCommand cmd = new MySqlCommand("delete from tokens where validity < now()"))
|
||||||
ExecuteNonQuery(cmd);
|
{
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
cmd.Dispose();
|
}
|
||||||
|
|
||||||
m_LastExpire = System.Environment.TickCount;
|
m_LastExpire = System.Environment.TickCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,14 +52,15 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public bool Delete(UUID principalID, string name)
|
public bool Delete(UUID principalID, string name)
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
|
{
|
||||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
|
||||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?Name", name);
|
cmd.Parameters.AddWithValue("?Name", name);
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) > 0)
|
if (ExecuteNonQuery(cmd) > 0)
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,34 +49,38 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public bool Delete(string principalID, string friend)
|
public bool Delete(string principalID, string friend)
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm);
|
||||||
|
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||||
|
cmd.Parameters.AddWithValue("?Friend", friend);
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm);
|
ExecuteNonQuery(cmd);
|
||||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
}
|
||||||
cmd.Parameters.AddWithValue("?Friend", friend);
|
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FriendsData[] GetFriends(UUID principalID)
|
public FriendsData[] GetFriends(UUID principalID)
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm);
|
||||||
|
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm);
|
return DoQuery(cmd);
|
||||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
}
|
||||||
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FriendsData[] GetFriends(string principalID)
|
public FriendsData[] GetFriends(string principalID)
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm);
|
||||||
|
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%');
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm);
|
return DoQuery(cmd);
|
||||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%');
|
}
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -467,43 +467,43 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
MySqlCommand result = new MySqlCommand(sql, dbcon);
|
using (MySqlCommand result = new MySqlCommand(sql, dbcon))
|
||||||
result.Parameters.AddWithValue("?inventoryID", item.ID.ToString());
|
|
||||||
result.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
|
|
||||||
result.Parameters.AddWithValue("?assetType", item.AssetType.ToString());
|
|
||||||
result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString());
|
|
||||||
result.Parameters.AddWithValue("?avatarID", item.Owner.ToString());
|
|
||||||
result.Parameters.AddWithValue("?inventoryName", itemName);
|
|
||||||
result.Parameters.AddWithValue("?inventoryDescription", itemDesc);
|
|
||||||
result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString());
|
|
||||||
result.Parameters.AddWithValue("?inventoryCurrentPermissions",
|
|
||||||
item.CurrentPermissions.ToString());
|
|
||||||
result.Parameters.AddWithValue("?invType", item.InvType);
|
|
||||||
result.Parameters.AddWithValue("?creatorID", item.CreatorId);
|
|
||||||
result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
|
|
||||||
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
|
|
||||||
result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
|
|
||||||
result.Parameters.AddWithValue("?salePrice", item.SalePrice);
|
|
||||||
result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
|
|
||||||
result.Parameters.AddWithValue("?creationDate", item.CreationDate);
|
|
||||||
result.Parameters.AddWithValue("?groupID", item.GroupID);
|
|
||||||
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
|
|
||||||
result.Parameters.AddWithValue("?flags", item.Flags);
|
|
||||||
|
|
||||||
lock (m_dbLock)
|
|
||||||
{
|
{
|
||||||
result.ExecuteNonQuery();
|
result.Parameters.AddWithValue("?inventoryID", item.ID.ToString());
|
||||||
|
result.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
|
||||||
|
result.Parameters.AddWithValue("?assetType", item.AssetType.ToString());
|
||||||
|
result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString());
|
||||||
|
result.Parameters.AddWithValue("?avatarID", item.Owner.ToString());
|
||||||
|
result.Parameters.AddWithValue("?inventoryName", itemName);
|
||||||
|
result.Parameters.AddWithValue("?inventoryDescription", itemDesc);
|
||||||
|
result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString());
|
||||||
|
result.Parameters.AddWithValue("?inventoryCurrentPermissions",
|
||||||
|
item.CurrentPermissions.ToString());
|
||||||
|
result.Parameters.AddWithValue("?invType", item.InvType);
|
||||||
|
result.Parameters.AddWithValue("?creatorID", item.CreatorId);
|
||||||
|
result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
|
||||||
|
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
|
||||||
|
result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
|
||||||
|
result.Parameters.AddWithValue("?salePrice", item.SalePrice);
|
||||||
|
result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
|
||||||
|
result.Parameters.AddWithValue("?creationDate", item.CreationDate);
|
||||||
|
result.Parameters.AddWithValue("?groupID", item.GroupID);
|
||||||
|
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
|
||||||
|
result.Parameters.AddWithValue("?flags", item.Flags);
|
||||||
|
|
||||||
|
lock (m_dbLock)
|
||||||
|
result.ExecuteNonQuery();
|
||||||
|
|
||||||
|
result.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Dispose();
|
using (MySqlCommand result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon))
|
||||||
|
|
||||||
result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon);
|
|
||||||
result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
|
|
||||||
lock (m_dbLock)
|
|
||||||
{
|
{
|
||||||
result.ExecuteNonQuery();
|
result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
|
||||||
|
|
||||||
|
lock (m_dbLock)
|
||||||
|
result.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
result.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
|
@ -533,12 +533,12 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon);
|
using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon))
|
||||||
cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
|
|
||||||
|
|
||||||
lock (m_dbLock)
|
|
||||||
{
|
{
|
||||||
cmd.ExecuteNonQuery();
|
cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
|
||||||
|
|
||||||
|
lock (m_dbLock)
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -579,24 +579,26 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
|
||||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
{
|
||||||
cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString());
|
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString());
|
||||||
cmd.Parameters.AddWithValue("?folderName", folderName);
|
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?type", folder.Type);
|
cmd.Parameters.AddWithValue("?folderName", folderName);
|
||||||
cmd.Parameters.AddWithValue("?version", folder.Version);
|
cmd.Parameters.AddWithValue("?type", folder.Type);
|
||||||
|
cmd.Parameters.AddWithValue("?version", folder.Version);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
|
||||||
lock (m_dbLock)
|
|
||||||
{
|
{
|
||||||
cmd.ExecuteNonQuery();
|
lock (m_dbLock)
|
||||||
|
{
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error(e.ToString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,20 +626,22 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
|
||||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
|
||||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
lock (m_dbLock)
|
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||||
|
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
cmd.ExecuteNonQuery();
|
lock (m_dbLock)
|
||||||
|
{
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error(e.ToString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,13 +63,14 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public void LogoutRegionAgents(UUID regionID)
|
public void LogoutRegionAgents(UUID regionID)
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
|
{
|
||||||
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||||
|
@ -81,17 +82,18 @@ namespace OpenSim.Data.MySQL
|
||||||
if (regionID == UUID.Zero)
|
if (regionID == UUID.Zero)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
|
{
|
||||||
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm);
|
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm);
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
|
cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
|
||||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) == 0)
|
if (ExecuteNonQuery(cmd) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -329,11 +329,12 @@ namespace OpenSim.Data.MySQL
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
command += " and ScopeID = ?scopeID";
|
command += " and ScopeID = ?scopeID";
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand(command);
|
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||||
|
{
|
||||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||||
|
|
||||||
return RunCommand(cmd);
|
return RunCommand(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -129,114 +129,114 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
MySqlCommand cmd = dbcon.CreateCommand();
|
|
||||||
|
|
||||||
foreach (SceneObjectPart prim in obj.Parts)
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.Parameters.Clear();
|
foreach (SceneObjectPart prim in obj.Parts)
|
||||||
|
{
|
||||||
cmd.CommandText = "replace into prims (" +
|
cmd.Parameters.Clear();
|
||||||
"UUID, CreationDate, " +
|
|
||||||
"Name, Text, Description, " +
|
cmd.CommandText = "replace into prims (" +
|
||||||
"SitName, TouchName, ObjectFlags, " +
|
"UUID, CreationDate, " +
|
||||||
"OwnerMask, NextOwnerMask, GroupMask, " +
|
"Name, Text, Description, " +
|
||||||
"EveryoneMask, BaseMask, PositionX, " +
|
"SitName, TouchName, ObjectFlags, " +
|
||||||
"PositionY, PositionZ, GroupPositionX, " +
|
"OwnerMask, NextOwnerMask, GroupMask, " +
|
||||||
"GroupPositionY, GroupPositionZ, VelocityX, " +
|
"EveryoneMask, BaseMask, PositionX, " +
|
||||||
"VelocityY, VelocityZ, AngularVelocityX, " +
|
"PositionY, PositionZ, GroupPositionX, " +
|
||||||
"AngularVelocityY, AngularVelocityZ, " +
|
"GroupPositionY, GroupPositionZ, VelocityX, " +
|
||||||
"AccelerationX, AccelerationY, " +
|
"VelocityY, VelocityZ, AngularVelocityX, " +
|
||||||
"AccelerationZ, RotationX, " +
|
"AngularVelocityY, AngularVelocityZ, " +
|
||||||
"RotationY, RotationZ, " +
|
"AccelerationX, AccelerationY, " +
|
||||||
"RotationW, SitTargetOffsetX, " +
|
"AccelerationZ, RotationX, " +
|
||||||
"SitTargetOffsetY, SitTargetOffsetZ, " +
|
"RotationY, RotationZ, " +
|
||||||
"SitTargetOrientW, SitTargetOrientX, " +
|
"RotationW, SitTargetOffsetX, " +
|
||||||
"SitTargetOrientY, SitTargetOrientZ, " +
|
"SitTargetOffsetY, SitTargetOffsetZ, " +
|
||||||
"RegionUUID, CreatorID, " +
|
"SitTargetOrientW, SitTargetOrientX, " +
|
||||||
"OwnerID, GroupID, " +
|
"SitTargetOrientY, SitTargetOrientZ, " +
|
||||||
"LastOwnerID, SceneGroupID, " +
|
"RegionUUID, CreatorID, " +
|
||||||
"PayPrice, PayButton1, " +
|
"OwnerID, GroupID, " +
|
||||||
"PayButton2, PayButton3, " +
|
"LastOwnerID, SceneGroupID, " +
|
||||||
"PayButton4, LoopedSound, " +
|
"PayPrice, PayButton1, " +
|
||||||
"LoopedSoundGain, TextureAnimation, " +
|
"PayButton2, PayButton3, " +
|
||||||
"OmegaX, OmegaY, OmegaZ, " +
|
"PayButton4, LoopedSound, " +
|
||||||
"CameraEyeOffsetX, CameraEyeOffsetY, " +
|
"LoopedSoundGain, TextureAnimation, " +
|
||||||
"CameraEyeOffsetZ, CameraAtOffsetX, " +
|
"OmegaX, OmegaY, OmegaZ, " +
|
||||||
"CameraAtOffsetY, CameraAtOffsetZ, " +
|
"CameraEyeOffsetX, CameraEyeOffsetY, " +
|
||||||
"ForceMouselook, ScriptAccessPin, " +
|
"CameraEyeOffsetZ, CameraAtOffsetX, " +
|
||||||
"AllowedDrop, DieAtEdge, " +
|
"CameraAtOffsetY, CameraAtOffsetZ, " +
|
||||||
"SalePrice, SaleType, " +
|
"ForceMouselook, ScriptAccessPin, " +
|
||||||
"ColorR, ColorG, ColorB, ColorA, " +
|
"AllowedDrop, DieAtEdge, " +
|
||||||
"ParticleSystem, ClickAction, Material, " +
|
"SalePrice, SaleType, " +
|
||||||
"CollisionSound, CollisionSoundVolume, " +
|
"ColorR, ColorG, ColorB, ColorA, " +
|
||||||
"PassTouches, " +
|
"ParticleSystem, ClickAction, Material, " +
|
||||||
"LinkNumber, MediaURL) values (" + "?UUID, " +
|
"CollisionSound, CollisionSoundVolume, " +
|
||||||
"?CreationDate, ?Name, ?Text, " +
|
"PassTouches, " +
|
||||||
"?Description, ?SitName, ?TouchName, " +
|
"LinkNumber, MediaURL) values (" + "?UUID, " +
|
||||||
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
|
"?CreationDate, ?Name, ?Text, " +
|
||||||
"?GroupMask, ?EveryoneMask, ?BaseMask, " +
|
"?Description, ?SitName, ?TouchName, " +
|
||||||
"?PositionX, ?PositionY, ?PositionZ, " +
|
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
|
||||||
"?GroupPositionX, ?GroupPositionY, " +
|
"?GroupMask, ?EveryoneMask, ?BaseMask, " +
|
||||||
"?GroupPositionZ, ?VelocityX, " +
|
"?PositionX, ?PositionY, ?PositionZ, " +
|
||||||
"?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
|
"?GroupPositionX, ?GroupPositionY, " +
|
||||||
"?AngularVelocityY, ?AngularVelocityZ, " +
|
"?GroupPositionZ, ?VelocityX, " +
|
||||||
"?AccelerationX, ?AccelerationY, " +
|
"?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
|
||||||
"?AccelerationZ, ?RotationX, " +
|
"?AngularVelocityY, ?AngularVelocityZ, " +
|
||||||
"?RotationY, ?RotationZ, " +
|
"?AccelerationX, ?AccelerationY, " +
|
||||||
"?RotationW, ?SitTargetOffsetX, " +
|
"?AccelerationZ, ?RotationX, " +
|
||||||
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
|
"?RotationY, ?RotationZ, " +
|
||||||
"?SitTargetOrientW, ?SitTargetOrientX, " +
|
"?RotationW, ?SitTargetOffsetX, " +
|
||||||
"?SitTargetOrientY, ?SitTargetOrientZ, " +
|
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
|
||||||
"?RegionUUID, ?CreatorID, ?OwnerID, " +
|
"?SitTargetOrientW, ?SitTargetOrientX, " +
|
||||||
"?GroupID, ?LastOwnerID, ?SceneGroupID, " +
|
"?SitTargetOrientY, ?SitTargetOrientZ, " +
|
||||||
"?PayPrice, ?PayButton1, ?PayButton2, " +
|
"?RegionUUID, ?CreatorID, ?OwnerID, " +
|
||||||
"?PayButton3, ?PayButton4, ?LoopedSound, " +
|
"?GroupID, ?LastOwnerID, ?SceneGroupID, " +
|
||||||
"?LoopedSoundGain, ?TextureAnimation, " +
|
"?PayPrice, ?PayButton1, ?PayButton2, " +
|
||||||
"?OmegaX, ?OmegaY, ?OmegaZ, " +
|
"?PayButton3, ?PayButton4, ?LoopedSound, " +
|
||||||
"?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
|
"?LoopedSoundGain, ?TextureAnimation, " +
|
||||||
"?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
|
"?OmegaX, ?OmegaY, ?OmegaZ, " +
|
||||||
"?CameraAtOffsetY, ?CameraAtOffsetZ, " +
|
"?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
|
||||||
"?ForceMouselook, ?ScriptAccessPin, " +
|
"?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
|
||||||
"?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
|
"?CameraAtOffsetY, ?CameraAtOffsetZ, " +
|
||||||
"?SaleType, ?ColorR, ?ColorG, " +
|
"?ForceMouselook, ?ScriptAccessPin, " +
|
||||||
"?ColorB, ?ColorA, ?ParticleSystem, " +
|
"?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
|
||||||
"?ClickAction, ?Material, ?CollisionSound, " +
|
"?SaleType, ?ColorR, ?ColorG, " +
|
||||||
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
|
"?ColorB, ?ColorA, ?ParticleSystem, " +
|
||||||
|
"?ClickAction, ?Material, ?CollisionSound, " +
|
||||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||||
|
|
||||||
cmd.Parameters.Clear();
|
ExecuteNonQuery(cmd);
|
||||||
|
|
||||||
cmd.CommandText = "replace into primshapes (" +
|
cmd.Parameters.Clear();
|
||||||
"UUID, Shape, ScaleX, ScaleY, " +
|
|
||||||
"ScaleZ, PCode, PathBegin, PathEnd, " +
|
cmd.CommandText = "replace into primshapes (" +
|
||||||
"PathScaleX, PathScaleY, PathShearX, " +
|
"UUID, Shape, ScaleX, ScaleY, " +
|
||||||
"PathShearY, PathSkew, PathCurve, " +
|
"ScaleZ, PCode, PathBegin, PathEnd, " +
|
||||||
"PathRadiusOffset, PathRevolutions, " +
|
"PathScaleX, PathScaleY, PathShearX, " +
|
||||||
"PathTaperX, PathTaperY, PathTwist, " +
|
"PathShearY, PathSkew, PathCurve, " +
|
||||||
"PathTwistBegin, ProfileBegin, ProfileEnd, " +
|
"PathRadiusOffset, PathRevolutions, " +
|
||||||
"ProfileCurve, ProfileHollow, Texture, " +
|
"PathTaperX, PathTaperY, PathTwist, " +
|
||||||
"ExtraParams, State, Media) values (?UUID, " +
|
"PathTwistBegin, ProfileBegin, ProfileEnd, " +
|
||||||
"?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
|
"ProfileCurve, ProfileHollow, Texture, " +
|
||||||
"?PCode, ?PathBegin, ?PathEnd, " +
|
"ExtraParams, State, Media) values (?UUID, " +
|
||||||
"?PathScaleX, ?PathScaleY, " +
|
"?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
|
||||||
"?PathShearX, ?PathShearY, " +
|
"?PCode, ?PathBegin, ?PathEnd, " +
|
||||||
"?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
|
"?PathScaleX, ?PathScaleY, " +
|
||||||
"?PathRevolutions, ?PathTaperX, " +
|
"?PathShearX, ?PathShearY, " +
|
||||||
"?PathTaperY, ?PathTwist, " +
|
"?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
|
||||||
"?PathTwistBegin, ?ProfileBegin, " +
|
"?PathRevolutions, ?PathTaperX, " +
|
||||||
"?ProfileEnd, ?ProfileCurve, " +
|
"?PathTaperY, ?PathTwist, " +
|
||||||
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
"?PathTwistBegin, ?ProfileBegin, " +
|
||||||
"?State, ?Media)";
|
"?ProfileEnd, ?ProfileCurve, " +
|
||||||
|
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
||||||
FillShapeCommand(cmd, prim);
|
"?State, ?Media)";
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
FillShapeCommand(cmd, prim);
|
||||||
|
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1804,37 +1804,36 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
|
||||||
MySqlCommand cmd = dbcon.CreateCommand();
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
|
|
||||||
if (items.Count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
cmd.CommandText = "insert into primitems (" +
|
|
||||||
"invType, assetType, name, " +
|
|
||||||
"description, creationDate, nextPermissions, " +
|
|
||||||
"currentPermissions, basePermissions, " +
|
|
||||||
"everyonePermissions, groupPermissions, " +
|
|
||||||
"flags, itemID, primID, assetID, " +
|
|
||||||
"parentFolderID, creatorID, ownerID, " +
|
|
||||||
"groupID, lastOwnerID) values (?invType, " +
|
|
||||||
"?assetType, ?name, ?description, " +
|
|
||||||
"?creationDate, ?nextPermissions, " +
|
|
||||||
"?currentPermissions, ?basePermissions, " +
|
|
||||||
"?everyonePermissions, ?groupPermissions, " +
|
|
||||||
"?flags, ?itemID, ?primID, ?assetID, " +
|
|
||||||
"?parentFolderID, ?creatorID, ?ownerID, " +
|
|
||||||
"?groupID, ?lastOwnerID)";
|
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in items)
|
|
||||||
{
|
{
|
||||||
cmd.Parameters.Clear();
|
if (items.Count == 0)
|
||||||
|
return;
|
||||||
FillItemCommand(cmd, item);
|
|
||||||
|
cmd.CommandText = "insert into primitems (" +
|
||||||
ExecuteNonQuery(cmd);
|
"invType, assetType, name, " +
|
||||||
|
"description, creationDate, nextPermissions, " +
|
||||||
|
"currentPermissions, basePermissions, " +
|
||||||
|
"everyonePermissions, groupPermissions, " +
|
||||||
|
"flags, itemID, primID, assetID, " +
|
||||||
|
"parentFolderID, creatorID, ownerID, " +
|
||||||
|
"groupID, lastOwnerID) values (?invType, " +
|
||||||
|
"?assetType, ?name, ?description, " +
|
||||||
|
"?creationDate, ?nextPermissions, " +
|
||||||
|
"?currentPermissions, ?basePermissions, " +
|
||||||
|
"?everyonePermissions, ?groupPermissions, " +
|
||||||
|
"?flags, ?itemID, ?primID, ?assetID, " +
|
||||||
|
"?parentFolderID, ?creatorID, ?ownerID, " +
|
||||||
|
"?groupID, ?lastOwnerID)";
|
||||||
|
|
||||||
|
foreach (TaskInventoryItem item in items)
|
||||||
|
{
|
||||||
|
cmd.Parameters.Clear();
|
||||||
|
|
||||||
|
FillItemCommand(cmd, item);
|
||||||
|
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,23 +62,24 @@ namespace OpenSim.Data.MySQL
|
||||||
if (words.Length > 2)
|
if (words.Length > 2)
|
||||||
return new UserAccountData[0];
|
return new UserAccountData[0];
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
|
|
||||||
if (words.Length == 1)
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
|
if (words.Length == 1)
|
||||||
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
|
{
|
||||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
|
||||||
}
|
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
|
||||||
else
|
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||||
{
|
}
|
||||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
|
else
|
||||||
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
|
{
|
||||||
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
|
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
|
||||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
|
||||||
}
|
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
|
||||||
|
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue