Massive tab and trailing space cleanup

This commit is contained in:
Melanie Thielker
2017-01-05 19:07:37 +00:00
parent e88e2945e9
commit b16abc8166
959 changed files with 23646 additions and 23646 deletions

View File

@@ -329,8 +329,8 @@ namespace OpenSim.Data.MySQL
{
m_log.Error(
string.Format(
"[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ",
start, count),
"[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ",
start, count),
e);
}
}

View File

@@ -77,21 +77,21 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
IDataReader result = cmd.ExecuteReader();
if (result.Read())
{
ret.PrincipalID = principalID;
CheckColumnNames(result);
foreach (string s in m_ColumnNames)
{
if (s == "UUID")
continue;
ret.Data[s] = result[s].ToString();
}
return ret;
}
else
@@ -132,25 +132,25 @@ namespace OpenSim.Data.MySQL
if (!first)
update += ", ";
update += "`" + field + "` = ?"+field;
first = false;
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
}
update += " where UUID = ?principalID";
cmd.CommandText = update;
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
if (ExecuteNonQuery(cmd) < 1)
{
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
String.Join("`, `", fields) +
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
cmd.CommandText = insert;
if (ExecuteNonQuery(cmd) < 1)
return false;
}
@@ -166,7 +166,7 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?"+item, value);
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
}
@@ -186,7 +186,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
cmd.Parameters.AddWithValue("?token", token);
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
}

View File

@@ -57,7 +57,7 @@ namespace OpenSim.Data.MySQL
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?Name", name);
if (ExecuteNonQuery(cmd) > 0)
return true;
}

View File

@@ -403,19 +403,19 @@ namespace OpenSim.Data.MySQL
return e;
}
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
List<int> allEstateIds = GetEstatesAll();
foreach (int estateId in allEstateIds)
allEstateSettings.Add(LoadEstateSettings(estateId));
return allEstateSettings;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
@@ -441,7 +441,7 @@ namespace OpenSim.Data.MySQL
dbcon.Close();
}
return result;
return result;
}
public List<int> GetEstates(string search)

View File

@@ -54,7 +54,7 @@ namespace OpenSim.Data.MySQL
{
get { return GetType().Assembly; }
}
public MySQLFSAssetData()
{
}

View File

