From fe9aea258ff4142e718b4916ccefeeedef229768 Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Wed, 24 Sep 2008 21:12:21 +0000 Subject: Add persistence of active gestures. This needs an UGAIM update to work. Active gestures are sent as part of the login-response. Added fetchActiveGestures to SQLite and MySQL; added an empty one for MSSQL and NHibernate. Using the empty ones won't cause errors, but doesn't provide persistence either, of course. --- OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 5 +++ OpenSim/Data/MySQL/MySQLInventoryData.cs | 36 ++++++++++++++++++++++ OpenSim/Data/NHibernate/NHibernateInventoryData.cs | 5 +++ OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 19 ++++++++++++ 4 files changed, 65 insertions(+) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index 03600e2..2b9913c 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs @@ -798,6 +798,11 @@ namespace OpenSim.Data.MSSQL m_log.Error("[INVENTORY DB] Error deleting folder :" + e.Message); } } + + public List fetchActiveGestures (UUID avatarID) + { + return null; + } #endregion } } diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 50d3cc7..68885e1 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs @@ -795,5 +795,41 @@ namespace OpenSim.Data.MySQL deleteOneFolder(folderID); deleteItemsInFolder(folderID); } + + public List fetchActiveGestures(UUID avatarID) + { + MySqlDataReader result = null; + MySqlCommand sqlCmd = null; + lock (database) + { + try + { + database.CheckConnection(); + sqlCmd = new MySqlCommand( + "SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags = 1", + database.Connection); + sqlCmd.Parameters.AddWithValue("?uuid", avatarID.ToString()); + sqlCmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); + result = sqlCmd.ExecuteReader(); + + List list = new List(); + while (result.Read()) + list.Add(readInventoryItem(result)); + + return list; + } + catch (Exception e) + { + database.Reconnect(); + m_log.Error(e.ToString()); + return null; + } + finally + { + if(result != null) result.Close(); + if(sqlCmd != null) sqlCmd.Dispose(); + } + } + } } } diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs index 20dad1a..bceb5d5 100644 --- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs +++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs @@ -389,5 +389,10 @@ namespace OpenSim.Data.NHibernate return folders; } + + public List fetchActiveGestures (UUID avatarID) + { + return null; + } } } diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 40b61ee..b9fda04 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -847,5 +847,24 @@ namespace OpenSim.Data.SQLite row["UUID"] = Util.ToRawUuidString(folder.ID); row["parentID"] = Util.ToRawUuidString(folder.ParentID); } + + public List fetchActiveGestures (UUID avatarID) + { + lock (ds) + { + List items = new List(); + + DataTable inventoryItemTable = ds.Tables["inventoryitems"]; + string selectExp = "avatarID = '" + Util.ToRawUuidString(avatarID) + "' AND assetType = " + + (int)AssetType.Gesture + " AND flags = 1"; + m_log.DebugFormat("[SQL]: sql = " + selectExp); + DataRow[] rows = inventoryItemTable.Select(selectExp); + foreach (DataRow row in rows) + { + items.Add(buildItem(row)); + } + return items; + } + } } } -- cgit v1.1