aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorMelanie2010-01-04 20:52:44 +0000
committerMelanie2010-01-04 20:53:28 +0000
commit1ae9bfc0746b97f57031f282d4f6721b08c27f0c (patch)
tree859626a5f85201933fd75b6d54400a6db81f9685 /OpenSim/Data
parentFirst stage port of the XInventoryService (diff)
downloadopensim-SC_OLD-1ae9bfc0746b97f57031f282d4f6721b08c27f0c.zip
opensim-SC_OLD-1ae9bfc0746b97f57031f282d4f6721b08c27f0c.tar.gz
opensim-SC_OLD-1ae9bfc0746b97f57031f282d4f6721b08c27f0c.tar.bz2
opensim-SC_OLD-1ae9bfc0746b97f57031f282d4f6721b08c27f0c.tar.xz
Finish conversion if XInventoryService
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/IXInventoryData.cs4
-rw-r--r--OpenSim/Data/MySQL/MySQLXInventoryData.cs55
2 files changed, 52 insertions, 7 deletions
diff --git a/OpenSim/Data/IXInventoryData.cs b/OpenSim/Data/IXInventoryData.cs
index 88174d9..cd9273e 100644
--- a/OpenSim/Data/IXInventoryData.cs
+++ b/OpenSim/Data/IXInventoryData.cs
@@ -77,6 +77,8 @@ namespace OpenSim.Data
77 bool DeleteFolders(string field, string val); 77 bool DeleteFolders(string field, string val);
78 bool DeleteItems(string field, string val); 78 bool DeleteItems(string field, string val);
79 79
80 bool MoveItem(string principalID, string id, string newParent); 80 bool MoveItem(string id, string newParent);
81 XInventoryItem[] GetActiveGestures(UUID principalID);
82 int GetAssetPermissions(UUID principalID, UUID assetID);
81 } 83 }
82} 84}
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
index dd3e6ea..0eebc9c 100644
--- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
@@ -85,9 +85,19 @@ namespace OpenSim.Data.MySQL
85 return m_Items.Delete(field, val); 85 return m_Items.Delete(field, val);
86 } 86 }
87 87
88 public bool MoveItem(string principalID, string id, string newParent) 88 public bool MoveItem(string id, string newParent)
89 { 89 {
90 return m_Items.MoveItem(principalID, id, newParent); 90 return m_Items.MoveItem(id, newParent);
91 }
92
93 public XInventoryItem[] GetActiveGestures(UUID principalID)
94 {
95 return m_Items.GetActiveGestures(principalID);
96 }
97
98 public int GetAssetPermissions(UUID principalID, UUID assetID)
99 {
100 return m_Items.GetAssetPermissions(principalID, assetID);
91 } 101 }
92 } 102 }
93 103
@@ -98,16 +108,49 @@ namespace OpenSim.Data.MySQL
98 { 108 {
99 } 109 }
100 110
101 public bool MoveItem(string principalID, string id, string newParent) 111 public bool MoveItem(string id, string newParent)
102 { 112 {
103 MySqlCommand cmd = new MySqlCommand(); 113 MySqlCommand cmd = new MySqlCommand();
104 114
105 cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where agentID = ?AgentID and folderID = ?FolderID"); 115 cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm);
106 cmd.Parameters.AddWithValue("?ParentFolderID", newParent); 116 cmd.Parameters.AddWithValue("?ParentFolderID", newParent);
107 cmd.Parameters.AddWithValue("?FolderID", id); 117 cmd.Parameters.AddWithValue("?InventoryID", id);
108 cmd.Parameters.AddWithValue("?AgentID", principalID);
109 118
110 return ExecuteNonQuery(cmd) == 0 ? false : true; 119 return ExecuteNonQuery(cmd) == 0 ? false : true;
111 } 120 }
121
122 public XInventoryItem[] GetActiveGestures(UUID principalID)
123 {
124 MySqlCommand cmd = new MySqlCommand();
125 cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags = 1", m_Realm);
126
127 cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
128 cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
129
130 return DoQuery(cmd);
131 }
132
133 public int GetAssetPermissions(UUID principalID, UUID assetID)
134 {
135 MySqlCommand cmd = new MySqlCommand();
136
137 cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
138 cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
139 cmd.Parameters.AddWithValue("?AssetID", assetID.ToString());
140
141 IDataReader reader = ExecuteReader(cmd);
142
143 int perms = 0;
144
145 if (reader.Read())
146 {
147 perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]);
148 }
149
150 reader.Close();
151 CloseReaderCommand(cmd);
152
153 return perms;
154 }
112 } 155 }
113} 156}