@@ -40,7 +40,7 @@ namespace OpenSim.Data.MySQL
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<string, FieldInfo> m_Fields =
new Dictionary<string, FieldInfo>();
@@ -58,7 +58,7 @@ namespace OpenSim.Data.MySQL
{
m_Realm = realm;
m_connectionString = connectionString;
if (storeName != String.Empty)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
@@ -130,7 +130,7 @@ namespace OpenSim.Data.MySQL
m_Realm, where);
cmd.CommandText = query;
return DoQuery(cmd);
}
}
@@ -185,7 +185,7 @@ namespace OpenSim.Data.MySQL
m_Fields[name].SetValue(row, reader[name]);
}
}
if (m_DataField != null)
{
Dictionary<string, string> data =
@@ -215,9 +215,9 @@ namespace OpenSim.Data.MySQL
{
string query = String.Format("select * from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
return DoQuery(cmd);
}
}
@@ -236,16 +236,16 @@ namespace OpenSim.Data.MySQL
{
names.Add(fi.Name);
values.Add("?" + fi.Name);
// Temporarily return more information about what field is unexpectedly null for
// http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
// http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
// InventoryTransferModule or we may be required to substitute a DBNull here.
if (fi.GetValue(row) == null)
throw new NullReferenceException(
string.Format(
"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
fi.Name, row));
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
}

View File

@@ -133,10 +133,10 @@ namespace OpenSim.Data.MySQL
public bool DeleteMember(UUID groupID, string pricipalID)
{
return m_Membership.Delete(new string[] { "GroupID", "PrincipalID" },
return m_Membership.Delete(new string[] { "GroupID", "PrincipalID" },
new string[] { groupID.ToString(), pricipalID });
}
public int MemberCount(UUID groupID)
{
return (int)m_Membership.GetCount("GroupID", groupID.ToString());
@@ -168,7 +168,7 @@ namespace OpenSim.Data.MySQL
public bool DeleteRole(UUID groupID, UUID roleID)
{
return m_Roles.Delete(new string[] { "GroupID", "RoleID" },
return m_Roles.Delete(new string[] { "GroupID", "RoleID" },
new string[] { groupID.ToString(), roleID.ToString() });
}
@@ -360,7 +360,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsGroupsHandler(string connectionString, string realm, string store)
public MySqlGroupsGroupsHandler(string connectionString, string realm, string store)
: base(connectionString, realm, store)
{
}
@@ -375,7 +375,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsMembershipHandler(string connectionString, string realm)
public MySqlGroupsMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@@ -390,7 +390,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsRolesHandler(string connectionString, string realm)
public MySqlGroupsRolesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@@ -405,7 +405,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsRoleMembershipHandler(string connectionString, string realm)
public MySqlGroupsRoleMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@@ -420,7 +420,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsInvitesHandler(string connectionString, string realm)
public MySqlGroupsInvitesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@@ -447,7 +447,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsNoticesHandler(string connectionString, string realm)
public MySqlGroupsNoticesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@@ -475,7 +475,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsPrincipalsHandler(string connectionString, string realm)
public MySqlGroupsPrincipalsHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}

View File

@@ -288,7 +288,7 @@ namespace OpenSim.Data.MySQL
// TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these.
// (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero)
item.CreatorId = reader["creatorID"].ToString();
// Be a bit safer in parsing these because the
// database doesn't enforce them to be not null, and
// the inventory still works if these are weird in the
@@ -453,7 +453,7 @@ namespace OpenSim.Data.MySQL
itemName = item.Name.Substring(0, 64);
m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length + " to " + itemName.Length + " characters on add item");
}
string itemDesc = item.Description;
if (item.Description.Length > 128)
{
@@ -490,10 +490,10 @@ namespace OpenSim.Data.MySQL
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();
}
@@ -630,7 +630,7 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
try
{
lock (m_dbLock)
@@ -860,7 +860,7 @@ namespace OpenSim.Data.MySQL
deleteOneFolder(folderID);
deleteItemsInFolder(folderID);
}
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
{
lock (m_dbLock)

View File

@@ -39,16 +39,16 @@ namespace OpenSim.Data.MySQL
{
/// <summary>This is a MySQL-customized migration processor. The only difference is in how
/// it executes SQL scripts (using MySqlScript instead of MyCommand)
///
///
/// </summary>
public class MySqlMigration : Migration
{
public MySqlMigration()
: base()
{
{
}
public MySqlMigration(DbConnection conn, Assembly assem, string subtype, string type) :
public MySqlMigration(DbConnection conn, Assembly assem, string subtype, string type) :
base(conn, assem, subtype, type)
{
}

View File

@@ -50,7 +50,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 WEEK", m_Realm);
ExecuteNonQuery(cmd);
}

View File

@@ -66,9 +66,9 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
ExecuteNonQuery(cmd);
}
}
@@ -85,10 +85,10 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand())
{
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("?RegionID", regionID.ToString());
if (ExecuteNonQuery(cmd) == 0)
return false;
}

View File

@@ -410,7 +410,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
return RunCommand(cmd);
}
}

View File

