aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-06-01 18:36:26 +0000
committerAdam Frisby2007-06-01 18:36:26 +0000
commitc60166f3c3c73e25a1bd5a2a3e6f0fab0ae738bf (patch)
treeb16d58fb2df82c1cc231d25ca13e42dadcba9e7a
parent* Added /trunk/share (diff)
downloadopensim-SC-c60166f3c3c73e25a1bd5a2a3e6f0fab0ae738bf.zip
opensim-SC-c60166f3c3c73e25a1bd5a2a3e6f0fab0ae738bf.tar.gz
opensim-SC-c60166f3c3c73e25a1bd5a2a3e6f0fab0ae738bf.tar.bz2
opensim-SC-c60166f3c3c73e25a1bd5a2a3e6f0fab0ae738bf.tar.xz
* Completed read-only inventory data operations
* Working on write support
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs160
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs24
2 files changed, 179 insertions, 5 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
index 72c0139..48d8e93 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
@@ -39,27 +39,177 @@ namespace OpenGrid.Framework.Data.MySQL
39 39
40 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) 40 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
41 { 41 {
42 return null; 42 try
43 {
44 lock (database)
45 {
46 Dictionary<string, string> param = new Dictionary<string, string>();
47 param["?uuid"] = folderID.ToStringHyphenated();
48
49 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param);
50 System.Data.IDataReader reader = result.ExecuteReader();
51
52 List<InventoryItemBase> items = database.readInventoryItems(reader);
53
54 reader.Close();
55 result.Dispose();
56
57 return items;
58 }
59 }
60 catch (Exception e)
61 {
62 database.Reconnect();
63 Console.WriteLine(e.ToString());
64 return null;
65 }
43 } 66 }
44 67
45 public List<InventoryFolderBase> getUserRootFolders(LLUUID user) 68 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
46 { 69 {
47 return null; 70 try
71 {
72 lock (database)
73 {
74 Dictionary<string, string> param = new Dictionary<string, string>();
75 param["?uuid"] = user.ToStringHyphenated();
76 param["?zero"] = LLUUID.Zero.ToStringHyphenated();
77
78 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
79 System.Data.IDataReader reader = result.ExecuteReader();
80
81 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
82
83 reader.Close();
84 result.Dispose();
85
86 return items;
87 }
88 }
89 catch (Exception e)
90 {
91 database.Reconnect();
92 Console.WriteLine(e.ToString());
93 return null;
94 }
48 } 95 }
49 96
50 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) 97 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
51 { 98 {
52 return null; 99 try
100 {
101 lock (database)
102 {
103 Dictionary<string, string> param = new Dictionary<string, string>();
104 param["?uuid"] = parentID.ToStringHyphenated();
105
106 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param);
107 System.Data.IDataReader reader = result.ExecuteReader();
108
109 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
110
111 reader.Close();
112 result.Dispose();
113
114 return items;
115 }
116 }
117 catch (Exception e)
118 {
119 database.Reconnect();
120 Console.WriteLine(e.ToString());
121 return null;
122 }
53 } 123 }
54 124
55 public InventoryItemBase getInventoryItem(LLUUID item) 125 public InventoryItemBase getInventoryItem(LLUUID item)
56 { 126 {
57 return null; 127 try
128 {
129 lock (database)
130 {
131 Dictionary<string, string> param = new Dictionary<string, string>();
132 param["?uuid"] = item.ToStringHyphenated();
133
134 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param);
135 System.Data.IDataReader reader = result.ExecuteReader();
136
137 List<InventoryItemBase> items = database.readInventoryItems(reader);
138
139 reader.Close();
140 result.Dispose();
141
142 if (items.Count > 0)
143 {
144 return items[0];
145 }
146 else
147 {
148 return null;
149 }
150 }
151 }
152 catch (Exception e)
153 {
154 database.Reconnect();
155 Console.WriteLine(e.ToString());
156 return null;
157 }
58 } 158 }
59 159
60 public InventoryFolderBase getInventoryFolder(LLUUID folder) 160 public InventoryFolderBase getInventoryFolder(LLUUID folder)
61 { 161 {
62 return null; 162 try
163 {
164 lock (database)
165 {
166 Dictionary<string, string> param = new Dictionary<string, string>();
167 param["?uuid"] = folder.ToStringHyphenated();
168
169 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param);
170 System.Data.IDataReader reader = result.ExecuteReader();
171
172 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
173
174 reader.Close();
175 result.Dispose();
176
177 if (items.Count > 0)
178 {
179 return items[0];
180 }
181 else
182 {
183 return null;
184 }
185 }
186 }
187 catch (Exception e)
188 {
189 database.Reconnect();
190 Console.WriteLine(e.ToString());
191 return null;
192 }
193 }
194
195 public void addInventoryItem(InventoryItemBase item)
196 {
197
198 }
199
200 public void updateInventoryItem(InventoryItemBase item)
201 {
202 addInventoryItem(item);
203 }
204
205 public void addInventoryFolder(InventoryFolderBase folder)
206 {
207
208 }
209
210 public void updateInventoryFolder(InventoryFolderBase folder)
211 {
212 addInventoryFolder(folder);
63 } 213 }
64 } 214 }
65} 215}
diff --git a/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs
index 2b3d826..b43557d 100644
--- a/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs
@@ -84,5 +84,29 @@ namespace OpenGrid.Framework.Data
84 /// <param name="folder">The UUID of the folder to be returned</param> 84 /// <param name="folder">The UUID of the folder to be returned</param>
85 /// <returns>A class containing folder information</returns> 85 /// <returns>A class containing folder information</returns>
86 InventoryFolderBase getInventoryFolder(LLUUID folder); 86 InventoryFolderBase getInventoryFolder(LLUUID folder);
87
88 /// <summary>
89 /// Creates a new inventory item based on item
90 /// </summary>
91 /// <param name="item">The item to be created</param>
92 void addInventoryItem(InventoryItemBase item);
93
94 /// <summary>
95 /// Updates an inventory item with item (updates based on ID)
96 /// </summary>
97 /// <param name="item">The updated item</param>
98 void updateInventoryItem(InventoryItemBase item);
99
100 /// <summary>
101 /// Adds a new folder specified by folder
102 /// </summary>
103 /// <param name="folder">The inventory folder</param>
104 void addInventoryFolder(InventoryFolderBase folder);
105
106 /// <summary>
107 /// Updates a folder based on its ID with folder
108 /// </summary>
109 /// <param name="folder">The inventory folder</param>
110 void updateInventoryFolder(InventoryFolderBase folder);
87 } 111 }
88} 112}