From b16abc8166c29585cb76cc55c3bdd76e5833cb4f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 5 Jan 2017 19:07:37 +0000 Subject: Massive tab and trailing space cleanup --- OpenSim/Data/DBGuids.cs | 2 +- OpenSim/Data/IAvatarData.cs | 2 +- OpenSim/Data/IEstateDataStore.cs | 16 +-- OpenSim/Data/IGridUserData.cs | 2 +- OpenSim/Data/IGroupsData.cs | 2 +- OpenSim/Data/IHGTravelingData.cs | 2 +- OpenSim/Data/IOfflineIMData.cs | 2 +- OpenSim/Data/IPresenceData.cs | 2 +- OpenSim/Data/IRegionData.cs | 2 +- OpenSim/Data/IXGroupData.cs | 6 +- OpenSim/Data/Migration.cs | 26 ++-- OpenSim/Data/MySQL/MySQLAssetData.cs | 4 +- OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 28 ++-- OpenSim/Data/MySQL/MySQLAvatarData.cs | 2 +- OpenSim/Data/MySQL/MySQLEstateData.cs | 14 +- OpenSim/Data/MySQL/MySQLFSAssetData.cs | 2 +- OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 20 +-- OpenSim/Data/MySQL/MySQLGroupsData.cs | 20 +-- OpenSim/Data/MySQL/MySQLInventoryData.cs | 12 +- OpenSim/Data/MySQL/MySQLMigrations.cs | 6 +- OpenSim/Data/MySQL/MySQLOfflineIMData.cs | 2 +- OpenSim/Data/MySQL/MySQLPresenceData.cs | 8 +- OpenSim/Data/MySQL/MySQLRegionData.cs | 2 +- OpenSim/Data/MySQL/MySQLSimulationData.cs | 30 ++-- OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 176 +++++++++++------------ OpenSim/Data/MySQL/MySQLXAssetData.cs | 6 +- OpenSim/Data/MySQL/MySQLXInventoryData.cs | 6 +- OpenSim/Data/Null/NullEstateData.cs | 6 +- OpenSim/Data/Null/NullFriendsData.cs | 10 +- OpenSim/Data/Null/NullPresenceData.cs | 8 +- OpenSim/Data/Null/NullUserAccountData.cs | 32 ++--- OpenSim/Data/PGSQL/PGSQLAssetData.cs | 18 +-- OpenSim/Data/PGSQL/PGSQLAuthenticationData.cs | 6 +- OpenSim/Data/PGSQL/PGSQLAvatarData.cs | 2 +- OpenSim/Data/PGSQL/PGSQLEstateData.cs | 2 +- OpenSim/Data/PGSQL/PGSQLFriendsData.cs | 6 +- OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs | 14 +- OpenSim/Data/PGSQL/PGSQLGroupsData.cs | 36 ++--- OpenSim/Data/PGSQL/PGSQLInventoryData.cs | 58 ++++---- OpenSim/Data/PGSQL/PGSQLManager.cs | 2 +- OpenSim/Data/PGSQL/PGSQLMigration.cs | 4 +- OpenSim/Data/PGSQL/PGSQLOfflineIMData.cs | 2 +- OpenSim/Data/PGSQL/PGSQLPresenceData.cs | 4 +- OpenSim/Data/PGSQL/PGSQLRegionData.cs | 14 +- OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 156 ++++++++++---------- OpenSim/Data/PGSQL/PGSQLUserAccountData.cs | 20 +-- OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs | 12 +- OpenSim/Data/PGSQL/PGSQLXAssetData.cs | 24 ++-- OpenSim/Data/PGSQL/PGSQLXInventoryData.cs | 14 +- OpenSim/Data/SQLite/SQLiteAssetData.cs | 4 +- OpenSim/Data/SQLite/SQLiteAuthenticationData.cs | 6 +- OpenSim/Data/SQLite/SQLiteEstateData.cs | 12 +- OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | 4 +- OpenSim/Data/SQLite/SQLiteGridUserData.cs | 2 +- OpenSim/Data/SQLite/SQLiteHGTravelData.cs | 2 +- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 16 +-- OpenSim/Data/SQLite/SQLiteUserAccountData.cs | 2 +- OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | 166 ++++++++++----------- OpenSim/Data/SQLite/SQLiteUtils.cs | 6 +- OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 4 +- OpenSim/Data/Tests/AssetTests.cs | 6 +- OpenSim/Data/Tests/BasicDataServiceTest.cs | 12 +- OpenSim/Data/Tests/DefaultTestConns.cs | 10 +- OpenSim/Data/Tests/EstateTests.cs | 18 +-- OpenSim/Data/Tests/InventoryTests.cs | 28 ++-- OpenSim/Data/Tests/PropertyScrambler.cs | 2 +- OpenSim/Data/Tests/RegionTests.cs | 152 ++++++++++---------- 67 files changed, 652 insertions(+), 652 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs index ad1c19c..1a2bf41 100644 --- a/OpenSim/Data/DBGuids.cs +++ b/OpenSim/Data/DBGuids.cs @@ -38,7 +38,7 @@ namespace OpenSim.Data /// This function converts a value returned from the database in one of the /// supported formats into a UUID. This function is not actually DBMS-specific right /// now - /// + /// /// /// /// diff --git a/OpenSim/Data/IAvatarData.cs b/OpenSim/Data/IAvatarData.cs index 0a18e21..b3f12c1 100644 --- a/OpenSim/Data/IAvatarData.cs +++ b/OpenSim/Data/IAvatarData.cs @@ -39,7 +39,7 @@ namespace OpenSim.Data public Dictionary Data; } - public interface IAvatarData + public interface IAvatarData { AvatarBaseData[] Get(string field, string val); bool Store(AvatarBaseData data); diff --git a/OpenSim/Data/IEstateDataStore.cs b/OpenSim/Data/IEstateDataStore.cs index f9070ea..6b30db2 100644 --- a/OpenSim/Data/IEstateDataStore.cs +++ b/OpenSim/Data/IEstateDataStore.cs @@ -46,14 +46,14 @@ namespace OpenSim.Data /// If true, then an estate is created if one is not found. /// EstateSettings LoadEstateSettings(UUID regionID, bool create); - + /// /// Load estate settings for an estate ID. /// /// /// EstateSettings LoadEstateSettings(int estateID); - + /// /// Create a new estate. /// @@ -67,7 +67,7 @@ namespace OpenSim.Data /// /// An empty list if no estates were found. List LoadEstateSettingsAll(); - + /// /// Store estate settings. /// @@ -75,7 +75,7 @@ namespace OpenSim.Data /// This is also called by EstateSettings.Save() /// void StoreEstateSettings(EstateSettings es); - + /// /// Get estate IDs. /// @@ -88,13 +88,13 @@ namespace OpenSim.Data /// /// An empty list if no estates were found. List GetEstatesByOwner(UUID ownerID); - + /// /// Get the IDs of all estates. /// /// An empty list if no estates were found. List GetEstatesAll(); - + /// /// Link a region to an estate. /// @@ -102,14 +102,14 @@ namespace OpenSim.Data /// /// true if the link succeeded, false otherwise bool LinkRegion(UUID regionID, int estateID); - + /// /// Get the UUIDs of all the regions in an estate. /// /// /// List GetRegions(int estateID); - + /// /// Delete an estate /// diff --git a/OpenSim/Data/IGridUserData.cs b/OpenSim/Data/IGridUserData.cs index 9afa477..1b2ea87 100644 --- a/OpenSim/Data/IGridUserData.cs +++ b/OpenSim/Data/IGridUserData.cs @@ -47,7 +47,7 @@ namespace OpenSim.Data /// /// An interface for connecting to the user grid datastore /// - public interface IGridUserData + public interface IGridUserData { GridUserData Get(string userID); GridUserData[] GetAll(string query); diff --git a/OpenSim/Data/IGroupsData.cs b/OpenSim/Data/IGroupsData.cs index c11e649..bd059e0 100644 --- a/OpenSim/Data/IGroupsData.cs +++ b/OpenSim/Data/IGroupsData.cs @@ -81,7 +81,7 @@ namespace OpenSim.Data } - public interface IGroupsData + public interface IGroupsData { // groups table bool StoreGroup(GroupData data); diff --git a/OpenSim/Data/IHGTravelingData.cs b/OpenSim/Data/IHGTravelingData.cs index 452af7b..5e4894e 100644 --- a/OpenSim/Data/IHGTravelingData.cs +++ b/OpenSim/Data/IHGTravelingData.cs @@ -48,7 +48,7 @@ namespace OpenSim.Data /// /// An interface for connecting to the user grid datastore /// - public interface IHGTravelingData + public interface IHGTravelingData { HGTravelingData Get(UUID sessionID); HGTravelingData[] GetSessions(UUID userID); diff --git a/OpenSim/Data/IOfflineIMData.cs b/OpenSim/Data/IOfflineIMData.cs index 58501a3..a0f4d69 100644 --- a/OpenSim/Data/IOfflineIMData.cs +++ b/OpenSim/Data/IOfflineIMData.cs @@ -39,7 +39,7 @@ namespace OpenSim.Data } - public interface IOfflineIMData + public interface IOfflineIMData { OfflineIMData[] Get(string field, string val); long GetCount(string field, string key); diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs index 9ec48b0..4086245 100644 --- a/OpenSim/Data/IPresenceData.cs +++ b/OpenSim/Data/IPresenceData.cs @@ -44,7 +44,7 @@ namespace OpenSim.Data /// /// An interface for connecting to the presence datastore /// - public interface IPresenceData + public interface IPresenceData { bool Store(PresenceData data); diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs index ca9b327..c8e38a4 100644 --- a/OpenSim/Data/IRegionData.cs +++ b/OpenSim/Data/IRegionData.cs @@ -67,7 +67,7 @@ namespace OpenSim.Data /// /// An interface for connecting to the authentication datastore /// - public interface IRegionData + public interface IRegionData { RegionData Get(UUID regionID, UUID ScopeID); List Get(string regionName, UUID ScopeID); diff --git a/OpenSim/Data/IXGroupData.cs b/OpenSim/Data/IXGroupData.cs index e5821ef..82073fe 100644 --- a/OpenSim/Data/IXGroupData.cs +++ b/OpenSim/Data/IXGroupData.cs @@ -38,12 +38,12 @@ namespace OpenSim.Data public UUID ownerRoleID; public string name; public string charter; - public bool showInList; - public UUID insigniaID; + public bool showInList; + public UUID insigniaID; public int membershipFee; public bool openEnrollment; public bool allowPublish; - public bool maturePublish; + public bool maturePublish; public UUID founderID; public ulong everyonePowers; public ulong ownersPowers; diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index d606470..e54bf55 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs @@ -80,10 +80,10 @@ namespace OpenSim.Data /// Have the parameterless constructor just so we can specify it as a generic parameter with the new() constraint. /// Currently this is only used in the tests. A Migration instance created this way must be then - /// initialized with Initialize(). Regular creation should be through the parameterized constructors. + /// initialized with Initialize(). Regular creation should be through the parameterized constructors. /// public Migration() - { + { } public Migration(DbConnection conn, Assembly assem, string subtype, string type) @@ -91,7 +91,7 @@ namespace OpenSim.Data Initialize(conn, assem, type, subtype); } - public Migration(DbConnection conn, Assembly assem, string type) + public Migration(DbConnection conn, Assembly assem, string type) { Initialize(conn, assem, type, ""); } @@ -191,7 +191,7 @@ namespace OpenSim.Data int newversion = kvp.Key; // we need to up the command timeout to infinite as we might be doing long migrations. - /* [AlexRa 01-May-10]: We can't always just run any SQL in a single batch (= ExecuteNonQuery()). Things like + /* [AlexRa 01-May-10]: We can't always just run any SQL in a single batch (= ExecuteNonQuery()). Things like * stored proc definitions might have to be sent to the server each in a separate batch. * This is certainly so for MS SQL; not sure how the MySQL connector sorts out the mess * with 'delimiter @@'/'delimiter ;' around procs. So each "script" this code executes now is not @@ -276,7 +276,7 @@ namespace OpenSim.Data private delegate void FlushProc(); /// Scans for migration resources in either old-style "scattered" (one file per version) - /// or new-style "integrated" format (single file with ":VERSION nnn" sections). + /// or new-style "integrated" format (single file with ":VERSION nnn" sections). /// In the new-style migrations it also recognizes ':GO' separators for parts of the SQL script /// that must be sent to the server separately. The old-style migrations are loaded each in one piece /// and don't support the ':GO' feature. @@ -301,12 +301,12 @@ namespace OpenSim.Data { /* The filename should be '.migrations[.NNN]' where NNN * is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip - * the file without looking inside if we have a higher version already. Without the suffix we read + * the file without looking inside if we have a higher version already. Without the suffix we read * the file anyway and use the version numbers inside. Any unrecognized suffix (such as '.sql') * is valid but ignored. - * - * NOTE that we expect only one 'merged' migration file. If there are several, we take the last one. - * If you are numbering them, leave only the latest one in the project or at least make sure they numbered + * + * NOTE that we expect only one 'merged' migration file. If there are several, we take the last one. + * If you are numbering them, leave only the latest one in the project or at least make sure they numbered * to come up in the correct order (e.g. 'SomeStore.migrations.001' rather than 'SomeStore.migrations.1') */ @@ -351,7 +351,7 @@ namespace OpenSim.Data if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase)) { if (sb.Length == 0) continue; - if (nVersion > after) + if (nVersion > after) script.Add(sb.ToString()); sb.Length = 0; continue; @@ -405,10 +405,10 @@ scan_old_style: } } } - - if (migrations.Count < 1) + + if (migrations.Count < 1) m_log.DebugFormat("[MIGRATIONS]: {0} data tables already up to date at revision {1}", _type, after); - + return migrations; } } diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 1488e1a..f16cd91 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -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); } } diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index 7627497..af6be75 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs @@ -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; } diff --git a/OpenSim/Data/MySQL/MySQLAvatarData.cs b/OpenSim/Data/MySQL/MySQLAvatarData.cs index 6a2f5d8..63e8020 100644 --- a/OpenSim/Data/MySQL/MySQLAvatarData.cs +++ b/OpenSim/Data/MySQL/MySQLAvatarData.cs @@ -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; } diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index fe1487b..a5c8d24 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -403,19 +403,19 @@ namespace OpenSim.Data.MySQL return e; } } - + public List LoadEstateSettingsAll() { - List allEstateSettings = new List(); - + List allEstateSettings = new List(); + List allEstateIds = GetEstatesAll(); - + foreach (int estateId in allEstateIds) allEstateSettings.Add(LoadEstateSettings(estateId)); - + return allEstateSettings; } - + public List GetEstatesAll() { List result = new List(); @@ -441,7 +441,7 @@ namespace OpenSim.Data.MySQL dbcon.Close(); } - return result; + return result; } public List GetEstates(string search) diff --git a/OpenSim/Data/MySQL/MySQLFSAssetData.cs b/OpenSim/Data/MySQL/MySQLFSAssetData.cs index 4ed2de6..2837ce3 100644 --- a/OpenSim/Data/MySQL/MySQLFSAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLFSAssetData.cs @@ -54,7 +54,7 @@ namespace OpenSim.Data.MySQL { get { return GetType().Assembly; } } - + public MySQLFSAssetData() { } diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index dc657c8..6aae9c6 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs @@ -40,7 +40,7 @@ namespace OpenSim.Data.MySQL public class MySQLGenericTableHandler : MySqlFramework where T: class, new() { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + protected Dictionary m_Fields = new Dictionary(); @@ -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 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()); } diff --git a/OpenSim/Data/MySQL/MySQLGroupsData.cs b/OpenSim/Data/MySQL/MySQLGroupsData.cs index 5734d19..4e73ee7 100644 --- a/OpenSim/Data/MySQL/MySQLGroupsData.cs +++ b/OpenSim/Data/MySQL/MySQLGroupsData.cs @@ -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) { } diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index e9b10f3..382d4a5 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs @@ -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 fetchActiveGestures(UUID avatarID) { lock (m_dbLock) diff --git a/OpenSim/Data/MySQL/MySQLMigrations.cs b/OpenSim/Data/MySQL/MySQLMigrations.cs index 81a0e83..2043dae 100644 --- a/OpenSim/Data/MySQL/MySQLMigrations.cs +++ b/OpenSim/Data/MySQL/MySQLMigrations.cs @@ -39,16 +39,16 @@ namespace OpenSim.Data.MySQL { /// This is a MySQL-customized migration processor. The only difference is in how /// it executes SQL scripts (using MySqlScript instead of MyCommand) - /// + /// /// 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) { } diff --git a/OpenSim/Data/MySQL/MySQLOfflineIMData.cs b/OpenSim/Data/MySQL/MySQLOfflineIMData.cs index bafd204..7608858 100644 --- a/OpenSim/Data/MySQL/MySQLOfflineIMData.cs +++ b/OpenSim/Data/MySQL/MySQLOfflineIMData.cs @@ -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); } diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs index 3f90639..70aca5f 100644 --- a/OpenSim/Data/MySQL/MySQLPresenceData.cs +++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs @@ -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; } diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 99d4944..0e55285 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -410,7 +410,7 @@ namespace OpenSim.Data.MySQL using (MySqlCommand cmd = new MySqlCommand(command)) { cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); - + return RunCommand(cmd); } } diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 2aaa2ff..8278c0e 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -55,7 +55,7 @@ namespace OpenSim.Data.MySQL /// /// 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 uuids = new List(); // 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 primsWithInventory = new List(); @@ -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); } } diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index c389ae4..8af2a3e 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs @@ -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 /// /// 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)) diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index ec2bcc6..2c6acde 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -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); } } diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index 9a0044e..4e41fec 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs @@ -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"]); diff --git a/OpenSim/Data/Null/NullEstateData.cs b/OpenSim/Data/Null/NullEstateData.cs index 57592f1..9f22896 100755 --- a/OpenSim/Data/Null/NullEstateData.cs +++ b/OpenSim/Data/Null/NullEstateData.cs @@ -102,19 +102,19 @@ namespace OpenSim.Data.Null { return new EstateSettings(); } - + public List LoadEstateSettingsAll() { List allEstateSettings = new List(); allEstateSettings.Add(GetEstate()); return allEstateSettings; } - + public List GetEstatesAll() { List result = new List(); result.Add((int)GetEstate().EstateID); - return result; + return result; } public List GetEstates(string search) diff --git a/OpenSim/Data/Null/NullFriendsData.cs b/OpenSim/Data/Null/NullFriendsData.cs index 473999f..dc9cd38 100644 --- a/OpenSim/Data/Null/NullFriendsData.cs +++ b/OpenSim/Data/Null/NullFriendsData.cs @@ -79,7 +79,7 @@ namespace OpenSim.Data.Null { return fdata.PrincipalID == userID.ToString(); }); - + if (lst != null) { lst.ForEach(f => @@ -87,14 +87,14 @@ namespace OpenSim.Data.Null FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID); if (f2 != null) f.Data["TheirFlags"] = f2.Data["Flags"]; - + // m_log.DebugFormat( // "[NULL FRIENDS DATA]: Got {0} {1} {2} for {3}", // f.Friend, f.Data["Flags"], f2 != null ? f.Data["TheirFlags"] : "not found!", f.PrincipalID); }); - + // m_log.DebugFormat("[NULL FRIENDS DATA]: Got {0} friends for {1}", lst.Count, userID); - + return lst.ToArray(); } } @@ -134,7 +134,7 @@ namespace OpenSim.Data.Null // m_log.DebugFormat( // "[NULL FRIENDS DATA]: Deleting friend {0} {1} for {2}", // friend.Friend, friend.Data["Flags"], friend.PrincipalID); - + m_Data.Remove(friend); return true; } diff --git a/OpenSim/Data/Null/NullPresenceData.cs b/OpenSim/Data/Null/NullPresenceData.cs index aff0b0b..8c442c9 100644 --- a/OpenSim/Data/Null/NullPresenceData.cs +++ b/OpenSim/Data/Null/NullPresenceData.cs @@ -39,7 +39,7 @@ namespace OpenSim.Data.Null public class NullPresenceData : IPresenceData { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + public static NullPresenceData Instance; Dictionary m_presenceData = new Dictionary(); @@ -100,7 +100,7 @@ namespace OpenSim.Data.Null { if (Instance != this) return Instance.ReportAgent(sessionID, regionID); - + if (m_presenceData.ContainsKey(sessionID)) { m_presenceData[sessionID].RegionID = regionID; @@ -129,7 +129,7 @@ namespace OpenSim.Data.Null // Console.WriteLine("HOME for " + p.UserID + " is " + (p.Data.ContainsKey("HomeRegionID") ? p.Data["HomeRegionID"] : "Not found")); } } - + return presences.ToArray(); } else if (field == "SessionID") @@ -172,7 +172,7 @@ namespace OpenSim.Data.Null { // m_log.DebugFormat( // "[NULL PRESENCE DATA]: Deleting presence data for field {0} with parameter {1}", field, data); - + if (Instance != this) return Instance.Delete(field, data); diff --git a/OpenSim/Data/Null/NullUserAccountData.cs b/OpenSim/Data/Null/NullUserAccountData.cs index 241616b..6d2e05a 100644 --- a/OpenSim/Data/Null/NullUserAccountData.cs +++ b/OpenSim/Data/Null/NullUserAccountData.cs @@ -40,7 +40,7 @@ namespace OpenSim.Data.Null public class NullUserAccountData : IUserAccountData { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private Dictionary m_DataByUUID = new Dictionary(); private Dictionary m_DataByName = new Dictionary(); private Dictionary m_DataByEmail = new Dictionary(); @@ -48,7 +48,7 @@ namespace OpenSim.Data.Null public NullUserAccountData(string connectionString, string realm) { // m_log.DebugFormat( -// "[NULL USER ACCOUNT DATA]: Initializing new NullUserAccountData with connectionString [{0}], realm [{1}]", +// "[NULL USER ACCOUNT DATA]: Initializing new NullUserAccountData with connectionString [{0}], realm [{1}]", // connectionString, realm); } @@ -65,12 +65,12 @@ namespace OpenSim.Data.Null // if (m_log.IsDebugEnabled) // { // m_log.DebugFormat( -// "[NULL USER ACCOUNT DATA]: Called Get with fields [{0}], values [{1}]", +// "[NULL USER ACCOUNT DATA]: Called Get with fields [{0}], values [{1}]", // string.Join(", ", fields), string.Join(", ", values)); // } - + UserAccountData[] userAccounts = new UserAccountData[0]; - + List fieldsLst = new List(fields); if (fieldsLst.Contains("PrincipalID")) { @@ -79,33 +79,33 @@ namespace OpenSim.Data.Null if (UUID.TryParse(values[i], out id)) if (m_DataByUUID.ContainsKey(id)) userAccounts = new UserAccountData[] { m_DataByUUID[id] }; - } + } else if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName")) { int findex = fieldsLst.IndexOf("FirstName"); int lindex = fieldsLst.IndexOf("LastName"); if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex])) - { + { userAccounts = new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] }; } - } + } else if (fieldsLst.Contains("Email")) { int i = fieldsLst.IndexOf("Email"); if (m_DataByEmail.ContainsKey(values[i])) userAccounts = new UserAccountData[] { m_DataByEmail[values[i]] }; } - + // if (m_log.IsDebugEnabled) // { // StringBuilder sb = new StringBuilder(); // foreach (UserAccountData uad in userAccounts) // sb.AppendFormat("({0} {1} {2}) ", uad.FirstName, uad.LastName, uad.PrincipalID); -// +// // m_log.DebugFormat( // "[NULL USER ACCOUNT DATA]: Returning {0} user accounts out of {1}: [{2}]", userAccounts.Length, m_DataByName.Count, sb); // } - + return userAccounts; } @@ -113,16 +113,16 @@ namespace OpenSim.Data.Null { if (data == null) return false; - + m_log.DebugFormat( - "[NULL USER ACCOUNT DATA]: Storing user account {0} {1} {2} {3}", + "[NULL USER ACCOUNT DATA]: Storing user account {0} {1} {2} {3}", data.FirstName, data.LastName, data.PrincipalID, this.GetHashCode()); - + m_DataByUUID[data.PrincipalID] = data; m_DataByName[data.FirstName + " " + data.LastName] = data; if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty) m_DataByEmail[data.Data["Email"]] = data; - + // m_log.DebugFormat("m_DataByUUID count is {0}, m_DataByName count is {1}", m_DataByUUID.Count, m_DataByName.Count); return true; @@ -132,7 +132,7 @@ namespace OpenSim.Data.Null { // m_log.DebugFormat( // "[NULL USER ACCOUNT DATA]: Called GetUsers with scope [{0}], query [{1}]", scopeID, query); - + string[] words = query.Split(new char[] { ' ' }); for (int i = 0; i < words.Length; i++) diff --git a/OpenSim/Data/PGSQL/PGSQLAssetData.cs b/OpenSim/Data/PGSQL/PGSQLAssetData.cs index 81adb03..7b79521 100644 --- a/OpenSim/Data/PGSQL/PGSQLAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLAssetData.cs @@ -151,35 +151,35 @@ namespace OpenSim.Data.PGSQL /// the asset override public bool StoreAsset(AssetBase asset) { - + string sql = @"UPDATE assets set name = :name, description = :description, " + "\"assetType\" " + @" = :assetType, local = :local, temporary = :temporary, creatorid = :creatorid, data = :data WHERE id=:id; INSERT INTO assets - (id, name, description, " + "\"assetType\" " + @", local, + (id, name, description, " + "\"assetType\" " + @", local, temporary, create_time, access_time, creatorid, asset_flags, data) - Select :id, :name, :description, :assetType, :local, + Select :id, :name, :description, :assetType, :local, :temporary, :create_time, :access_time, :creatorid, :asset_flags, :data - Where not EXISTS(SELECT * FROM assets WHERE id=:id) + Where not EXISTS(SELECT * FROM assets WHERE id=:id) "; - + string assetName = asset.Name; if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( - "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", + "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } - + string assetDescription = asset.Description; if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( - "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", + "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); } @@ -278,7 +278,7 @@ namespace OpenSim.Data.PGSQL { List retList = new List(count); string sql = @" SELECT id, name, description, " + "\"assetType\"" + @", temporary, creatorid - FROM assets + FROM assets order by id limit :stop offset :start;"; diff --git a/OpenSim/Data/PGSQL/PGSQLAuthenticationData.cs b/OpenSim/Data/PGSQL/PGSQLAuthenticationData.cs index d174112..8f83309 100644 --- a/OpenSim/Data/PGSQL/PGSQLAuthenticationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLAuthenticationData.cs @@ -145,7 +145,7 @@ namespace OpenSim.Data.PGSQL updateBuilder.AppendFormat("\"{0}\" = :{0}",field); first = false; - + cmd.Parameters.Add(m_database.CreateParameter("" + field, data.Data[field])); } @@ -154,7 +154,7 @@ namespace OpenSim.Data.PGSQL cmd.CommandText = updateBuilder.ToString(); cmd.Connection = conn; cmd.Parameters.Add(m_database.CreateParameter("principalID", data.PrincipalID)); - + conn.Open(); if (cmd.ExecuteNonQuery() < 1) { @@ -195,7 +195,7 @@ namespace OpenSim.Data.PGSQL { if (System.Environment.TickCount - m_LastExpire > 30000) DoExpire(); - + string sql = "insert into tokens (uuid, token, validity) values (:principalID, :token, :lifetime)"; using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) diff --git a/OpenSim/Data/PGSQL/PGSQLAvatarData.cs b/OpenSim/Data/PGSQL/PGSQLAvatarData.cs index d9c4905..3d56d4d 100644 --- a/OpenSim/Data/PGSQL/PGSQLAvatarData.cs +++ b/OpenSim/Data/PGSQL/PGSQLAvatarData.cs @@ -45,7 +45,7 @@ namespace OpenSim.Data.PGSQL IAvatarData { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + public PGSQLAvatarData(string connectionString, string realm) : base(connectionString, realm, "Avatar") { diff --git a/OpenSim/Data/PGSQL/PGSQLEstateData.cs b/OpenSim/Data/PGSQL/PGSQLEstateData.cs index b5ca235..9489d6c 100644 --- a/OpenSim/Data/PGSQL/PGSQLEstateData.cs +++ b/OpenSim/Data/PGSQL/PGSQLEstateData.cs @@ -594,7 +594,7 @@ namespace OpenSim.Data.PGSQL public bool DeleteEstate(int estateID) { - // TODO: Implementation! + // TODO: Implementation! return false; } #endregion diff --git a/OpenSim/Data/PGSQL/PGSQLFriendsData.cs b/OpenSim/Data/PGSQL/PGSQLFriendsData.cs index a841353..58dffed 100644 --- a/OpenSim/Data/PGSQL/PGSQLFriendsData.cs +++ b/OpenSim/Data/PGSQL/PGSQLFriendsData.cs @@ -50,7 +50,7 @@ namespace OpenSim.Data.PGSQL } } - + public override bool Delete(string principalID, string friend) { UUID princUUID = UUID.Zero; @@ -97,7 +97,7 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand()) { - cmd.CommandText = String.Format("select a.*,case when b.\"Flags\" is null then '-1' else b.\"Flags\" end as \"TheirFlags\" from {0} as a " + + 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.Add(m_database.CreateParameter("PrincipalID", principalID.ToString())); @@ -111,6 +111,6 @@ namespace OpenSim.Data.PGSQL { return GetFriends(principalID); } - + } } diff --git a/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs b/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs index 061de22..5b24720 100644 --- a/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs +++ b/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs @@ -64,7 +64,7 @@ namespace OpenSim.Data.PGSQL : base(connectionString) { m_Realm = realm; - + m_ConnectionString = connectionString; if (storeName != String.Empty) @@ -104,7 +104,7 @@ namespace OpenSim.Data.PGSQL m_FieldTypes = new Dictionary(); string query = string.Format(@"select column_name,data_type - from INFORMATION_SCHEMA.COLUMNS + from INFORMATION_SCHEMA.COLUMNS where table_name = lower('{0}'); ", m_Realm); @@ -232,7 +232,7 @@ namespace OpenSim.Data.PGSQL if (reader == null) return new T[0]; - CheckColumnNames(reader); + CheckColumnNames(reader); while (reader.Read()) { @@ -339,7 +339,7 @@ namespace OpenSim.Data.PGSQL 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( @@ -395,11 +395,11 @@ namespace OpenSim.Data.PGSQL } string where = String.Join(" AND ", terms.ToArray()); query.AppendFormat(" WHERE {0} ", where); - + } cmd.Connection = conn; cmd.CommandText = query.ToString(); - + conn.Open(); if (cmd.ExecuteNonQuery() > 0) { @@ -416,7 +416,7 @@ namespace OpenSim.Data.PGSQL query.Append("\") values (" + String.Join(",", values.ToArray()) + ")"); cmd.Connection = conn; cmd.CommandText = query.ToString(); - + // m_log.WarnFormat("[PGSQLGenericTable]: Inserting into {0} sql {1}", m_Realm, cmd.CommandText); if (conn.State != ConnectionState.Open) diff --git a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs index e257e7c..6ef576b 100755 --- a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs +++ b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs @@ -37,7 +37,7 @@ using Npgsql; namespace OpenSim.Data.PGSQL { public class PGSQLGroupsData : IGroupsData - { + { private PGSqlGroupsGroupsHandler m_Groups; private PGSqlGroupsMembershipHandler m_Membership; private PGSqlGroupsRolesHandler m_Roles; @@ -83,17 +83,17 @@ namespace OpenSim.Data.PGSQL public GroupData[] RetrieveGroups(string pattern) { - + if (string.IsNullOrEmpty(pattern)) // True for where clause { pattern = " 1 ORDER BY lower(\"Name\") LIMIT 100"; - + return m_Groups.Get(pattern); } - else - { + else + { pattern = " \"ShowInList\" = 1 AND lower(\"Name\") LIKE lower('%" + pattern + "%') ORDER BY lower(\"Name\") LIMIT 100"; - + return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern)); } } @@ -138,10 +138,10 @@ namespace OpenSim.Data.PGSQL 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()); @@ -173,7 +173,7 @@ namespace OpenSim.Data.PGSQL 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() }); } @@ -365,7 +365,7 @@ namespace OpenSim.Data.PGSQL get { return GetType().Assembly; } } - public PGSqlGroupsGroupsHandler(string connectionString, string realm, string store) + public PGSqlGroupsGroupsHandler(string connectionString, string realm, string store) : base(connectionString, realm, store) { } @@ -380,7 +380,7 @@ namespace OpenSim.Data.PGSQL get { return GetType().Assembly; } } - public PGSqlGroupsMembershipHandler(string connectionString, string realm) + public PGSqlGroupsMembershipHandler(string connectionString, string realm) : base(connectionString, realm, string.Empty) { } @@ -395,7 +395,7 @@ namespace OpenSim.Data.PGSQL get { return GetType().Assembly; } } - public PGSqlGroupsRolesHandler(string connectionString, string realm) + public PGSqlGroupsRolesHandler(string connectionString, string realm) : base(connectionString, realm, string.Empty) { } @@ -410,7 +410,7 @@ namespace OpenSim.Data.PGSQL get { return GetType().Assembly; } } - public PGSqlGroupsRoleMembershipHandler(string connectionString, string realm) + public PGSqlGroupsRoleMembershipHandler(string connectionString, string realm) : base(connectionString, realm, string.Empty) { } @@ -425,7 +425,7 @@ namespace OpenSim.Data.PGSQL get { return GetType().Assembly; } } - public PGSqlGroupsInvitesHandler(string connectionString, string realm) + public PGSqlGroupsInvitesHandler(string connectionString, string realm) : base(connectionString, realm, string.Empty) { } @@ -436,7 +436,7 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand()) { cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); - + ExecuteNonQuery(cmd); } @@ -451,7 +451,7 @@ namespace OpenSim.Data.PGSQL get { return GetType().Assembly; } } - public PGSqlGroupsNoticesHandler(string connectionString, string realm) + public PGSqlGroupsNoticesHandler(string connectionString, string realm) : base(connectionString, realm, string.Empty) { } @@ -462,7 +462,7 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand()) { cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); - + ExecuteNonQuery(cmd); } @@ -477,7 +477,7 @@ namespace OpenSim.Data.PGSQL get { return GetType().Assembly; } } - public PGSqlGroupsPrincipalsHandler(string connectionString, string realm) + public PGSqlGroupsPrincipalsHandler(string connectionString, string realm) : base(connectionString, realm, string.Empty) { } diff --git a/OpenSim/Data/PGSQL/PGSQLInventoryData.cs b/OpenSim/Data/PGSQL/PGSQLInventoryData.cs index c999433..30fc5ea 100644 --- a/OpenSim/Data/PGSQL/PGSQLInventoryData.cs +++ b/OpenSim/Data/PGSQL/PGSQLInventoryData.cs @@ -69,7 +69,7 @@ namespace OpenSim.Data.PGSQL { m_connectionString = connectionString; database = new PGSQLManager(connectionString); - + //New migrations check of store database.CheckMigration(_migrationStore); } @@ -190,8 +190,8 @@ namespace OpenSim.Data.PGSQL /* NOTE: the implementation below is very inefficient (makes a separate request to get subfolders for * every found folder, recursively). Inventory code for other DBs has been already rewritten to get ALL * inventory for a specific user at once. - * - * Meanwhile, one little thing is corrected: getFolderHierarchy(UUID.Zero) doesn't make sense and should never + * + * Meanwhile, one little thing is corrected: getFolderHierarchy(UUID.Zero) doesn't make sense and should never * be used, so check for that and return an empty list. */ @@ -264,11 +264,11 @@ namespace OpenSim.Data.PGSQL /// Folder to update public void updateInventoryFolder(InventoryFolderBase folder) { - string sql = @"UPDATE inventoryfolders SET ""agentID"" = :agentID, + string sql = @"UPDATE inventoryfolders SET ""agentID"" = :agentID, ""parentFolderID"" = :parentFolderID, ""folderName"" = :folderName, type = :type, - version = :version + version = :version WHERE folderID = :folderID"; string folderName = folder.Name; @@ -337,7 +337,7 @@ namespace OpenSim.Data.PGSQL cmd.Parameters.Add(database.CreateParameter("parentID", UUID.Zero)); conn.Open(); subFolders = getFolderHierarchy(folderID, cmd); - + //Delete all sub-folders foreach (InventoryFolderBase f in subFolders) @@ -403,7 +403,7 @@ namespace OpenSim.Data.PGSQL } } } - + m_log.InfoFormat("[INVENTORY DB]: Found no inventory item with ID : {0}", itemID); return null; } @@ -420,24 +420,24 @@ namespace OpenSim.Data.PGSQL return; } - string sql = @"INSERT INTO inventoryitems - (""inventoryID"", ""assetID"", ""assetType"", ""parentFolderID"", ""avatarID"", ""inventoryName"", + string sql = @"INSERT INTO inventoryitems + (""inventoryID"", ""assetID"", ""assetType"", ""parentFolderID"", ""avatarID"", ""inventoryName"", ""inventoryDescription"", ""inventoryNextPermissions"", ""inventoryCurrentPermissions"", ""invType"", ""creatorID"", ""inventoryBasePermissions"", ""inventoryEveryOnePermissions"", ""inventoryGroupPermissions"", - ""salePrice"", ""SaleType"", ""creationDate"", ""groupID"", ""groupOwned"", flags) + ""salePrice"", ""SaleType"", ""creationDate"", ""groupID"", ""groupOwned"", flags) VALUES (:inventoryID, :assetID, :assetType, :parentFolderID, :avatarID, :inventoryName, :inventoryDescription, :inventoryNextPermissions, :inventoryCurrentPermissions, :invType, :creatorID, :inventoryBasePermissions, :inventoryEveryOnePermissions, :inventoryGroupPermissions, :SalePrice, :SaleType, :creationDate, :groupID, :groupOwned, :flags)"; - + string itemName = item.Name; if (item.Name.Length > 64) { itemName = item.Name.Substring(0, 64); m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters"); } - + string itemDesc = item.Description; if (item.Description.Length > 128) { @@ -502,25 +502,25 @@ namespace OpenSim.Data.PGSQL /// Inventory item to update public void updateInventoryItem(InventoryItemBase item) { - string sql = @"UPDATE inventoryitems SET ""assetID"" = :assetID, + string sql = @"UPDATE inventoryitems SET ""assetID"" = :assetID, ""assetType"" = :assetType, ""parentFolderID"" = :parentFolderID, ""avatarID"" = :avatarID, - ""inventoryName"" = :inventoryName, - ""inventoryDescription"" = :inventoryDescription, - ""inventoryNextPermissions"" = :inventoryNextPermissions, - ""inventoryCurrentPermissions"" = :inventoryCurrentPermissions, - ""invType"" = :invType, - ""creatorID"" = :creatorID, - ""inventoryBasePermissions"" = :inventoryBasePermissions, - ""inventoryEveryOnePermissions"" = :inventoryEveryOnePermissions, - ""inventoryGroupPermissions"" = :inventoryGroupPermissions, - ""salePrice"" = :SalePrice, - ""saleType"" = :SaleType, - ""creationDate"" = :creationDate, - ""groupID"" = :groupID, - ""groupOwned"" = :groupOwned, - flags = :flags + ""inventoryName"" = :inventoryName, + ""inventoryDescription"" = :inventoryDescription, + ""inventoryNextPermissions"" = :inventoryNextPermissions, + ""inventoryCurrentPermissions"" = :inventoryCurrentPermissions, + ""invType"" = :invType, + ""creatorID"" = :creatorID, + ""inventoryBasePermissions"" = :inventoryBasePermissions, + ""inventoryEveryOnePermissions"" = :inventoryEveryOnePermissions, + ""inventoryGroupPermissions"" = :inventoryGroupPermissions, + ""salePrice"" = :SalePrice, + ""saleType"" = :SaleType, + ""creationDate"" = :creationDate, + ""groupID"" = :groupID, + ""groupOwned"" = :groupOwned, + flags = :flags WHERE ""inventoryID"" = :inventoryID"; string itemName = item.Name; @@ -529,7 +529,7 @@ namespace OpenSim.Data.PGSQL itemName = item.Name.Substring(0, 64); m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters on update"); } - + string itemDesc = item.Description; if (item.Description.Length > 128) { diff --git a/OpenSim/Data/PGSQL/PGSQLManager.cs b/OpenSim/Data/PGSQL/PGSQLManager.cs index af5a7cd..276a37c 100644 --- a/OpenSim/Data/PGSQL/PGSQLManager.cs +++ b/OpenSim/Data/PGSQL/PGSQLManager.cs @@ -326,7 +326,7 @@ namespace OpenSim.Data.PGSQL /// migrationStore. public void CheckMigration(string migrationStore) { - using (NpgsqlConnection connection = new NpgsqlConnection(connectionString)) + using (NpgsqlConnection connection = new NpgsqlConnection(connectionString)) { connection.Open(); Assembly assem = GetType().Assembly; diff --git a/OpenSim/Data/PGSQL/PGSQLMigration.cs b/OpenSim/Data/PGSQL/PGSQLMigration.cs index 709fde0..749a3f2 100644 --- a/OpenSim/Data/PGSQL/PGSQLMigration.cs +++ b/OpenSim/Data/PGSQL/PGSQLMigration.cs @@ -54,8 +54,8 @@ namespace OpenSim.Data.PGSQL { try { - cmd.CommandText = "select version from migrations where name = '" + type + "' " + - " order by version desc limit 1"; //Must be + cmd.CommandText = "select version from migrations where name = '" + type + "' " + + " order by version desc limit 1"; //Must be using (NpgsqlDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) diff --git a/OpenSim/Data/PGSQL/PGSQLOfflineIMData.cs b/OpenSim/Data/PGSQL/PGSQLOfflineIMData.cs index 82e5ed8..a0c3542 100644 --- a/OpenSim/Data/PGSQL/PGSQLOfflineIMData.cs +++ b/OpenSim/Data/PGSQL/PGSQLOfflineIMData.cs @@ -47,7 +47,7 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand()) { cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); - + ExecuteNonQuery(cmd); } diff --git a/OpenSim/Data/PGSQL/PGSQLPresenceData.cs b/OpenSim/Data/PGSQL/PGSQLPresenceData.cs index 0376585..ebbe8d3 100755 --- a/OpenSim/Data/PGSQL/PGSQLPresenceData.cs +++ b/OpenSim/Data/PGSQL/PGSQLPresenceData.cs @@ -80,7 +80,7 @@ namespace OpenSim.Data.PGSQL PresenceData[] pd = Get("SessionID", sessionID.ToString()); if (pd.Length == 0) return false; - + if (regionID == UUID.Zero) return false; @@ -103,7 +103,7 @@ namespace OpenSim.Data.PGSQL public bool VerifyAgent(UUID agentId, UUID secureSessionID) { PresenceData[] ret = Get("SecureSessionID", secureSessionID.ToString()); - + if (ret.Length == 0) return false; diff --git a/OpenSim/Data/PGSQL/PGSQLRegionData.cs b/OpenSim/Data/PGSQL/PGSQLRegionData.cs index fc352c3..1272e37 100644 --- a/OpenSim/Data/PGSQL/PGSQLRegionData.cs +++ b/OpenSim/Data/PGSQL/PGSQLRegionData.cs @@ -57,7 +57,7 @@ namespace OpenSim.Data.PGSQL get { return GetType().Assembly; } } - public PGSQLRegionData(string connectionString, string realm) + public PGSQLRegionData(string connectionString, string realm) { m_Realm = realm; m_ConnectionString = connectionString; @@ -77,7 +77,7 @@ namespace OpenSim.Data.PGSQL m_FieldTypes = new Dictionary(); string query = string.Format(@"select column_name,data_type - from INFORMATION_SCHEMA.COLUMNS + from INFORMATION_SCHEMA.COLUMNS where table_name = lower('{0}'); ", m_Realm); @@ -107,7 +107,7 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) { cmd.Parameters.Add(m_database.CreateParameter("regionName", regionName)); - if (scopeID != UUID.Zero) + if (scopeID != UUID.Zero) cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); conn.Open(); return RunCommand(cmd); @@ -134,7 +134,7 @@ namespace OpenSim.Data.PGSQL cmd.Parameters.Add(m_database.CreateParameter("startY", startY)); cmd.Parameters.Add(m_database.CreateParameter("endX", endX)); cmd.Parameters.Add(m_database.CreateParameter("endY", endY)); - if (scopeID != UUID.Zero) + if (scopeID != UUID.Zero) cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); conn.Open(); ret = RunCommand(cmd); @@ -167,7 +167,7 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) { cmd.Parameters.Add(m_database.CreateParameter("regionID", regionID)); - if (scopeID != UUID.Zero) + if (scopeID != UUID.Zero) cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); conn.Open(); List ret = RunCommand(cmd); @@ -196,7 +196,7 @@ namespace OpenSim.Data.PGSQL cmd.Parameters.Add(m_database.CreateParameter("startY", qstartY)); cmd.Parameters.Add(m_database.CreateParameter("endX", endX)); cmd.Parameters.Add(m_database.CreateParameter("endY", endY)); - if (scopeID != UUID.Zero) + if (scopeID != UUID.Zero) cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); conn.Open(); @@ -298,7 +298,7 @@ namespace OpenSim.Data.PGSQL { string update = "update " + m_Realm + " set \"locX\"=:posX, \"locY\"=:posY, \"sizeX\"=:sizeX, \"sizeY\"=:sizeY "; - + foreach (string field in fields) { diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index 902aae0..33d12bd 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs @@ -110,11 +110,11 @@ namespace OpenSim.Data.PGSQL Dictionary objects = new Dictionary(); SceneObjectGroup grp = null; - string sql = @"SELECT *, - CASE WHEN prims.""UUID"" = prims.""SceneGroupID"" THEN 0 ELSE 1 END as sort - FROM prims - LEFT JOIN primshapes ON prims.""UUID"" = primshapes.""UUID"" - WHERE ""RegionUUID"" = :RegionUUID + string sql = @"SELECT *, + CASE WHEN prims.""UUID"" = prims.""SceneGroupID"" THEN 0 ELSE 1 END as sort + FROM prims + LEFT JOIN primshapes ON prims.""UUID"" = primshapes.""UUID"" + WHERE ""RegionUUID"" = :RegionUUID ORDER BY ""SceneGroupID"" asc, sort asc, ""LinkNumber"" asc"; using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) @@ -146,7 +146,7 @@ namespace OpenSim.Data.PGSQL // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are // recorded as the root prim (for which the UUID must equal the persisted group UUID). In // this case, force the UUID to be the same as the group UUID so that at least these can be - // deleted (we need to change the UUID so that any other prims in the linkset can also be + // deleted (we need to change the UUID so that any other prims in the linkset can also be // deleted). if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero) { @@ -178,7 +178,7 @@ namespace OpenSim.Data.PGSQL objects[grp.UUID] = grp; // 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 primsWithInventory = new List(); @@ -331,52 +331,52 @@ namespace OpenSim.Data.PGSQL private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) { //Big query to update or insert a new prim. - + string queryPrims = @" - UPDATE prims SET - ""CreationDate"" = :CreationDate, ""Name"" = :Name, ""Text"" = :Text, ""Description"" = :Description, ""SitName"" = :SitName, - ""TouchName"" = :TouchName, ""ObjectFlags"" = :ObjectFlags, ""OwnerMask"" = :OwnerMask, ""NextOwnerMask"" = :NextOwnerMask, ""GroupMask"" = :GroupMask, - ""EveryoneMask"" = :EveryoneMask, ""BaseMask"" = :BaseMask, ""PositionX"" = :PositionX, ""PositionY"" = :PositionY, ""PositionZ"" = :PositionZ, - ""GroupPositionX"" = :GroupPositionX, ""GroupPositionY"" = :GroupPositionY, ""GroupPositionZ"" = :GroupPositionZ, ""VelocityX"" = :VelocityX, - ""VelocityY"" = :VelocityY, ""VelocityZ"" = :VelocityZ, ""AngularVelocityX"" = :AngularVelocityX, ""AngularVelocityY"" = :AngularVelocityY, - ""AngularVelocityZ"" = :AngularVelocityZ, ""AccelerationX"" = :AccelerationX, ""AccelerationY"" = :AccelerationY, - ""AccelerationZ"" = :AccelerationZ, ""RotationX"" = :RotationX, ""RotationY"" = :RotationY, ""RotationZ"" = :RotationZ, ""RotationW"" = :RotationW, - ""SitTargetOffsetX"" = :SitTargetOffsetX, ""SitTargetOffsetY"" = :SitTargetOffsetY, ""SitTargetOffsetZ"" = :SitTargetOffsetZ, - ""SitTargetOrientW"" = :SitTargetOrientW, ""SitTargetOrientX"" = :SitTargetOrientX, ""SitTargetOrientY"" = :SitTargetOrientY, - ""SitTargetOrientZ"" = :SitTargetOrientZ, ""RegionUUID"" = :RegionUUID, ""CreatorID"" = :CreatorID, ""OwnerID"" = :OwnerID, ""GroupID"" = :GroupID, - ""LastOwnerID"" = :LastOwnerID, ""SceneGroupID"" = :SceneGroupID, ""PayPrice"" = :PayPrice, ""PayButton1"" = :PayButton1, ""PayButton2"" = :PayButton2, - ""PayButton3"" = :PayButton3, ""PayButton4"" = :PayButton4, ""LoopedSound"" = :LoopedSound, ""LoopedSoundGain"" = :LoopedSoundGain, - ""TextureAnimation"" = :TextureAnimation, ""OmegaX"" = :OmegaX, ""OmegaY"" = :OmegaY, ""OmegaZ"" = :OmegaZ, ""CameraEyeOffsetX"" = :CameraEyeOffsetX, - ""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX, - ""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook, - ""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice, - ""SaleType"" = :SaleType, ""ColorR"" = :ColorR, ""ColorG"" = :ColorG, ""ColorB"" = :ColorB, ""ColorA"" = :ColorA, ""ParticleSystem"" = :ParticleSystem, + UPDATE prims SET + ""CreationDate"" = :CreationDate, ""Name"" = :Name, ""Text"" = :Text, ""Description"" = :Description, ""SitName"" = :SitName, + ""TouchName"" = :TouchName, ""ObjectFlags"" = :ObjectFlags, ""OwnerMask"" = :OwnerMask, ""NextOwnerMask"" = :NextOwnerMask, ""GroupMask"" = :GroupMask, + ""EveryoneMask"" = :EveryoneMask, ""BaseMask"" = :BaseMask, ""PositionX"" = :PositionX, ""PositionY"" = :PositionY, ""PositionZ"" = :PositionZ, + ""GroupPositionX"" = :GroupPositionX, ""GroupPositionY"" = :GroupPositionY, ""GroupPositionZ"" = :GroupPositionZ, ""VelocityX"" = :VelocityX, + ""VelocityY"" = :VelocityY, ""VelocityZ"" = :VelocityZ, ""AngularVelocityX"" = :AngularVelocityX, ""AngularVelocityY"" = :AngularVelocityY, + ""AngularVelocityZ"" = :AngularVelocityZ, ""AccelerationX"" = :AccelerationX, ""AccelerationY"" = :AccelerationY, + ""AccelerationZ"" = :AccelerationZ, ""RotationX"" = :RotationX, ""RotationY"" = :RotationY, ""RotationZ"" = :RotationZ, ""RotationW"" = :RotationW, + ""SitTargetOffsetX"" = :SitTargetOffsetX, ""SitTargetOffsetY"" = :SitTargetOffsetY, ""SitTargetOffsetZ"" = :SitTargetOffsetZ, + ""SitTargetOrientW"" = :SitTargetOrientW, ""SitTargetOrientX"" = :SitTargetOrientX, ""SitTargetOrientY"" = :SitTargetOrientY, + ""SitTargetOrientZ"" = :SitTargetOrientZ, ""RegionUUID"" = :RegionUUID, ""CreatorID"" = :CreatorID, ""OwnerID"" = :OwnerID, ""GroupID"" = :GroupID, + ""LastOwnerID"" = :LastOwnerID, ""SceneGroupID"" = :SceneGroupID, ""PayPrice"" = :PayPrice, ""PayButton1"" = :PayButton1, ""PayButton2"" = :PayButton2, + ""PayButton3"" = :PayButton3, ""PayButton4"" = :PayButton4, ""LoopedSound"" = :LoopedSound, ""LoopedSoundGain"" = :LoopedSoundGain, + ""TextureAnimation"" = :TextureAnimation, ""OmegaX"" = :OmegaX, ""OmegaY"" = :OmegaY, ""OmegaZ"" = :OmegaZ, ""CameraEyeOffsetX"" = :CameraEyeOffsetX, + ""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX, + ""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook, + ""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice, + ""SaleType"" = :SaleType, ""ColorR"" = :ColorR, ""ColorG"" = :ColorG, ""ColorB"" = :ColorB, ""ColorA"" = :ColorA, ""ParticleSystem"" = :ParticleSystem, ""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches, ""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, ""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution WHERE ""UUID"" = :UUID ; - INSERT INTO + INSERT INTO prims ( ""UUID"", ""CreationDate"", ""Name"", ""Text"", ""Description"", ""SitName"", ""TouchName"", ""ObjectFlags"", ""OwnerMask"", ""NextOwnerMask"", ""GroupMask"", - ""EveryoneMask"", ""BaseMask"", ""PositionX"", ""PositionY"", ""PositionZ"", ""GroupPositionX"", ""GroupPositionY"", ""GroupPositionZ"", ""VelocityX"", - ""VelocityY"", ""VelocityZ"", ""AngularVelocityX"", ""AngularVelocityY"", ""AngularVelocityZ"", ""AccelerationX"", ""AccelerationY"", ""AccelerationZ"", - ""RotationX"", ""RotationY"", ""RotationZ"", ""RotationW"", ""SitTargetOffsetX"", ""SitTargetOffsetY"", ""SitTargetOffsetZ"", ""SitTargetOrientW"", - ""SitTargetOrientX"", ""SitTargetOrientY"", ""SitTargetOrientZ"", ""RegionUUID"", ""CreatorID"", ""OwnerID"", ""GroupID"", ""LastOwnerID"", ""SceneGroupID"", - ""PayPrice"", ""PayButton1"", ""PayButton2"", ""PayButton3"", ""PayButton4"", ""LoopedSound"", ""LoopedSoundGain"", ""TextureAnimation"", ""OmegaX"", - ""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"", - ""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"", + ""EveryoneMask"", ""BaseMask"", ""PositionX"", ""PositionY"", ""PositionZ"", ""GroupPositionX"", ""GroupPositionY"", ""GroupPositionZ"", ""VelocityX"", + ""VelocityY"", ""VelocityZ"", ""AngularVelocityX"", ""AngularVelocityY"", ""AngularVelocityZ"", ""AccelerationX"", ""AccelerationY"", ""AccelerationZ"", + ""RotationX"", ""RotationY"", ""RotationZ"", ""RotationW"", ""SitTargetOffsetX"", ""SitTargetOffsetY"", ""SitTargetOffsetZ"", ""SitTargetOrientW"", + ""SitTargetOrientX"", ""SitTargetOrientY"", ""SitTargetOrientZ"", ""RegionUUID"", ""CreatorID"", ""OwnerID"", ""GroupID"", ""LastOwnerID"", ""SceneGroupID"", + ""PayPrice"", ""PayButton1"", ""PayButton2"", ""PayButton3"", ""PayButton4"", ""LoopedSound"", ""LoopedSoundGain"", ""TextureAnimation"", ""OmegaX"", + ""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"", + ""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"", ""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"", ""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"" - ) Select - :UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask, - :EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX, - :VelocityY, :VelocityZ, :AngularVelocityX, :AngularVelocityY, :AngularVelocityZ, :AccelerationX, :AccelerationY, :AccelerationZ, - :RotationX, :RotationY, :RotationZ, :RotationW, :SitTargetOffsetX, :SitTargetOffsetY, :SitTargetOffsetZ, :SitTargetOrientW, - :SitTargetOrientX, :SitTargetOrientY, :SitTargetOrientZ, :RegionUUID, :CreatorID, :OwnerID, :GroupID, :LastOwnerID, :SceneGroupID, - :PayPrice, :PayButton1, :PayButton2, :PayButton3, :PayButton4, :LoopedSound, :LoopedSoundGain, :TextureAnimation, :OmegaX, - :OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ, - :ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA, + ) Select + :UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask, + :EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX, + :VelocityY, :VelocityZ, :AngularVelocityX, :AngularVelocityY, :AngularVelocityZ, :AccelerationX, :AccelerationY, :AccelerationZ, + :RotationX, :RotationY, :RotationZ, :RotationW, :SitTargetOffsetX, :SitTargetOffsetY, :SitTargetOffsetZ, :SitTargetOrientW, + :SitTargetOrientX, :SitTargetOrientY, :SitTargetOrientZ, :RegionUUID, :CreatorID, :OwnerID, :GroupID, :LastOwnerID, :SceneGroupID, + :PayPrice, :PayButton1, :PayButton2, :PayButton3, :PayButton4, :LoopedSound, :LoopedSoundGain, :TextureAnimation, :OmegaX, + :OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ, + :ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA, :ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs, :PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID); @@ -401,26 +401,26 @@ namespace OpenSim.Data.PGSQL private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) { //Big query to or insert or update primshapes - + string queryPrimShapes = @" - UPDATE primshapes SET - ""Shape"" = :Shape, ""ScaleX"" = :ScaleX, ""ScaleY"" = :ScaleY, ""ScaleZ"" = :ScaleZ, ""PCode"" = :PCode, ""PathBegin"" = :PathBegin, - ""PathEnd"" = :PathEnd, ""PathScaleX"" = :PathScaleX, ""PathScaleY"" = :PathScaleY, ""PathShearX"" = :PathShearX, ""PathShearY"" = :PathShearY, - ""PathSkew"" = :PathSkew, ""PathCurve"" = :PathCurve, ""PathRadiusOffset"" = :PathRadiusOffset, ""PathRevolutions"" = :PathRevolutions, - ""PathTaperX"" = :PathTaperX, ""PathTaperY"" = :PathTaperY, ""PathTwist"" = :PathTwist, ""PathTwistBegin"" = :PathTwistBegin, - ""ProfileBegin"" = :ProfileBegin, ""ProfileEnd"" = :ProfileEnd, ""ProfileCurve"" = :ProfileCurve, ""ProfileHollow"" = :ProfileHollow, + UPDATE primshapes SET + ""Shape"" = :Shape, ""ScaleX"" = :ScaleX, ""ScaleY"" = :ScaleY, ""ScaleZ"" = :ScaleZ, ""PCode"" = :PCode, ""PathBegin"" = :PathBegin, + ""PathEnd"" = :PathEnd, ""PathScaleX"" = :PathScaleX, ""PathScaleY"" = :PathScaleY, ""PathShearX"" = :PathShearX, ""PathShearY"" = :PathShearY, + ""PathSkew"" = :PathSkew, ""PathCurve"" = :PathCurve, ""PathRadiusOffset"" = :PathRadiusOffset, ""PathRevolutions"" = :PathRevolutions, + ""PathTaperX"" = :PathTaperX, ""PathTaperY"" = :PathTaperY, ""PathTwist"" = :PathTwist, ""PathTwistBegin"" = :PathTwistBegin, + ""ProfileBegin"" = :ProfileBegin, ""ProfileEnd"" = :ProfileEnd, ""ProfileCurve"" = :ProfileCurve, ""ProfileHollow"" = :ProfileHollow, ""Texture"" = :Texture, ""ExtraParams"" = :ExtraParams, ""State"" = :State, ""Media"" = :Media WHERE ""UUID"" = :UUID ; - INSERT INTO + INSERT INTO primshapes ( - ""UUID"", ""Shape"", ""ScaleX"", ""ScaleY"", ""ScaleZ"", ""PCode"", ""PathBegin"", ""PathEnd"", ""PathScaleX"", ""PathScaleY"", ""PathShearX"", ""PathShearY"", - ""PathSkew"", ""PathCurve"", ""PathRadiusOffset"", ""PathRevolutions"", ""PathTaperX"", ""PathTaperY"", ""PathTwist"", ""PathTwistBegin"", ""ProfileBegin"", + ""UUID"", ""Shape"", ""ScaleX"", ""ScaleY"", ""ScaleZ"", ""PCode"", ""PathBegin"", ""PathEnd"", ""PathScaleX"", ""PathScaleY"", ""PathShearX"", ""PathShearY"", + ""PathSkew"", ""PathCurve"", ""PathRadiusOffset"", ""PathRevolutions"", ""PathTaperX"", ""PathTaperY"", ""PathTwist"", ""PathTwistBegin"", ""ProfileBegin"", ""ProfileEnd"", ""ProfileCurve"", ""ProfileHollow"", ""Texture"", ""ExtraParams"", ""State"", ""Media"" - ) + ) Select - :UUID, :Shape, :ScaleX, :ScaleY, :ScaleZ, :PCode, :PathBegin, :PathEnd, :PathScaleX, :PathScaleY, :PathShearX, :PathShearY, - :PathSkew, :PathCurve, :PathRadiusOffset, :PathRevolutions, :PathTaperX, :PathTaperY, :PathTwist, :PathTwistBegin, :ProfileBegin, + :UUID, :Shape, :ScaleX, :ScaleY, :ScaleZ, :PCode, :PathBegin, :PathEnd, :PathScaleX, :PathScaleY, :PathShearX, :PathShearY, + :PathSkew, :PathCurve, :PathRadiusOffset, :PathRevolutions, :PathTaperX, :PathTaperY, :PathTwist, :PathTwistBegin, :ProfileBegin, :ProfileEnd, :ProfileCurve, :ProfileHollow, :Texture, :ExtraParams, :State, :Media where not EXISTS (SELECT ""UUID"" FROM primshapes WHERE ""UUID"" = :UUID); "; @@ -500,7 +500,7 @@ namespace OpenSim.Data.PGSQL sql = @"INSERT INTO primitems ( ""itemID"",""primID"",""assetID"",""parentFolderID"",""invType"",""assetType"",""name"",""description"",""creationDate"",""creatorID"",""ownerID"",""lastOwnerID"",""groupID"", - ""nextPermissions"",""currentPermissions"",""basePermissions"",""everyonePermissions"",""groupPermissions"",""flags"") + ""nextPermissions"",""currentPermissions"",""basePermissions"",""everyonePermissions"",""groupPermissions"",""flags"") VALUES (:itemID,:primID,:assetID,:parentFolderID,:invType,:assetType,:name,:description,:creationDate,:creatorID,:ownerID, :lastOwnerID,:groupID,:nextPermissions,:currentPermissions,:basePermissions,:everyonePermissions,:groupPermissions,:flags)"; @@ -538,7 +538,7 @@ namespace OpenSim.Data.PGSQL { TerrainData terrData = null; - string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from terrain + string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from terrain where ""RegionUUID"" = :RegionUUID order by ""Revision"" desc limit 1; "; using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) @@ -577,7 +577,7 @@ namespace OpenSim.Data.PGSQL { TerrainData terrData = null; - string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain + string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain where ""RegionUUID"" = :RegionUUID; "; using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) @@ -1319,7 +1319,7 @@ namespace OpenSim.Data.PGSQL { { string sql = "DELETE FROM regionenvironment WHERE region_id = :region_id ;"; - + using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) { @@ -1420,17 +1420,17 @@ namespace OpenSim.Data.PGSQL { //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB sql = - @"UPDATE regionsettings SET block_terraform = :block_terraform ,block_fly = :block_fly ,allow_damage = :allow_damage -,restrict_pushing = :restrict_pushing ,allow_land_resell = :allow_land_resell ,allow_land_join_divide = :allow_land_join_divide -,block_show_in_search = :block_show_in_search ,agent_limit = :agent_limit ,object_bonus = :object_bonus ,maturity = :maturity -,disable_scripts = :disable_scripts ,disable_collisions = :disable_collisions ,disable_physics = :disable_physics -,terrain_texture_1 = :terrain_texture_1 ,terrain_texture_2 = :terrain_texture_2 ,terrain_texture_3 = :terrain_texture_3 -,terrain_texture_4 = :terrain_texture_4 ,elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw -,elevation_1_ne = :elevation_1_ne ,elevation_2_ne = :elevation_2_ne ,elevation_1_se = :elevation_1_se ,elevation_2_se = :elevation_2_se -,elevation_1_sw = :elevation_1_sw ,elevation_2_sw = :elevation_2_sw ,water_height = :water_height ,terrain_raise_limit = :terrain_raise_limit -,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position -,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz, -""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID, + @"UPDATE regionsettings SET block_terraform = :block_terraform ,block_fly = :block_fly ,allow_damage = :allow_damage +,restrict_pushing = :restrict_pushing ,allow_land_resell = :allow_land_resell ,allow_land_join_divide = :allow_land_join_divide +,block_show_in_search = :block_show_in_search ,agent_limit = :agent_limit ,object_bonus = :object_bonus ,maturity = :maturity +,disable_scripts = :disable_scripts ,disable_collisions = :disable_collisions ,disable_physics = :disable_physics +,terrain_texture_1 = :terrain_texture_1 ,terrain_texture_2 = :terrain_texture_2 ,terrain_texture_3 = :terrain_texture_3 +,terrain_texture_4 = :terrain_texture_4 ,elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw +,elevation_1_ne = :elevation_1_ne ,elevation_2_ne = :elevation_2_ne ,elevation_1_se = :elevation_1_se ,elevation_2_se = :elevation_2_se +,elevation_1_sw = :elevation_1_sw ,elevation_2_sw = :elevation_2_sw ,water_height = :water_height ,terrain_raise_limit = :terrain_raise_limit +,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position +,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz, +""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID, ""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID WHERE ""regionUUID"" = :regionUUID"; @@ -1465,13 +1465,13 @@ namespace OpenSim.Data.PGSQL elevation_2_ne,elevation_1_se,elevation_2_se,elevation_1_sw,elevation_2_sw,water_height,terrain_raise_limit, terrain_lower_limit,use_estate_sun,fixed_sun,sun_position,covenant,covenant_datetime,sunvectorx, sunvectory, sunvectorz, ""Sandbox"", loaded_creation_datetime, loaded_creation_id - ) + ) VALUES (:regionUUID,:block_terraform,:block_fly,:allow_damage,:restrict_pushing,:allow_land_resell,:allow_land_join_divide, :block_show_in_search,:agent_limit,:object_bonus,:maturity,:disable_scripts,:disable_collisions,:disable_physics, :terrain_texture_1,:terrain_texture_2,:terrain_texture_3,:terrain_texture_4,:elevation_1_nw,:elevation_2_nw,:elevation_1_ne, :elevation_2_ne,:elevation_1_se,:elevation_2_se,:elevation_1_sw,:elevation_2_sw,:water_height,:terrain_raise_limit, - :terrain_lower_limit,:use_estate_sun,:fixed_sun,:sun_position,:covenant, :covenant_datetime, :sunvectorx,:sunvectory, + :terrain_lower_limit,:use_estate_sun,:fixed_sun,:sun_position,:covenant, :covenant_datetime, :sunvectorx,:sunvectory, :sunvectorz, :Sandbox, :loaded_creation_datetime, :loaded_creation_id )"; using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) @@ -1626,7 +1626,7 @@ namespace OpenSim.Data.PGSQL newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); - + newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]); newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]); newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]); @@ -1789,7 +1789,7 @@ namespace OpenSim.Data.PGSQL if (!(primRow["DynAttrs"] is System.DBNull) && (string)primRow["DynAttrs"] != "") prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]); else - prim.DynAttrs = new DAMap(); + prim.DynAttrs = new DAMap(); prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]); prim.Density = Convert.ToSingle(primRow["Density"]); @@ -2195,17 +2195,17 @@ namespace OpenSim.Data.PGSQL parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); - + parameters.Add(_Database.CreateParameter("PassTouches", prim.PassTouches)); parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); - + if (prim.DynAttrs.CountNamespaces > 0) parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); else parameters.Add(_Database.CreateParameter("DynAttrs", null)); - + parameters.Add(_Database.CreateParameter("PhysicsShapeType", prim.PhysicsShapeType)); parameters.Add(_Database.CreateParameter("Density", (double)prim.Density)); parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier)); diff --git a/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs b/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs index a2b5a2a..64cfff0 100644 --- a/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs +++ b/OpenSim/Data/PGSQL/PGSQLUserAccountData.cs @@ -42,13 +42,13 @@ namespace OpenSim.Data.PGSQL { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + public PGSQLUserAccountData(string connectionString, string realm) : base(connectionString, realm, "UserAccount") { } - - /* + + /* private string m_Realm; private List m_ColumnNames = null; private PGSQLManager m_database; @@ -122,7 +122,7 @@ namespace OpenSim.Data.PGSQL { cmd.Parameters.Add(m_database.CreateParameter("principalID", principalID)); cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); - + conn.Open(); using (NpgsqlDataReader result = cmd.ExecuteReader()) { @@ -158,8 +158,8 @@ namespace OpenSim.Data.PGSQL } return null; } - - + + public override bool Store(UserAccountData data) { if (data.Data.ContainsKey("PrincipalID")) @@ -214,7 +214,7 @@ namespace OpenSim.Data.PGSQL catch (Exception e){ m_log.ErrorFormat("[USER]: ERROR opened update user {0} ", e.Message); } - + if (conta < 1) { @@ -242,14 +242,14 @@ namespace OpenSim.Data.PGSQL } return true; } - + public bool Store(UserAccountData data, UUID principalID, string token) { return false; } - + public bool SetDataItem(UUID principalID, string item, string value) { string sql = string.Format(@"update {0} set {1} = :{1} where ""UUID"" = :UUID", m_Realm, item); @@ -299,7 +299,7 @@ namespace OpenSim.Data.PGSQL string sql = ""; UUID scope_id; - UUID.TryParse(scopeID.ToString(), out scope_id); + UUID.TryParse(scopeID.ToString(), out scope_id); using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) using (NpgsqlCommand cmd = new NpgsqlCommand()) diff --git a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs index f166976..75a51e2 100644 --- a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs +++ b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs @@ -412,15 +412,15 @@ namespace OpenSim.Data.PGSQL query = @"WITH upsert AS ( UPDATE userpicks SET pickuuid = :PickId, creatoruuid = :CreatorId, toppick = :TopPick, parceluuid = :ParcelId, - name = :Name, description = :Desc, snapshotuuid = :SnapshotId, ""user"" = :User, - originalname = :Original, simname = :SimName, posglobal = :GlobalPos, - sortorder = :SortOrder, enabled = :Enabled - RETURNING * ) + name = :Name, description = :Desc, snapshotuuid = :SnapshotId, ""user"" = :User, + originalname = :Original, simname = :SimName, posglobal = :GlobalPos, + sortorder = :SortOrder, enabled = :Enabled + RETURNING * ) INSERT INTO userpicks (pickuuid,creatoruuid,toppick,parceluuid,name,description, - snapshotuuid,""user"",originalname,simname,posglobal,sortorder,enabled) + snapshotuuid,""user"",originalname,simname,posglobal,sortorder,enabled) SELECT :PickId,:CreatorId,:TopPick,:ParcelId,:Name,:Desc,:SnapshotId,:User, - :Original,:SimName,:GlobalPos,:SortOrder,:Enabled + :Original,:SimName,:GlobalPos,:SortOrder,:Enabled WHERE NOT EXISTS ( SELECT * FROM upsert )"; diff --git a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs index d3518cf..6e88489 100644 --- a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs @@ -141,7 +141,7 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand( @"SELECT name, description, access_time, ""AssetType"", local, temporary, asset_flags, creatorid, data - FROM XAssetsMeta + FROM XAssetsMeta JOIN XAssetsData ON XAssetsMeta.hash = XAssetsData.Hash WHERE id=:ID", dbcon)) { @@ -179,7 +179,7 @@ namespace OpenSim.Data.PGSQL WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); // int compressedLength = asset.Data.Length; asset.Data = outputStream.ToArray(); - + // m_log.DebugFormat( // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", // asset.ID, asset.Name, asset.Data.Length, compressedLength); @@ -223,16 +223,16 @@ namespace OpenSim.Data.PGSQL { assetName = asset.Name.Substring(0, 64); 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); } - + string assetDescription = asset.Description; if (asset.Description.Length > 64) { assetDescription = asset.Description.Substring(0, 64); 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); } @@ -268,8 +268,8 @@ namespace OpenSim.Data.PGSQL where not exists( Select id from XAssetsMeta where id = :ID); update XAssetsMeta - set id = :ID, hash = :Hash, name = :Name, description = :Description, - ""AssetType"" = :AssetType, local = :Local, temporary = :Temporary, create_time = :CreateTime, + set id = :ID, hash = :Hash, name = :Name, description = :Description, + ""AssetType"" = :AssetType, local = :Local, temporary = :Temporary, create_time = :CreateTime, access_time = :AccessTime, asset_flags = :AssetFlags, creatorid = :CreatorID where id = :ID; ", @@ -321,13 +321,13 @@ namespace OpenSim.Data.PGSQL { m_log.ErrorFormat("[XASSET DB]: PGSQL failure creating asset data {0} with name \"{1}\". Error: {2}", asset.FullID, asset.Name, e.Message); - + transaction.Rollback(); - + return; } } - + transaction.Commit(); } } @@ -374,7 +374,7 @@ namespace OpenSim.Data.PGSQL catch (Exception e) { m_log.ErrorFormat( - "[XASSET PGSQL DB]: Failure updating access_time for asset {0} with name {1} : {2}", + "[XASSET PGSQL DB]: Failure updating access_time for asset {0} with name {1} : {2}", assetMetadata.ID, assetMetadata.Name, e.Message); } } @@ -519,7 +519,7 @@ namespace OpenSim.Data.PGSQL { dbcon.Open(); using(NpgsqlCommand cmd = new NpgsqlCommand(@"SELECT name, description, access_time, ""AssetType"", temporary, id, asset_flags, creatorid - FROM XAssetsMeta + FROM XAssetsMeta LIMIT :start, :count",dbcon)) { cmd.Parameters.Add(m_database.CreateParameter("start",start)); diff --git a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs index 959c2cf..55a1996 100644 --- a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs +++ b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs @@ -197,16 +197,16 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand()) { /* - cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" - from inventoryitems - where ""avatarID"" = :PrincipalID - and ""assetID"" = :AssetID + cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" + from inventoryitems + where ""avatarID"" = :PrincipalID + and ""assetID"" = :AssetID group by ""assetID"" ", m_Realm); */ - cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" - from inventoryitems + cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" + from inventoryitems where ""avatarID""::uuid = :PrincipalID - and ""assetID"" = :AssetID + and ""assetID"" = :AssetID group by ""assetID"" "); cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID)); diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 9c2bd2e..966d0b8 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -138,7 +138,7 @@ namespace OpenSim.Data.SQLite { assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( - "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", + "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } @@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLite { assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( - "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", + "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); } diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs index 0428c11..8fb955c 100644 --- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs +++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs @@ -45,7 +45,7 @@ namespace OpenSim.Data.SQLite public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private string m_Realm; private List m_ColumnNames; private int m_LastExpire; @@ -223,7 +223,7 @@ namespace OpenSim.Data.SQLite if (System.Environment.TickCount - m_LastExpire > 30000) DoExpire(); - using (SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() + + using (SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() + "', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))")) { if (ExecuteNonQuery(cmd, m_Connection) > 0) @@ -238,7 +238,7 @@ namespace OpenSim.Data.SQLite if (System.Environment.TickCount - m_LastExpire > 30000) DoExpire(); - using (SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() + + using (SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')")) { if (ExecuteNonQuery(cmd, m_Connection) > 0) diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index d51f2d4..0fcab21 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs @@ -190,7 +190,7 @@ namespace OpenSim.Data.SQLite IDataReader r = null; using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) - { + { names.Remove("EstateID"); string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")"; @@ -386,15 +386,15 @@ namespace OpenSim.Data.SQLite return DoLoad(cmd, UUID.Zero, false); } } - + public List LoadEstateSettingsAll() { List estateSettings = new List(); - + List estateIds = GetEstatesAll(); foreach (int estateId in estateIds) estateSettings.Add(LoadEstateSettings(estateId)); - + return estateSettings; } @@ -421,7 +421,7 @@ namespace OpenSim.Data.SQLite return result; } - + public List GetEstatesAll() { List result = new List(); @@ -442,7 +442,7 @@ namespace OpenSim.Data.SQLite } r.Close(); - return result; + return result; } public List GetEstatesByOwner(UUID ownerID) diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs index 9fbeb10..a4b84b1 100644 --- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs +++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs @@ -189,7 +189,7 @@ namespace OpenSim.Data.SQLite m_Fields[name].SetValue(row, reader[name]); } } - + if (m_DataField != null) { Dictionary data = @@ -268,7 +268,7 @@ namespace OpenSim.Data.SQLite public virtual bool Delete(string field, string key) { return Delete(new string[] { field }, new string[] { key }); - } + } public virtual bool Delete(string[] fields, string[] keys) { diff --git a/OpenSim/Data/SQLite/SQLiteGridUserData.cs b/OpenSim/Data/SQLite/SQLiteGridUserData.cs index d8c52f8..987240c 100644 --- a/OpenSim/Data/SQLite/SQLiteGridUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteGridUserData.cs @@ -43,7 +43,7 @@ namespace OpenSim.Data.SQLite { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public SQLiteGridUserData(string connectionString, string realm) + public SQLiteGridUserData(string connectionString, string realm) : base(connectionString, realm, "GridUserStore") {} public new GridUserData Get(string userID) diff --git a/OpenSim/Data/SQLite/SQLiteHGTravelData.cs b/OpenSim/Data/SQLite/SQLiteHGTravelData.cs index db288b2..dd34710 100644 --- a/OpenSim/Data/SQLite/SQLiteHGTravelData.cs +++ b/OpenSim/Data/SQLite/SQLiteHGTravelData.cs @@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public SQLiteHGTravelData(string connectionString, string realm) + public SQLiteHGTravelData(string connectionString, string realm) : base(connectionString, realm, "HGTravelStore") {} public HGTravelingData Get(UUID sessionID) diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 5cfc202..eec386f 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -707,7 +707,7 @@ namespace OpenSim.Data.SQLite DataRow[] primsForRegion = prims.Select(byRegion); // m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); - // First, create all groups + // First, create all groups foreach (DataRow primRow in primsForRegion) { try @@ -733,12 +733,12 @@ namespace OpenSim.Data.SQLite } SceneObjectGroup group = new SceneObjectGroup(prim); - + createdObjects.Add(group.UUID, group); retvals.Add(group); LoadItems(prim); - + } } catch (Exception e) @@ -1298,7 +1298,7 @@ namespace OpenSim.Data.SQLite createCol(prims, "VolumeDetect", typeof(Int16)); createCol(prims, "MediaURL", typeof(String)); - + createCol(prims, "AttachedPosX", typeof(Double)); createCol(prims, "AttachedPosY", typeof(Double)); createCol(prims, "AttachedPosZ", typeof(Double)); @@ -1795,7 +1795,7 @@ namespace OpenSim.Data.SQLite // m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); prim.MediaUrl = (string)row["MediaURL"]; } - + prim.AttachedPos = new Vector3( Convert.ToSingle(row["AttachedPosX"]), Convert.ToSingle(row["AttachedPosY"]), @@ -1806,7 +1806,7 @@ namespace OpenSim.Data.SQLite { //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType()); prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); - } + } else { prim.DynAttrs = new DAMap(); @@ -1818,7 +1818,7 @@ namespace OpenSim.Data.SQLite prim.Friction = Convert.ToSingle(row["Friction"]); prim.Restitution = Convert.ToSingle(row["Restitution"]); - + if (!(row["KeyframeMotion"] is DBNull)) { Byte[] data = (byte[])row["KeyframeMotion"]; @@ -2532,7 +2532,7 @@ namespace OpenSim.Data.SQLite if (!(row["Media"] is System.DBNull)) s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); - + return s; } diff --git a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs index 91d62ce..1b79185 100644 --- a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs @@ -75,7 +75,7 @@ namespace OpenSim.Data.SQLite } else { - cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')", + cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')", m_Realm, scopeID.ToString(), words[0], words[1]); } diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs index 2dfdba3..13aac79 100644 --- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs @@ -46,43 +46,43 @@ namespace OpenSim.Data.SQLite { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private SqliteConnection m_connection; private string m_connectionString; - + private Dictionary m_FieldMap = new Dictionary(); - + protected virtual Assembly Assembly { get { return GetType().Assembly; } } - + public SQLiteUserProfilesData() { } - + public SQLiteUserProfilesData(string connectionString) { Initialise(connectionString); } - + public void Initialise(string connectionString) { if (Util.IsWindows()) Util.LoadArchSpecificWindowsDll("sqlite3.dll"); - + m_connectionString = connectionString; - + m_log.Info("[PROFILES_DATA]: Sqlite - connecting: "+m_connectionString); - + m_connection = new SqliteConnection(m_connectionString); m_connection.Open(); - + Migration m = new Migration(m_connection, Assembly, "UserProfiles"); m.Update(); } - + private string[] FieldList { get { return new List(m_FieldMap.Keys).ToArray(); } @@ -123,7 +123,7 @@ namespace OpenSim.Data.SQLite } reader.Close(); - + return data; } public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) @@ -162,21 +162,21 @@ namespace OpenSim.Data.SQLite query += ":ParcelName,"; query += ":Flags,"; query += ":ListingPrice ) "; - + 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); @@ -211,7 +211,7 @@ namespace OpenSim.Data.SQLite cmd.Parameters.AddWithValue(":ParcelName", ad.ParcelName.ToString()); cmd.Parameters.AddWithValue(":Flags", ad.Flags.ToString()); cmd.Parameters.AddWithValue(":ListingPrice", ad.Price.ToString ()); - + cmd.ExecuteNonQuery(); } } @@ -227,17 +227,17 @@ namespace OpenSim.Data.SQLite public bool DeleteClassifiedRecord(UUID recordId) { string query = string.Empty; - + query += "DELETE FROM classifieds WHERE "; query += "classifieduuid = :ClasifiedId"; - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) { cmd.CommandText = query; cmd.Parameters.AddWithValue(":ClassifiedId", recordId.ToString()); - + cmd.ExecuteNonQuery(); } } @@ -254,17 +254,17 @@ namespace OpenSim.Data.SQLite { IDataReader reader = null; string query = string.Empty; - + query += "SELECT * FROM classifieds WHERE "; query += "classifieduuid = :AdId"; - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) { cmd.CommandText = query; cmd.Parameters.AddWithValue(":AdId", ad.ClassifiedId.ToString()); - + using (reader = cmd.ExecuteReader()) { if(reader.Read ()) @@ -299,24 +299,24 @@ namespace OpenSim.Data.SQLite { IDataReader reader = null; string query = string.Empty; - + query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; query += "creatoruuid = :Id"; OSDArray data = new OSDArray(); - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) { cmd.CommandText = query; cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); - + using (reader = cmd.ExecuteReader()) { 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); @@ -336,11 +336,11 @@ namespace OpenSim.Data.SQLite IDataReader reader = null; string query = string.Empty; UserProfilePick pick = new UserProfilePick(); - + query += "SELECT * FROM userpicks WHERE "; query += "creatoruuid = :CreatorId AND "; query += "pickuuid = :PickId"; - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -348,17 +348,17 @@ namespace OpenSim.Data.SQLite cmd.CommandText = query; cmd.Parameters.AddWithValue(":CreatorId", avatarId.ToString()); cmd.Parameters.AddWithValue(":PickId", pickId.ToString()); - + using (reader = cmd.ExecuteReader()) { - + while (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); @@ -385,7 +385,7 @@ namespace OpenSim.Data.SQLite } public bool UpdatePicksRecord(UserProfilePick pick) - { + { string query = string.Empty; query += "INSERT OR REPLACE INTO userpicks ("; @@ -416,7 +416,7 @@ namespace OpenSim.Data.SQLite query += ":GlobalPos,"; query += ":SortOrder,"; query += ":Enabled) "; - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -456,10 +456,10 @@ namespace OpenSim.Data.SQLite public bool DeletePicksRecord(UUID pickId) { string query = string.Empty; - + query += "DELETE FROM userpicks WHERE "; query += "pickuuid = :PickId"; - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -479,15 +479,15 @@ namespace OpenSim.Data.SQLite } public bool GetAvatarNotes(ref UserProfileNotes notes) - { + { IDataReader reader = null; string query = string.Empty; - + query += "SELECT `notes` FROM usernotes WHERE "; query += "useruuid = :Id AND "; query += "targetuuid = :TargetId"; OSDArray data = new OSDArray(); - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -495,7 +495,7 @@ namespace OpenSim.Data.SQLite cmd.CommandText = query; cmd.Parameters.AddWithValue(":Id", notes.UserId.ToString()); cmd.Parameters.AddWithValue(":TargetId", notes.TargetId.ToString()); - + using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { while (reader.Read()) @@ -514,10 +514,10 @@ namespace OpenSim.Data.SQLite } public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) - { + { string query = string.Empty; bool remove; - + if(string.IsNullOrEmpty(note.Notes)) { remove = true; @@ -533,7 +533,7 @@ namespace OpenSim.Data.SQLite query += ":TargetId,"; query += ":Notes )"; } - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -544,7 +544,7 @@ namespace OpenSim.Data.SQLite cmd.Parameters.AddWithValue(":Notes", note.Notes); cmd.Parameters.AddWithValue(":TargetId", note.TargetId.ToString ()); cmd.Parameters.AddWithValue(":UserId", note.UserId.ToString()); - + cmd.ExecuteNonQuery(); } } @@ -561,7 +561,7 @@ namespace OpenSim.Data.SQLite { IDataReader reader = null; string query = string.Empty; - + query += "SELECT * FROM userprofile WHERE "; query += "useruuid = :Id"; @@ -569,7 +569,7 @@ namespace OpenSim.Data.SQLite { cmd.CommandText = query; cmd.Parameters.AddWithValue(":Id", props.UserId.ToString()); - + try { @@ -611,7 +611,7 @@ namespace OpenSim.Data.SQLite props.Language = string.Empty; props.PublishProfile = false; props.PublishMature = false; - + query = "INSERT INTO userprofile ("; query += "useruuid, "; query += "profilePartner, "; @@ -659,7 +659,7 @@ namespace OpenSim.Data.SQLite put.Parameters.AddWithValue(":profileAboutText", props.AboutText); put.Parameters.AddWithValue(":profileFirstImage", props.FirstLifeImageId.ToString()); put.Parameters.AddWithValue(":profileFirstText", props.FirstLifeText); - + put.ExecuteNonQuery(); } } @@ -668,9 +668,9 @@ namespace OpenSim.Data.SQLite } public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) - { + { string query = string.Empty; - + query += "UPDATE userprofile SET "; query += "profileURL=:profileURL, "; query += "profileImage=:image, "; @@ -678,7 +678,7 @@ namespace OpenSim.Data.SQLite query += "profileFirstImage=:firstlifeimage,"; query += "profileFirstText=:firstlifetext "; query += "WHERE useruuid=:uuid"; - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -690,7 +690,7 @@ namespace OpenSim.Data.SQLite cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString()); cmd.Parameters.AddWithValue(":firstlifetext", props.FirstLifeText); cmd.Parameters.AddWithValue(":uuid", props.UserId.ToString()); - + cmd.ExecuteNonQuery(); } } @@ -698,16 +698,16 @@ namespace OpenSim.Data.SQLite { m_log.ErrorFormat("[PROFILES_DATA]" + ": AgentPropertiesUpdate exception {0}", e.Message); - + return false; } return true; } public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) - { + { string query = string.Empty; - + query += "UPDATE userprofile SET "; query += "profileWantToMask=:WantMask, "; query += "profileWantToText=:WantText,"; @@ -715,7 +715,7 @@ namespace OpenSim.Data.SQLite query += "profileSkillsText=:SkillsText, "; query += "profileLanguages=:Languages "; query += "WHERE useruuid=:uuid"; - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -727,7 +727,7 @@ namespace OpenSim.Data.SQLite cmd.Parameters.AddWithValue(":SkillsText", up.SkillsText); cmd.Parameters.AddWithValue(":Languages", up.Language); cmd.Parameters.AddWithValue(":uuid", up.UserId.ToString()); - + cmd.ExecuteNonQuery(); } } @@ -741,17 +741,17 @@ namespace OpenSim.Data.SQLite return true; } - + public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) - { + { string query = string.Empty; - + query += "UPDATE usersettings SET "; query += "imviaemail=:ImViaEmail, "; query += "visible=:Visible, "; query += "email=:EMail "; query += "WHERE useruuid=:uuid"; - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -761,7 +761,7 @@ namespace OpenSim.Data.SQLite cmd.Parameters.AddWithValue(":Visible", pref.Visible); cmd.Parameters.AddWithValue(":EMail", pref.EMail); cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString()); - + cmd.ExecuteNonQuery(); } } @@ -779,20 +779,20 @@ namespace OpenSim.Data.SQLite { IDataReader reader = null; string query = string.Empty; - + query += "SELECT imviaemail,visible,email FROM "; query += "usersettings WHERE "; query += "useruuid = :Id"; - + OSDArray data = new OSDArray(); - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) { cmd.CommandText = query; cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); - + using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if(reader.Read()) @@ -805,13 +805,13 @@ namespace OpenSim.Data.SQLite { query = "INSERT INTO usersettings VALUES "; query += "(:Id,'false','false', :Email)"; - + using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) { put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); put.Parameters.AddWithValue(":Email", pref.EMail); put.ExecuteNonQuery(); - + } } } @@ -831,11 +831,11 @@ namespace OpenSim.Data.SQLite { IDataReader reader = null; string query = string.Empty; - + query += "SELECT * FROM `userdata` WHERE "; query += "UserId = :Id AND "; query += "TagId = :TagId"; - + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -843,7 +843,7 @@ namespace OpenSim.Data.SQLite cmd.CommandText = query; cmd.Parameters.AddWithValue(":Id", props.UserId.ToString()); cmd.Parameters.AddWithValue (":TagId", props.TagId.ToString()); - + using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if(reader.Read()) @@ -858,7 +858,7 @@ namespace OpenSim.Data.SQLite query += ":TagId,"; query += ":DataKey,"; query += ":DataVal) "; - + using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) { put.Parameters.AddWithValue(":Id", props.UserId.ToString()); @@ -882,16 +882,16 @@ namespace OpenSim.Data.SQLite return true; } 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 (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) @@ -918,17 +918,17 @@ namespace OpenSim.Data.SQLite IDataReader reader = null; OSDArray data = new OSDArray(); string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = :Id"; - + // Get classified image assets - - + + try { using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) { cmd.CommandText = query; cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); - + using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { while(reader.Read()) @@ -942,7 +942,7 @@ namespace OpenSim.Data.SQLite { cmd.CommandText = query; cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); - + using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if(reader.Read()) @@ -951,14 +951,14 @@ namespace OpenSim.Data.SQLite } } } - + query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = :Id"; - + using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) { cmd.CommandText = query; cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); - + using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if(reader.Read()) diff --git a/OpenSim/Data/SQLite/SQLiteUtils.cs b/OpenSim/Data/SQLite/SQLiteUtils.cs index ca5861f..1218ebb 100644 --- a/OpenSim/Data/SQLite/SQLiteUtils.cs +++ b/OpenSim/Data/SQLite/SQLiteUtils.cs @@ -49,7 +49,7 @@ namespace OpenSim.Data.SQLite **********************************************************************/ /// - /// + /// /// /// /// @@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLite } /// - /// + /// /// /// Data Table /// @@ -191,7 +191,7 @@ namespace OpenSim.Data.SQLite /// lines for defining SqliteParameters to 2 parameters: /// column name and database type. /// - /// + /// /// /// It assumes certain conventions like :param as the param /// name to replace in parametrized queries, and that source diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index 2a0a8f6..7f44a65 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs @@ -107,7 +107,7 @@ namespace OpenSim.Data.SQLite public bool DeleteItems(string[] fields, string[] vals) { return m_Items.Delete(fields, vals); - } + } public bool MoveItem(string id, string newParent) { @@ -302,7 +302,7 @@ namespace OpenSim.Data.SQLite { // m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID); // Util.PrintCallStack(); - + using (SqliteCommand cmd = new SqliteCommand()) { cmd.CommandText = "update inventoryfolders set version=version+1 where folderID = ?folderID"; diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs index 5982a09..70880cf 100644 --- a/OpenSim/Data/Tests/AssetTests.cs +++ b/OpenSim/Data/Tests/AssetTests.cs @@ -110,7 +110,7 @@ namespace OpenSim.Data.Tests public void T010_StoreReadVerifyAssets() { TestHelpers.InMethod(); - + AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString()); AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString()); AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3.ToString()); @@ -128,7 +128,7 @@ namespace OpenSim.Data.Tests a1.UploadAttempts = 0; a2.UploadAttempts = 0; a3.UploadAttempts = 0; - + AssetBase a1a = m_db.GetAsset(uuid1); a1a.UploadAttempts = 0; Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); @@ -190,7 +190,7 @@ namespace OpenSim.Data.Tests public void T020_CheckForWeirdCreatorID() { TestHelpers.InMethod(); - + // It is expected that eventually the CreatorID might be an arbitrary string (an URI) // rather than a valid UUID (?). This test is to make sure that the database layer does not // attempt to convert CreatorID to GUID, but just passes it both ways as a string. diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index acfebd0..79691e4 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs @@ -41,11 +41,11 @@ using System.Reflection; namespace OpenSim.Data.Tests { - /// This is a base class for testing any Data service for any DBMS. + /// This is a base class for testing any Data service for any DBMS. /// Requires NUnit 2.5 or better (to support the generics). /// /// - /// FIXME: Should extend OpenSimTestCase but compile on mono 2.4.3 currently fails with + /// FIXME: Should extend OpenSimTestCase but compile on mono 2.4.3 currently fails with /// AssetTests`2 : System.MemberAccessException : Cannot create an instance of OpenSim.Data.Tests.AssetTests`2[TConn,TAssetData] because Type.ContainsGenericParameters is true. /// and similar on EstateTests, InventoryTests and RegionTests. /// Runs fine with mono 2.10.8.1, so easiest thing is to wait until min Mono version uplifts. @@ -60,7 +60,7 @@ namespace OpenSim.Data.Tests private TService m_service; private string m_file; - // TODO: Is this in the right place here? + // TODO: Is this in the right place here? // Later: apparently it's not, but does it matter here? // protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -68,7 +68,7 @@ namespace OpenSim.Data.Tests public BasicDataServiceTest() : this("") - { + { } public BasicDataServiceTest(string conn) @@ -226,7 +226,7 @@ namespace OpenSim.Data.Tests } } - /// Clear tables listed as parameters (without dropping them). + /// Clear tables listed as parameters (without dropping them). /// /// protected virtual void ResetMigrations(params string[] stores) @@ -251,7 +251,7 @@ namespace OpenSim.Data.Tests } } - /// Clear tables listed as parameters (without dropping them). + /// Clear tables listed as parameters (without dropping them). /// /// protected virtual void ClearTables(params string[] tables) diff --git a/OpenSim/Data/Tests/DefaultTestConns.cs b/OpenSim/Data/Tests/DefaultTestConns.cs index 7c47bdd..5ad238b 100644 --- a/OpenSim/Data/Tests/DefaultTestConns.cs +++ b/OpenSim/Data/Tests/DefaultTestConns.cs @@ -39,16 +39,16 @@ namespace OpenSim.Data.Tests /// a connection string for testing one of the supported databases. /// The connections must be in the section [TestConnections] with names matching the connection class /// name for the specific database, e.g.: - /// + /// /// [TestConnections] /// MySqlConnection="..." /// SqlConnection="..." /// SqliteConnection="..." - /// + /// /// Note that the conn string may also be set explicitly in the [TestCase()] attribute of test classes /// based on BasicDataServiceTest.cs. /// - + static class DefaultTestConns { private static Dictionary conns = new Dictionary(); @@ -63,8 +63,8 @@ namespace OpenSim.Data.Tests Assembly asm = Assembly.GetExecutingAssembly(); string sType = connType.Name; - // Note: when running from NUnit, the DLL is located in some temp dir, so how do we get - // to the INI file? Ok, so put it into the resources! + // Note: when running from NUnit, the DLL is located in some temp dir, so how do we get + // to the INI file? Ok, so put it into the resources! // string iniName = Path.Combine(Path.GetDirectoryName(asm.Location), "TestDataConnections.ini"); string[] allres = asm.GetManifestResourceNames(); diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs index e2b2d12..cf3f2b4 100644 --- a/OpenSim/Data/Tests/EstateTests.cs +++ b/OpenSim/Data/Tests/EstateTests.cs @@ -100,7 +100,7 @@ namespace OpenSim.Data.Tests public void T010_EstateSettingsSimpleStorage_MinimumParameterSet() { TestHelpers.InMethod(); - + EstateSettingsSimpleStorage( REGION_ID, DataTestUtil.STRING_MIN, @@ -133,7 +133,7 @@ namespace OpenSim.Data.Tests public void T011_EstateSettingsSimpleStorage_MaximumParameterSet() { TestHelpers.InMethod(); - + EstateSettingsSimpleStorage( REGION_ID, DataTestUtil.STRING_MAX(64), @@ -166,7 +166,7 @@ namespace OpenSim.Data.Tests public void T012_EstateSettingsSimpleStorage_AccurateParameterSet() { TestHelpers.InMethod(); - + EstateSettingsSimpleStorage( REGION_ID, DataTestUtil.STRING_MAX(1), @@ -199,7 +199,7 @@ namespace OpenSim.Data.Tests public void T012_EstateSettingsRandomStorage() { TestHelpers.InMethod(); - + // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); new PropertyScrambler() @@ -220,7 +220,7 @@ namespace OpenSim.Data.Tests public void T020_EstateSettingsManagerList() { TestHelpers.InMethod(); - + // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -241,7 +241,7 @@ namespace OpenSim.Data.Tests public void T021_EstateSettingsUserList() { TestHelpers.InMethod(); - + // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -262,7 +262,7 @@ namespace OpenSim.Data.Tests public void T022_EstateSettingsGroupList() { TestHelpers.InMethod(); - + // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -283,7 +283,7 @@ namespace OpenSim.Data.Tests public void T022_EstateSettingsBanList() { TestHelpers.InMethod(); - + // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -310,7 +310,7 @@ namespace OpenSim.Data.Tests #endregion - #region Parametrizable Test Implementations + #region Parametrizable Test Implementations private void EstateSettingsSimpleStorage( UUID regionId, diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs index e4ec5c1..da6e7d4 100644 --- a/OpenSim/Data/Tests/InventoryTests.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs @@ -46,7 +46,7 @@ namespace OpenSim.Data.Tests { [TestFixture(Description = "Inventory store tests (MySQL)")] public class MySqlInventoryTests : InventoryTests - { + { } public class InventoryTests : BasicDataServiceTest @@ -102,7 +102,7 @@ namespace OpenSim.Data.Tests public void T001_LoadEmpty() { TestHelpers.InMethod(); - + Assert.That(db.getInventoryFolder(zero), Is.Null); Assert.That(db.getInventoryFolder(folder1), Is.Null); Assert.That(db.getInventoryFolder(folder2), Is.Null); @@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests public void T010_FolderNonParent() { TestHelpers.InMethod(); - + InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); // the folder will go in db.addInventoryFolder(f1); @@ -134,7 +134,7 @@ namespace OpenSim.Data.Tests public void T011_FolderCreate() { TestHelpers.InMethod(); - + InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); // TODO: this is probably wrong behavior, but is what we have // db.updateInventoryFolder(f1); @@ -159,7 +159,7 @@ namespace OpenSim.Data.Tests public void T012_FolderList() { TestHelpers.InMethod(); - + InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); db.addInventoryFolder(f2); @@ -175,7 +175,7 @@ namespace OpenSim.Data.Tests public void T013_FolderHierarchy() { TestHelpers.InMethod(); - + int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); n = db.getFolderHierarchy(folder1).Count; @@ -190,7 +190,7 @@ namespace OpenSim.Data.Tests public void T014_MoveFolder() { TestHelpers.InMethod(); - + InventoryFolderBase f2 = db.getInventoryFolder(folder2); f2.ParentID = folder3; db.moveInventoryFolder(f2); @@ -206,7 +206,7 @@ namespace OpenSim.Data.Tests public void T015_FolderHierarchy() { TestHelpers.InMethod(); - + Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); @@ -219,7 +219,7 @@ namespace OpenSim.Data.Tests public void T100_NoItems() { TestHelpers.InMethod(); - + Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0))"); @@ -233,7 +233,7 @@ namespace OpenSim.Data.Tests public void T101_CreatItems() { TestHelpers.InMethod(); - + db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); @@ -244,7 +244,7 @@ namespace OpenSim.Data.Tests public void T102_CompareItems() { TestHelpers.InMethod(); - + InventoryItemBase i1 = db.getInventoryItem(item1); InventoryItemBase i2 = db.getInventoryItem(item2); InventoryItemBase i3 = db.getInventoryItem(item3); @@ -263,7 +263,7 @@ namespace OpenSim.Data.Tests public void T103_UpdateItem() { TestHelpers.InMethod(); - + // TODO: probably shouldn't have the ability to have an // owner of an item in a folder not owned by the user @@ -283,7 +283,7 @@ namespace OpenSim.Data.Tests public void T104_RandomUpdateItem() { TestHelpers.InMethod(); - + PropertyScrambler folderScrambler = new PropertyScrambler() .DontScramble(x => x.Owner) @@ -342,7 +342,7 @@ namespace OpenSim.Data.Tests public void T999_StillNull() { TestHelpers.InMethod(); - + // After all tests are run, these should still return no results Assert.That(db.getInventoryFolder(zero), Is.Null); Assert.That(db.getInventoryItem(zero), Is.Null); diff --git a/OpenSim/Data/Tests/PropertyScrambler.cs b/OpenSim/Data/Tests/PropertyScrambler.cs index e0f5862..0d291df 100644 --- a/OpenSim/Data/Tests/PropertyScrambler.cs +++ b/OpenSim/Data/Tests/PropertyScrambler.cs @@ -42,7 +42,7 @@ namespace OpenSim.Data.Tests public class PropertyScrambler { readonly System.Collections.Generic.List membersToNotScramble = new List(); - + private void AddExpressionToNotScrableList(Expression expression) { UnaryExpression unaryExpression = expression as UnaryExpression; diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index e1503d0..4f81594 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -83,7 +83,7 @@ namespace OpenSim.Data.Tests public UUID item3 = UUID.Random(); public static Random random = new Random(); - + public string itemname1 = "item1"; public uint localID = 1; @@ -111,10 +111,10 @@ namespace OpenSim.Data.Tests private void ClearDB() { - string[] reg_tables = new string[] { - "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" + string[] reg_tables = new string[] { + "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" }; - + if (m_rebuildDB) { DropTables(reg_tables); @@ -145,7 +145,7 @@ namespace OpenSim.Data.Tests public void T001_LoadEmpty() { TestHelpers.InMethod(); - + List objs = db.LoadObjects(region1); List objs3 = db.LoadObjects(region3); List land = db.LoadLandObjects(region1); @@ -154,21 +154,21 @@ namespace OpenSim.Data.Tests Assert.That(objs3.Count, Is.EqualTo(0), "Assert.That(objs3.Count, Is.EqualTo(0))"); Assert.That(land.Count, Is.EqualTo(0), "Assert.That(land.Count, Is.EqualTo(0))"); } - + // SOG round trips // * store objects, make sure they save - // * update + // * update [Test] public void T010_StoreSimpleObject() { TestHelpers.InMethod(); - + SceneObjectGroup sog = NewSOG("object1", prim1, region1); SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); // in case the objects don't store - try + try { db.StoreObject(sog, region1); } @@ -177,8 +177,8 @@ namespace OpenSim.Data.Tests m_log.Error(e.ToString()); Assert.Fail(); } - - try + + try { db.StoreObject(sog2, region1); } @@ -190,15 +190,15 @@ namespace OpenSim.Data.Tests // This tests the ADO.NET driver List objs = db.LoadObjects(region1); - + Assert.That(objs.Count, Is.EqualTo(2), "Assert.That(objs.Count, Is.EqualTo(2))"); } - + [Test] public void T011_ObjectNames() { TestHelpers.InMethod(); - + List objs = db.LoadObjects(region1); foreach (SceneObjectGroup sog in objs) { @@ -207,12 +207,12 @@ namespace OpenSim.Data.Tests Assert.That(p.Name, Is.EqualTo(p.Description), "Assert.That(p.Name, Is.EqualTo(p.Description))"); } } - + [Test] public void T012_SceneParts() { TestHelpers.InMethod(); - + UUID tmp0 = UUID.Random(); UUID tmp1 = UUID.Random(); UUID tmp2 = UUID.Random(); @@ -225,10 +225,10 @@ namespace OpenSim.Data.Tests sog.AddPart(p1); sog.AddPart(p2); sog.AddPart(p3); - + SceneObjectPart[] parts = sog.Parts; Assert.That(parts.Length,Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); - + db.StoreObject(sog, newregion); List sogs = db.LoadObjects(newregion); Assert.That(sogs.Count,Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); @@ -236,18 +236,18 @@ namespace OpenSim.Data.Tests SceneObjectPart[] newparts = newsog.Parts; Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); - + Assert.That(newsog.ContainsPart(tmp0), "Assert.That(newsog.ContainsPart(tmp0))"); Assert.That(newsog.ContainsPart(tmp1), "Assert.That(newsog.ContainsPart(tmp1))"); Assert.That(newsog.ContainsPart(tmp2), "Assert.That(newsog.ContainsPart(tmp2))"); Assert.That(newsog.ContainsPart(tmp3), "Assert.That(newsog.ContainsPart(tmp3))"); } - + [Test] public void T013_DatabasePersistency() { TestHelpers.InMethod(); - + // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. @@ -298,7 +298,7 @@ namespace OpenSim.Data.Tests SceneObjectPart sop = new SceneObjectPart(); SceneObjectGroup sog = new SceneObjectGroup(sop); - + sop.RegionHandle = regionh; sop.UUID = uuid; sop.LocalId = localid; @@ -360,10 +360,10 @@ namespace OpenSim.Data.Tests Assert.That(linknum,Is.EqualTo(sop.LinkNum), "Assert.That(linknum,Is.EqualTo(sop.LinkNum))"); Assert.That(clickaction,Is.EqualTo(sop.ClickAction), "Assert.That(clickaction,Is.EqualTo(sop.ClickAction))"); Assert.That(scale,Is.EqualTo(sop.Scale), "Assert.That(scale,Is.EqualTo(sop.Scale))"); - + // This is necessary or object will not be inserted in DB sop.Flags = PrimFlags.None; - + // Inserts group in DB db.StoreObject(sog,region3); List sogs = db.LoadObjects(region3); @@ -372,7 +372,7 @@ namespace OpenSim.Data.Tests db.StoreObject(sog,region3); sogs = db.LoadObjects(region3); Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); - + // Tests if the parameters were inserted correctly SceneObjectPart p = sogs[0].RootPart; @@ -414,12 +414,12 @@ namespace OpenSim.Data.Tests Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd), "Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd))"); Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow), "Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow))"); } - + [Test] public void T014_UpdateObject() { TestHelpers.InMethod(); - + string text1 = "object1 text"; SceneObjectGroup sog = FindSOG("object1", region1); sog.RootPart.Text = text1; @@ -459,7 +459,7 @@ namespace OpenSim.Data.Tests PrimitiveBaseShape pbshap = new PrimitiveBaseShape(); pbshap = PrimitiveBaseShape.Default; Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); - + // Updates the region with new values SceneObjectGroup sog2 = FindSOG("Adam West", region3); Assert.That(sog2,Is.Not.Null); @@ -488,11 +488,11 @@ namespace OpenSim.Data.Tests sog2.RootPart.LinkNum = linknum; sog2.RootPart.ClickAction = clickaction; sog2.RootPart.Scale = scale; - + db.StoreObject(sog2, region3); List sogs = db.LoadObjects(region3); Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); - + SceneObjectGroup retsog = FindSOG("West Adam", region3); Assert.That(retsog,Is.Not.Null); SceneObjectPart p = retsog.RootPart; @@ -519,7 +519,7 @@ namespace OpenSim.Data.Tests Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); } - + /// /// Test storage and retrieval of a scene object with a large number of parts. /// @@ -527,12 +527,12 @@ namespace OpenSim.Data.Tests public void T015_LargeSceneObjects() { TestHelpers.InMethod(); - + UUID id = UUID.Random(); Dictionary mydic = new Dictionary(); SceneObjectGroup sog = NewSOG("Test SOG", id, region4); mydic.Add(sog.RootPart.UUID,sog.RootPart); - for (int i = 0; i < 30; i++) + for (int i = 0; i < 30; i++) { UUID tmp = UUID.Random(); SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); @@ -542,20 +542,20 @@ namespace OpenSim.Data.Tests Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); - + sop.GroupPosition = groupos; sop.RotationOffset = rotoff; sop.OffsetPosition = offset; sop.Velocity = velocity; sop.AngularVelocity = angvelo; sop.Acceleration = accel; - + mydic.Add(tmp,sop); - sog.AddPart(sop); + sog.AddPart(sop); } - + db.StoreObject(sog, region4); - + SceneObjectGroup retsog = FindSOG("Test SOG", region4); SceneObjectPart[] parts = retsog.Parts; for (int i = 0; i < 30; i++) @@ -574,7 +574,7 @@ namespace OpenSim.Data.Tests public void T016_RandomSogWithSceneParts() { TestHelpers.InMethod(); - + PropertyScrambler scrambler = new PropertyScrambler() .DontScramble(x => x.UUID); @@ -634,22 +634,22 @@ namespace OpenSim.Data.Tests SceneObjectGroup sog = FindSOG(name, region1); if (sog == null) { - sog = NewSOG(name, prim1, region1); + sog = NewSOG(name, prim1, region1); db.StoreObject(sog, region1); } return sog; } - + // NOTE: it is a bad practice to rely on some of the previous tests having been run before. // If the tests are run manually, one at a time, each starts with full class init (DB cleared). // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order. // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*! - + [Test] public void T020_PrimInventoryEmpty() { TestHelpers.InMethod(); - + SceneObjectGroup sog = GetMySOG("object1"); TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); Assert.That(t, Is.Null); @@ -673,14 +673,14 @@ namespace OpenSim.Data.Tests public void T021_PrimInventoryBasic() { TestHelpers.InMethod(); - + SceneObjectGroup sog = GetMySOG("object1"); InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); - + StoreInventory(sog); SceneObjectGroup sog1 = FindSOG("object1", region1); @@ -708,12 +708,12 @@ namespace OpenSim.Data.Tests t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); Assert.That(t, Is.Null); } - + [Test] public void T025_PrimInventoryPersistency() { TestHelpers.InMethod(); - + InventoryItemBase i = new InventoryItemBase(); UUID id = UUID.Random(); i.ID = id; @@ -752,11 +752,11 @@ namespace OpenSim.Data.Tests i.Flags = flags; int creationd = random.Next(); i.CreationDate = creationd; - + SceneObjectGroup sog = GetMySOG("object1"); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id); - + Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))"); Assert.That(t.AssetID,Is.EqualTo(assetid), "Assert.That(t.AssetID,Is.EqualTo(assetid))"); Assert.That(t.BasePermissions,Is.EqualTo(baseperm), "Assert.That(t.BasePermissions,Is.EqualTo(baseperm))"); @@ -780,13 +780,13 @@ namespace OpenSim.Data.Tests Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))"); Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))"); } - + [Test] [ExpectedException(typeof(ArgumentException))] public void T026_PrimInventoryMany() { TestHelpers.InMethod(); - + UUID i1,i2,i3,i4; i1 = UUID.Random(); i2 = UUID.Random(); @@ -796,14 +796,14 @@ namespace OpenSim.Data.Tests InventoryItemBase ib2 = NewItem(i2, zero, zero, RandomName(), zero); InventoryItemBase ib3 = NewItem(i3, zero, zero, RandomName(), zero); InventoryItemBase ib4 = NewItem(i4, zero, zero, RandomName(), zero); - + SceneObjectGroup sog = FindSOG("object1", region1); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib1, zero), Is.True); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib2, zero), Is.True); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib3, zero), Is.True); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib4, zero), Is.True); - + TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1); Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))"); TaskInventoryItem t2 = sog.GetInventoryItem(sog.RootPart.LocalId, i2); @@ -818,7 +818,7 @@ namespace OpenSim.Data.Tests public void T052_RemoveObject() { TestHelpers.InMethod(); - + db.RemoveObject(prim1, region1); SceneObjectGroup sog = FindSOG("object1", region1); Assert.That(sog, Is.Null); @@ -828,7 +828,7 @@ namespace OpenSim.Data.Tests public void T100_DefaultRegionInfo() { TestHelpers.InMethod(); - + RegionSettings r1 = db.LoadRegionSettings(region1); Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); @@ -840,7 +840,7 @@ namespace OpenSim.Data.Tests public void T101_UpdateRegionInfo() { TestHelpers.InMethod(); - + int agentlimit = random.Next(); double objectbonus = random.Next(); int maturity = random.Next(); @@ -900,9 +900,9 @@ namespace OpenSim.Data.Tests r1.FixedSun = true; r1.SunPosition = sunpos; r1.Covenant = cov; - + db.StoreRegionSettings(r1); - + RegionSettings r1a = db.LoadRegionSettings(region1); Assert.That(r1a.RegionUUID, Is.EqualTo(region1), "Assert.That(r1a.RegionUUID, Is.EqualTo(region1))"); Assert.That(r1a.BlockTerraform,Is.True); @@ -939,14 +939,14 @@ namespace OpenSim.Data.Tests //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); Assert.That(r1a.FixedSun,Is.True); Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); - Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); + Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); } [Test] public void T300_NoTerrain() { TestHelpers.InMethod(); - + Assert.That(db.LoadTerrain(zero), Is.Null); Assert.That(db.LoadTerrain(region1), Is.Null); Assert.That(db.LoadTerrain(region2), Is.Null); @@ -957,13 +957,13 @@ namespace OpenSim.Data.Tests public void T301_CreateTerrain() { TestHelpers.InMethod(); - + double[,] t1 = GenTerrain(height1); db.StoreTerrain(t1, region1); - + // store terrain is async Thread.Sleep(1000); - + Assert.That(db.LoadTerrain(zero), Is.Null); Assert.That(db.LoadTerrain(region1), Is.Not.Null); Assert.That(db.LoadTerrain(region2), Is.Null); @@ -974,7 +974,7 @@ namespace OpenSim.Data.Tests public void T302_FetchTerrain() { TestHelpers.InMethod(); - + double[,] baseterrain1 = GenTerrain(height1); double[,] baseterrain2 = GenTerrain(height2); double[,] t1 = db.LoadTerrain(region1); @@ -986,7 +986,7 @@ namespace OpenSim.Data.Tests public void T303_UpdateTerrain() { TestHelpers.InMethod(); - + double[,] baseterrain1 = GenTerrain(height1); double[,] baseterrain2 = GenTerrain(height2); db.StoreTerrain(baseterrain2, region1); @@ -1003,7 +1003,7 @@ namespace OpenSim.Data.Tests public void T400_EmptyLand() { TestHelpers.InMethod(); - + Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); @@ -1025,15 +1025,15 @@ namespace OpenSim.Data.Tests for (int x = 0; x < Constants.RegionSize; x++) for (int y = 0; y < Constants.RegionSize; y++) terret[x,y] = value; - + return terret; } - + private bool CompareTerrain(double[,] one, double[,] two) { for (int x = 0; x < Constants.RegionSize; x++) for (int y = 0; y < Constants.RegionSize; y++) - if (one[x,y] != two[x,y]) + if (one[x,y] != two[x,y]) return false; return true; @@ -1053,12 +1053,12 @@ namespace OpenSim.Data.Tests // common failure case is people adding new fields that aren't // initialized, but have non-null db constraints. We should // honestly be passing more and more null things in here. - // - // Please note that in Sqlite.BuildPrim there is a commented out inline version + // + // Please note that in Sqlite.BuildPrim there is a commented out inline version // of this so you can debug and step through the build process and check the fields - // + // // Real World Value: Tests for situation where extending a SceneObjectGroup/SceneObjectPart - // causes the application to crash at the database layer because of null values + // causes the application to crash at the database layer because of null values // in NOT NULL fields // private SceneObjectGroup NewSOG(string name, UUID uuid, UUID regionId) @@ -1082,7 +1082,7 @@ namespace OpenSim.Data.Tests return sog; } - + private SceneObjectPart NewSOP(string name, UUID uuid) { SceneObjectPart sop = new SceneObjectPart(); @@ -1096,7 +1096,7 @@ namespace OpenSim.Data.Tests return sop; } - // These are copied from the Inventory Item tests + // These are copied from the Inventory Item tests private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) { @@ -1114,7 +1114,7 @@ namespace OpenSim.Data.Tests private static string RandomName() { StringBuilder name = new StringBuilder(); - int size = random.Next(5,12); + int size = random.Next(5,12); char ch ; for (int i=0; i