@@ -55,7 +55,7 @@ namespace OpenSim.Data.MySQL
/// <summary>
/// This lock was being used to serialize database operations when the connection was shared, but this has
/// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead.
/// FIXME: However, the locks remain in many places since they are effectively providing a level of
/// FIXME: However, the locks remain in many places since they are effectively providing a level of
/// transactionality. This should be replaced by more efficient database transactions which would not require
/// unrelated operations to block each other or unrelated operations on the same tables from blocking each
/// other.
@@ -268,7 +268,7 @@ namespace OpenSim.Data.MySQL
public virtual void RemoveObject(UUID obj, UUID regionUUID)
{
// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
List<UUID> uuids = new List<UUID>();
// Formerly, this used to check the region UUID.
@@ -509,7 +509,7 @@ namespace OpenSim.Data.MySQL
#region Prim Inventory Loading
// Instead of attempting to LoadItems on every prim,
// most of which probably have no items... get a
// most of which probably have no items... get a
// list from DB of all prims which have items and
// LoadItems only on those
List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>();
@@ -807,7 +807,7 @@ namespace OpenSim.Data.MySQL
"UserLocationX, UserLocationY, UserLocationZ, " +
"UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " +
"SeeAVs, AnyAVSounds, GroupAVSounds) values (" +
"?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " +
@@ -1081,7 +1081,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
ExecuteNonQuery(cmd);
}
}
@@ -1273,7 +1273,7 @@ namespace OpenSim.Data.MySQL
{
SceneObjectPart prim = new SceneObjectPart();
// depending on the MySQL connector version, CHAR(36) may be already converted to Guid!
// depending on the MySQL connector version, CHAR(36) may be already converted to Guid!
prim.UUID = DBGuid.FromDB(row["UUID"]);
prim.CreatorIdentification = (string)row["CreatorID"];
prim.OwnerID = DBGuid.FromDB(row["OwnerID"]);
@@ -1401,11 +1401,11 @@ namespace OpenSim.Data.MySQL
prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]);
prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0);
prim.LinkNum = (int)row["LinkNumber"];
if (!(row["MediaURL"] is System.DBNull))
prim.MediaUrl = (string)row["MediaURL"];
@@ -1421,7 +1421,7 @@ namespace OpenSim.Data.MySQL
if (!(row["DynAttrs"] is System.DBNull))
prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]);
else
prim.DynAttrs = new DAMap();
prim.DynAttrs = new DAMap();
if (!(row["KeyframeMotion"] is DBNull))
{
@@ -1543,10 +1543,10 @@ namespace OpenSim.Data.MySQL
newSettings.Covenant = DBGuid.FromDB(row["covenant"]);
newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
if (row["loaded_creation_id"] is DBNull)
newSettings.LoadedCreationID = "";
else
else
newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]);
@@ -2023,7 +2023,7 @@ namespace OpenSim.Data.MySQL
s.State = (byte)(int)row["State"];
s.LastAttachPoint = (byte)(int)row["LastAttachPoint"];
if (!(row["Media"] is System.DBNull))
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
@@ -2103,13 +2103,13 @@ namespace OpenSim.Data.MySQL
"?flags, ?itemID, ?primID, ?assetID, " +
"?parentFolderID, ?creatorID, ?ownerID, " +
"?groupID, ?lastOwnerID)";
foreach (TaskInventoryItem item in items)
{
cmd.Parameters.Clear();
FillItemCommand(cmd, item);
ExecuteNonQuery(cmd);
}
}

View File

@@ -40,39 +40,39 @@ namespace OpenSim.Data.MySQL
public class UserProfilesData: IProfilesData
{
static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region Properites
string ConnectionString
{
get; set;
}
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
#endregion Properties
#region class Member Functions
public UserProfilesData(string connectionString)
{
ConnectionString = connectionString;
Init();
}
void Init()
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "UserProfiles");
m.Update();
}
}
#endregion Member Functions
#region Classifieds Queries
/// <summary>
/// Gets the classified records.
@@ -86,7 +86,7 @@ namespace OpenSim.Data.MySQL
public OSDArray GetClassifiedRecords(UUID creatorId)
{
OSDArray data = new OSDArray();
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{
string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id";
@@ -102,7 +102,7 @@ namespace OpenSim.Data.MySQL
{
OSDMap n = new OSDMap();
UUID Id = UUID.Zero;
string Name = null;
try
{
@@ -124,12 +124,12 @@ namespace OpenSim.Data.MySQL
}
return data;
}
public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result)
{
string query = string.Empty;
query += "INSERT INTO classifieds (";
query += "`classifieduuid`,";
query += "`creatoruuid`,";
@@ -173,21 +173,21 @@ namespace OpenSim.Data.MySQL
query += "classifiedflags=?Flags, ";
query += "priceforlisting=?ListingPrice, ";
query += "snapshotuuid=?SnapshotId";
if(string.IsNullOrEmpty(ad.ParcelName))
ad.ParcelName = "Unknown";
if(ad.ParcelId == null)
ad.ParcelId = UUID.Zero;
if(string.IsNullOrEmpty(ad.Description))
ad.Description = "No Description";
DateTime epoch = new DateTime(1970, 1, 1);
DateTime now = DateTime.Now;
TimeSpan epochnow = now - epoch;
TimeSpan duration;
DateTime expiration;
TimeSpan epochexp;
if(ad.Flags == 2)
{
duration = new TimeSpan(7,0,0,0);
@@ -202,7 +202,7 @@ namespace OpenSim.Data.MySQL
}
ad.CreationDate = (int)epochnow.TotalSeconds;
ad.ExpirationDate = (int)epochexp.TotalSeconds;
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -225,7 +225,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?ParcelName", ad.ParcelName.ToString());
cmd.Parameters.AddWithValue("?Flags", ad.Flags.ToString());
cmd.Parameters.AddWithValue("?ListingPrice", ad.Price.ToString ());
cmd.ExecuteNonQuery();
}
}
@@ -239,20 +239,20 @@ namespace OpenSim.Data.MySQL
}
return true;
}
public bool DeleteClassifiedRecord(UUID recordId)
{
string query = string.Empty;
query += "DELETE FROM classifieds WHERE ";
query += "classifieduuid = ?recordId";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{
cmd.Parameters.AddWithValue("?recordId", recordId.ToString());
@@ -268,14 +268,14 @@ namespace OpenSim.Data.MySQL
}
return true;
}
public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result)
{
string query = string.Empty;
query += "SELECT * FROM classifieds WHERE ";
query += "classifieduuid = ?AdId";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -284,7 +284,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{
cmd.Parameters.AddWithValue("?AdId", ad.ClassifiedId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader())
{
if(reader.Read ())
@@ -303,7 +303,7 @@ namespace OpenSim.Data.MySQL
ad.SimName = reader.GetString("simname");
ad.GlobalPos = reader.GetString("posglobal");
ad.ParcelName = reader.GetString("parcelname");
}
}
}
@@ -318,16 +318,16 @@ namespace OpenSim.Data.MySQL
return true;
}
#endregion Classifieds Queries
#region Picks Queries
public OSDArray GetAvatarPicks(UUID avatarId)
{
string query = string.Empty;
query += "SELECT `pickuuid`,`name` FROM userpicks WHERE ";
query += "creatoruuid = ?Id";
OSDArray data = new OSDArray();
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -336,7 +336,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader())
{
if(reader.HasRows)
@@ -344,7 +344,7 @@ namespace OpenSim.Data.MySQL
while (reader.Read())
{
OSDMap record = new OSDMap();
record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"]));
record.Add("name",OSD.FromString((string)reader["name"]));
data.Add(record);
@@ -361,16 +361,16 @@ namespace OpenSim.Data.MySQL
}
return data;
}
public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId)
{
string query = string.Empty;
UserProfilePick pick = new UserProfilePick();
query += "SELECT * FROM userpicks WHERE ";
query += "creatoruuid = ?CreatorId AND ";
query += "pickuuid = ?PickId";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -380,18 +380,18 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?CreatorId", avatarId.ToString());
cmd.Parameters.AddWithValue("?PickId", pickId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader())
{
if(reader.HasRows)
{
reader.Read();
string description = (string)reader["description"];
if (string.IsNullOrEmpty(description))
description = "No description given.";
UUID.TryParse((string)reader["pickuuid"], out pick.PickId);
UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId);
UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId);
@@ -419,11 +419,11 @@ namespace OpenSim.Data.MySQL
}
return pick;
}
public bool UpdatePicksRecord(UserProfilePick pick)
{
{
string query = string.Empty;
query += "INSERT INTO userpicks VALUES (";
query += "?PickId,";
query += "?CreatorId,";
@@ -449,7 +449,7 @@ namespace OpenSim.Data.MySQL
query += "pickuuid=?PickId,";
query += "posglobal=?GlobalPos,";
query += "gatekeeper=?Gatekeeper";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -471,7 +471,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper);
cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ());
cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString());
cmd.ExecuteNonQuery();
}
}
@@ -484,24 +484,24 @@ namespace OpenSim.Data.MySQL
}
return true;
}
public bool DeletePicksRecord(UUID pickId)
{
string query = string.Empty;
query += "DELETE FROM userpicks WHERE ";
query += "pickuuid = ?PickId";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{
cmd.Parameters.AddWithValue("?PickId", pickId.ToString());
cmd.ExecuteNonQuery();
}
}
@@ -515,12 +515,12 @@ namespace OpenSim.Data.MySQL
return true;
}
#endregion Picks Queries
#region Avatar Notes Queries
public bool GetAvatarNotes(ref UserProfileNotes notes)
{ // WIP
string query = string.Empty;
query += "SELECT `notes` FROM usernotes WHERE ";
query += "useruuid = ?Id AND ";
query += "targetuuid = ?TargetId";
@@ -534,7 +534,7 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?Id", notes.UserId.ToString());
cmd.Parameters.AddWithValue("?TargetId", notes.TargetId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if(reader.HasRows)
@@ -557,12 +557,12 @@ namespace OpenSim.Data.MySQL
}
return true;
}
public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result)
{
{
string query = string.Empty;
bool remove;
if(string.IsNullOrEmpty(note.Notes))
{
remove = true;
@@ -581,7 +581,7 @@ namespace OpenSim.Data.MySQL
query += "UPDATE ";
query += "notes=?Notes";
}
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -593,7 +593,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?Notes", note.Notes);
cmd.Parameters.AddWithValue("?TargetId", note.TargetId.ToString ());
cmd.Parameters.AddWithValue("?UserId", note.UserId.ToString());
cmd.ExecuteNonQuery();
}
}
@@ -605,18 +605,18 @@ namespace OpenSim.Data.MySQL
return false;
}
return true;
}
#endregion Avatar Notes Queries
#region Avatar Properties
public bool GetAvatarProperties(ref UserProfileProperties props, ref string result)
{
string query = string.Empty;
query += "SELECT * FROM userprofile WHERE ";
query += "useruuid = ?Id";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -625,7 +625,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{
cmd.Parameters.AddWithValue("?Id", props.UserId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if(reader.HasRows)
@@ -649,7 +649,7 @@ namespace OpenSim.Data.MySQL
{
m_log.DebugFormat("[PROFILES_DATA]" +
": No data for {0}", props.UserId);
props.WebUrl = string.Empty;
props.ImageId = UUID.Zero;
props.AboutText = string.Empty;
@@ -730,11 +730,11 @@ namespace OpenSim.Data.MySQL
}
return true;
}
public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
{
{
string query = string.Empty;
query += "UPDATE userprofile SET ";
query += "profileURL=?profileURL, ";
query += "profileImage=?image, ";
@@ -742,7 +742,7 @@ namespace OpenSim.Data.MySQL
query += "profileFirstImage=?firstlifeimage,";
query += "profileFirstText=?firstlifetext ";
query += "WHERE useruuid=?uuid";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -756,7 +756,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString());
cmd.Parameters.AddWithValue("?firstlifetext", props.FirstLifeText);
cmd.Parameters.AddWithValue("?uuid", props.UserId.ToString());
cmd.ExecuteNonQuery();
}
}
@@ -765,18 +765,18 @@ namespace OpenSim.Data.MySQL
{
m_log.ErrorFormat("[PROFILES_DATA]" +
": AgentPropertiesUpdate exception {0}", e.Message);
return false;
}
return true;
}
#endregion Avatar Properties
#region Avatar Interests
public bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
{
{
string query = string.Empty;
query += "UPDATE userprofile SET ";
query += "profileWantToMask=?WantMask, ";
query += "profileWantToText=?WantText,";
@@ -784,7 +784,7 @@ namespace OpenSim.Data.MySQL
query += "profileSkillsText=?SkillsText, ";
query += "profileLanguages=?Languages ";
query += "WHERE useruuid=?uuid";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -798,7 +798,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?SkillsText", up.SkillsText);
cmd.Parameters.AddWithValue("?Languages", up.Language);
cmd.Parameters.AddWithValue("?uuid", up.UserId.ToString());
cmd.ExecuteNonQuery();
}
}
@@ -820,8 +820,8 @@ namespace OpenSim.Data.MySQL
string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id";
// Get classified image assets
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -831,7 +831,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if(reader.HasRows)
@@ -850,7 +850,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if(reader.HasRows)
@@ -862,7 +862,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
dbcon.Open();
@@ -871,7 +871,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if(reader.HasRows)
@@ -893,7 +893,7 @@ namespace OpenSim.Data.MySQL
}
return data;
}
#region User Preferences
public bool GetUserPreferences(ref UserPreferences pref, ref string result)
{
@@ -987,16 +987,16 @@ namespace OpenSim.Data.MySQL
return true;
}
#endregion User Preferences
#region Integration
public bool GetUserAppData(ref UserAppData props, ref string result)
{
string query = string.Empty;
query += "SELECT * FROM `userdata` WHERE ";
query += "UserId = ?Id AND ";
query += "TagId = ?TagId";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -1006,7 +1006,7 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?Id", props.UserId.ToString());
cmd.Parameters.AddWithValue ("?TagId", props.TagId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if(reader.HasRows)
@@ -1022,7 +1022,7 @@ namespace OpenSim.Data.MySQL
query += "?TagId,";
query += "?DataKey,";
query += "?DataVal) ";
using (MySqlCommand put = new MySqlCommand(query, dbcon))
{
put.Parameters.AddWithValue("?UserId", props.UserId.ToString());
@@ -1048,16 +1048,16 @@ namespace OpenSim.Data.MySQL
}
public bool SetUserAppData(UserAppData props, ref string result)
{
{
string query = string.Empty;
query += "UPDATE userdata SET ";
query += "TagId = ?TagId, ";
query += "DataKey = ?DataKey, ";
query += "DataVal = ?DataVal WHERE ";
query += "UserId = ?UserId AND ";
query += "TagId = ?TagId";
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))

View File

@@ -209,7 +209,7 @@ namespace OpenSim.Data.MySQL
{
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
m_log.WarnFormat(
"[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
"[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
}
@@ -218,7 +218,7 @@ namespace OpenSim.Data.MySQL
{
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
m_log.WarnFormat(
"[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
"[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
}
@@ -341,7 +341,7 @@ namespace OpenSim.Data.MySQL
catch (Exception)
{
m_log.ErrorFormat(
"[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);
}
}

View File

@@ -80,7 +80,7 @@ namespace OpenSim.Data.MySQL
return m_Items.Store(item);
}
public bool DeleteFolders(string field, string val)
{
return m_Folders.Delete(field, val);
@@ -220,12 +220,12 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?AssetID", assetID.ToString());
using (IDataReader reader = cmd.ExecuteReader())
{
int perms = 0;
if (reader.Read())
{
perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]);