aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-04-30 19:29:21 +0100
committerMelanie2010-04-30 19:29:21 +0100
commit23282935f1f25fd44d85193f3c13ea97c755f75c (patch)
tree689d44f5657dd36e74c3b4d4dd508c86ee90cea1 /OpenSim
parentFix a null ref from trying to access a dictionary that was never initialized. (diff)
parent* XInventory fairly tested, including for HG. Almost ready to switch. (diff)
downloadopensim-SC_OLD-23282935f1f25fd44d85193f3c13ea97c755f75c.zip
opensim-SC_OLD-23282935f1f25fd44d85193f3c13ea97c755f75c.tar.gz
opensim-SC_OLD-23282935f1f25fd44d85193f3c13ea97c755f75c.tar.bz2
opensim-SC_OLD-23282935f1f25fd44d85193f3c13ea97c755f75c.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs6
-rw-r--r--OpenSim/Data/SQLite/SQLiteAuthenticationData.cs23
-rw-r--r--OpenSim/Data/SQLite/SQLiteAvatarData.cs8
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs48
-rw-r--r--OpenSim/Data/SQLite/SQLiteFramework.cs14
-rw-r--r--OpenSim/Data/SQLite/SQLiteFriendsData.cs8
-rw-r--r--OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs18
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs13
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs261
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserAccountData.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteUtils.cs2
-rw-r--r--OpenSim/Data/SQLite/SQLiteXInventoryData.cs4
-rw-r--r--OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs (renamed from OpenSim/Data/SQLiteNG/Properties/AssemblyInfo.cs)4
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_AssetStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_AuthStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_Avatar.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_FriendsStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_InventoryStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_UserAccount.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_AssetStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_AuthStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_FriendsStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/002_InventoryStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_InventoryStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_UserAccount.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/003_AssetStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/003_InventoryStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/003_InventoryStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/003_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/003_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/004_AssetStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/004_InventoryStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/004_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/004_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/005_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/005_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/006_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/006_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/007_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/007_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/008_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/008_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/009_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/009_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/010_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/010_UserStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/011_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/012_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/013_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/014_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/015_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/016_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/017_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/018_RegionStore.sql)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/Resources/OpenSim.Data.SQLite.addin.xml (renamed from OpenSim/Data/SQLiteNG/Resources/OpenSim.Data.SQLite.addin.xml)0
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteAssetData.cs)8
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs)25
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs)10
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteEstateData.cs)50
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteFramework.cs)16
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs)10
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs)20
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs)15
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteRegionData.cs)261
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs)6
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteUtils.cs)4
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteXInventoryData.cs)6
-rw-r--r--OpenSim/Data/Tests/DataTestUtil.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs212
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs8
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs104
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs50
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs119
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs2
79 files changed, 564 insertions, 788 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index a032670..636bf86 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -30,7 +30,7 @@ using System.Data;
30using System.Reflection; 30using System.Reflection;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using log4net; 32using log4net;
33using Mono.Data.SqliteClient; 33using Mono.Data.Sqlite;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36 36
@@ -137,7 +137,7 @@ namespace OpenSim.Data.SQLite
137 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); 137 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
138 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); 138 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
139 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 139 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
140 140
141 cmd.ExecuteNonQuery(); 141 cmd.ExecuteNonQuery();
142 } 142 }
143 } 143 }
@@ -340,4 +340,4 @@ namespace OpenSim.Data.SQLite
340 340
341 #endregion 341 #endregion
342 } 342 }
343} \ No newline at end of file 343}
diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
index aa10734..086ac0a 100644
--- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs
@@ -31,7 +31,7 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using Mono.Data.SqliteClient; 34using Mono.Data.Sqlite;
35 35
36namespace OpenSim.Data.SQLite 36namespace OpenSim.Data.SQLite
37{ 37{
@@ -56,13 +56,8 @@ namespace OpenSim.Data.SQLite
56 m_Connection = new SqliteConnection(connectionString); 56 m_Connection = new SqliteConnection(connectionString);
57 m_Connection.Open(); 57 m_Connection.Open();
58 58
59 using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone()) 59 Migration m = new Migration(m_Connection, GetType().Assembly, "AuthStore");
60 { 60 m.Update();
61 dbcon.Open();
62 Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
63 m.Update();
64 dbcon.Close();
65 }
66 61
67 m_initialized = true; 62 m_initialized = true;
68 } 63 }
@@ -113,7 +108,7 @@ namespace OpenSim.Data.SQLite
113 } 108 }
114 finally 109 finally
115 { 110 {
116 CloseCommand(cmd); 111 //CloseCommand(cmd);
117 } 112 }
118 113
119 return null; 114 return null;
@@ -156,14 +151,14 @@ namespace OpenSim.Data.SQLite
156 { 151 {
157 if (ExecuteNonQuery(cmd, m_Connection) < 1) 152 if (ExecuteNonQuery(cmd, m_Connection) < 1)
158 { 153 {
159 CloseCommand(cmd); 154 //CloseCommand(cmd);
160 return false; 155 return false;
161 } 156 }
162 } 157 }
163 catch (Exception e) 158 catch (Exception e)
164 { 159 {
165 Console.WriteLine(e.ToString()); 160 Console.WriteLine(e.ToString());
166 CloseCommand(cmd); 161 //CloseCommand(cmd);
167 return false; 162 return false;
168 } 163 }
169 } 164 }
@@ -184,19 +179,19 @@ namespace OpenSim.Data.SQLite
184 { 179 {
185 if (ExecuteNonQuery(cmd, m_Connection) < 1) 180 if (ExecuteNonQuery(cmd, m_Connection) < 1)
186 { 181 {
187 CloseCommand(cmd); 182 //CloseCommand(cmd);
188 return false; 183 return false;
189 } 184 }
190 } 185 }
191 catch (Exception e) 186 catch (Exception e)
192 { 187 {
193 Console.WriteLine(e.ToString()); 188 Console.WriteLine(e.ToString());
194 CloseCommand(cmd); 189 //CloseCommand(cmd);
195 return false; 190 return false;
196 } 191 }
197 } 192 }
198 193
199 CloseCommand(cmd); 194 //CloseCommand(cmd);
200 195
201 return true; 196 return true;
202 } 197 }
diff --git a/OpenSim/Data/SQLite/SQLiteAvatarData.cs b/OpenSim/Data/SQLite/SQLiteAvatarData.cs
index b3f4a4c..c093884 100644
--- a/OpenSim/Data/SQLite/SQLiteAvatarData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAvatarData.cs
@@ -33,7 +33,7 @@ using System.Threading;
33using log4net; 33using log4net;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using Mono.Data.SqliteClient; 36using Mono.Data.Sqlite;
37 37
38namespace OpenSim.Data.SQLite 38namespace OpenSim.Data.SQLite
39{ 39{
@@ -55,8 +55,8 @@ namespace OpenSim.Data.SQLite
55 SqliteCommand cmd = new SqliteCommand(); 55 SqliteCommand cmd = new SqliteCommand();
56 56
57 cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); 57 cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
58 cmd.Parameters.Add(":PrincipalID", principalID.ToString()); 58 cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
59 cmd.Parameters.Add(":Name", name); 59 cmd.Parameters.AddWithValue(":Name", name);
60 60
61 try 61 try
62 { 62 {
@@ -67,7 +67,7 @@ namespace OpenSim.Data.SQLite
67 } 67 }
68 finally 68 finally
69 { 69 {
70 CloseCommand(cmd); 70 //CloseCommand(cmd);
71 } 71 }
72 } 72 }
73 } 73 }
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index bd6b776..9dd4a2e 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Data.SqliteClient; 33using Mono.Data.Sqlite;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
@@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLite
62 Migration m = new Migration(m_connection, assem, "EstateStore"); 62 Migration m = new Migration(m_connection, assem, "EstateStore");
63 m.Update(); 63 m.Update();
64 64
65 m_connection.Close(); 65 //m_connection.Close();
66 m_connection.Open(); 66 // m_connection.Open();
67 67
68 Type t = typeof(EstateSettings); 68 Type t = typeof(EstateSettings);
69 m_Fields = t.GetFields(BindingFlags.NonPublic | 69 m_Fields = t.GetFields(BindingFlags.NonPublic |
@@ -87,7 +87,7 @@ namespace OpenSim.Data.SQLite
87 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 87 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
88 88
89 cmd.CommandText = sql; 89 cmd.CommandText = sql;
90 cmd.Parameters.Add(":RegionID", regionID.ToString()); 90 cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
91 91
92 return DoLoad(cmd, regionID, create); 92 return DoLoad(cmd, regionID, create);
93 } 93 }
@@ -143,13 +143,13 @@ namespace OpenSim.Data.SQLite
143 if (m_FieldMap[name].GetValue(es) is bool) 143 if (m_FieldMap[name].GetValue(es) is bool)
144 { 144 {
145 if ((bool)m_FieldMap[name].GetValue(es)) 145 if ((bool)m_FieldMap[name].GetValue(es))
146 cmd.Parameters.Add(":"+name, "1"); 146 cmd.Parameters.AddWithValue(":"+name, "1");
147 else 147 else
148 cmd.Parameters.Add(":"+name, "0"); 148 cmd.Parameters.AddWithValue(":"+name, "0");
149 } 149 }
150 else 150 else
151 { 151 {
152 cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); 152 cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
153 } 153 }
154 } 154 }
155 155
@@ -167,8 +167,8 @@ namespace OpenSim.Data.SQLite
167 r.Close(); 167 r.Close();
168 168
169 cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; 169 cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
170 cmd.Parameters.Add(":RegionID", regionID.ToString()); 170 cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
171 cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); 171 cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
172 172
173 // This will throw on dupe key 173 // This will throw on dupe key
174 try 174 try
@@ -211,13 +211,13 @@ namespace OpenSim.Data.SQLite
211 if (m_FieldMap[name].GetValue(es) is bool) 211 if (m_FieldMap[name].GetValue(es) is bool)
212 { 212 {
213 if ((bool)m_FieldMap[name].GetValue(es)) 213 if ((bool)m_FieldMap[name].GetValue(es))
214 cmd.Parameters.Add(":"+name, "1"); 214 cmd.Parameters.AddWithValue(":"+name, "1");
215 else 215 else
216 cmd.Parameters.Add(":"+name, "0"); 216 cmd.Parameters.AddWithValue(":"+name, "0");
217 } 217 }
218 else 218 else
219 { 219 {
220 cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); 220 cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
221 } 221 }
222 } 222 }
223 223
@@ -236,7 +236,7 @@ namespace OpenSim.Data.SQLite
236 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 236 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
237 237
238 cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; 238 cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
239 cmd.Parameters.Add(":EstateID", es.EstateID); 239 cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
240 240
241 IDataReader r = cmd.ExecuteReader(); 241 IDataReader r = cmd.ExecuteReader();
242 242
@@ -260,7 +260,7 @@ namespace OpenSim.Data.SQLite
260 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 260 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
261 261
262 cmd.CommandText = "delete from estateban where EstateID = :EstateID"; 262 cmd.CommandText = "delete from estateban where EstateID = :EstateID";
263 cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); 263 cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
264 264
265 cmd.ExecuteNonQuery(); 265 cmd.ExecuteNonQuery();
266 266
@@ -270,8 +270,8 @@ namespace OpenSim.Data.SQLite
270 270
271 foreach (EstateBan b in es.EstateBans) 271 foreach (EstateBan b in es.EstateBans)
272 { 272 {
273 cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); 273 cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
274 cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString()); 274 cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
275 275
276 cmd.ExecuteNonQuery(); 276 cmd.ExecuteNonQuery();
277 cmd.Parameters.Clear(); 277 cmd.Parameters.Clear();
@@ -283,7 +283,7 @@ namespace OpenSim.Data.SQLite
283 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 283 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
284 284
285 cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; 285 cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
286 cmd.Parameters.Add(":EstateID", EstateID.ToString()); 286 cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
287 287
288 cmd.ExecuteNonQuery(); 288 cmd.ExecuteNonQuery();
289 289
@@ -293,8 +293,8 @@ namespace OpenSim.Data.SQLite
293 293
294 foreach (UUID uuid in data) 294 foreach (UUID uuid in data)
295 { 295 {
296 cmd.Parameters.Add(":EstateID", EstateID.ToString()); 296 cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
297 cmd.Parameters.Add(":uuid", uuid.ToString()); 297 cmd.Parameters.AddWithValue(":uuid", uuid.ToString());
298 298
299 cmd.ExecuteNonQuery(); 299 cmd.ExecuteNonQuery();
300 cmd.Parameters.Clear(); 300 cmd.Parameters.Clear();
@@ -308,7 +308,7 @@ namespace OpenSim.Data.SQLite
308 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 308 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
309 309
310 cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; 310 cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
311 cmd.Parameters.Add(":EstateID", EstateID); 311 cmd.Parameters.AddWithValue(":EstateID", EstateID);
312 312
313 IDataReader r = cmd.ExecuteReader(); 313 IDataReader r = cmd.ExecuteReader();
314 314
@@ -333,7 +333,7 @@ namespace OpenSim.Data.SQLite
333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
334 334
335 cmd.CommandText = sql; 335 cmd.CommandText = sql;
336 cmd.Parameters.Add(":EstateID", estateID.ToString()); 336 cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
337 337
338 return DoLoad(cmd, UUID.Zero, false); 338 return DoLoad(cmd, UUID.Zero, false);
339 } 339 }
@@ -347,7 +347,7 @@ namespace OpenSim.Data.SQLite
347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
348 348
349 cmd.CommandText = sql; 349 cmd.CommandText = sql;
350 cmd.Parameters.Add(":EstateName", search); 350 cmd.Parameters.AddWithValue(":EstateName", search);
351 351
352 IDataReader r = cmd.ExecuteReader(); 352 IDataReader r = cmd.ExecuteReader();
353 353
@@ -365,8 +365,8 @@ namespace OpenSim.Data.SQLite
365 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 365 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
366 366
367 cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; 367 cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
368 cmd.Parameters.Add(":RegionID", regionID.ToString()); 368 cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
369 cmd.Parameters.Add(":EstateID", estateID.ToString()); 369 cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
370 370
371 if (cmd.ExecuteNonQuery() == 0) 371 if (cmd.ExecuteNonQuery() == 0)
372 return false; 372 return false;
diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs
index 20b5085..cf114d1 100644
--- a/OpenSim/Data/SQLite/SQLiteFramework.cs
+++ b/OpenSim/Data/SQLite/SQLiteFramework.cs
@@ -31,7 +31,7 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using Mono.Data.SqliteClient; 34using Mono.Data.Sqlite;
35 35
36namespace OpenSim.Data.SQLite 36namespace OpenSim.Data.SQLite
37{ 37{
@@ -55,11 +55,14 @@ namespace OpenSim.Data.SQLite
55 { 55 {
56 lock (connection) 56 lock (connection)
57 { 57 {
58/*
58 SqliteConnection newConnection = 59 SqliteConnection newConnection =
59 (SqliteConnection)((ICloneable)connection).Clone(); 60 (SqliteConnection)((ICloneable)connection).Clone();
60 newConnection.Open(); 61 newConnection.Open();
61 62
62 cmd.Connection = newConnection; 63 cmd.Connection = newConnection;
64*/
65 cmd.Connection = connection;
63 //Console.WriteLine("XXX " + cmd.CommandText); 66 //Console.WriteLine("XXX " + cmd.CommandText);
64 67
65 return cmd.ExecuteNonQuery(); 68 return cmd.ExecuteNonQuery();
@@ -70,11 +73,12 @@ namespace OpenSim.Data.SQLite
70 { 73 {
71 lock (connection) 74 lock (connection)
72 { 75 {
73 SqliteConnection newConnection = 76 //SqliteConnection newConnection =
74 (SqliteConnection)((ICloneable)connection).Clone(); 77 // (SqliteConnection)((ICloneable)connection).Clone();
75 newConnection.Open(); 78 //newConnection.Open();
76 79
77 cmd.Connection = newConnection; 80 //cmd.Connection = newConnection;
81 cmd.Connection = connection;
78 //Console.WriteLine("XXX " + cmd.CommandText); 82 //Console.WriteLine("XXX " + cmd.CommandText);
79 83
80 return cmd.ExecuteReader(); 84 return cmd.ExecuteReader();
diff --git a/OpenSim/Data/SQLite/SQLiteFriendsData.cs b/OpenSim/Data/SQLite/SQLiteFriendsData.cs
index 0b12182..b06853c 100644
--- a/OpenSim/Data/SQLite/SQLiteFriendsData.cs
+++ b/OpenSim/Data/SQLite/SQLiteFriendsData.cs
@@ -31,7 +31,7 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using Mono.Data.SqliteClient; 34using Mono.Data.Sqlite;
35 35
36namespace OpenSim.Data.SQLite 36namespace OpenSim.Data.SQLite
37{ 37{
@@ -47,7 +47,7 @@ namespace OpenSim.Data.SQLite
47 SqliteCommand cmd = new SqliteCommand(); 47 SqliteCommand cmd = new SqliteCommand();
48 48
49 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); 49 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);
50 cmd.Parameters.Add(":PrincipalID", userID.ToString()); 50 cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString());
51 51
52 return DoQuery(cmd); 52 return DoQuery(cmd);
53 53
@@ -58,8 +58,8 @@ namespace OpenSim.Data.SQLite
58 SqliteCommand cmd = new SqliteCommand(); 58 SqliteCommand cmd = new SqliteCommand();
59 59
60 cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); 60 cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
61 cmd.Parameters.Add(":PrincipalID", principalID.ToString()); 61 cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
62 cmd.Parameters.Add(":Friend", friend); 62 cmd.Parameters.AddWithValue(":Friend", friend);
63 63
64 ExecuteNonQuery(cmd, cmd.Connection); 64 ExecuteNonQuery(cmd, cmd.Connection);
65 65
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
index b39bb19..3c70aef 100644
--- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
+++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Data.SqliteClient; 33using Mono.Data.Sqlite;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
@@ -59,19 +59,21 @@ namespace OpenSim.Data.SQLite
59 if (!m_initialized) 59 if (!m_initialized)
60 { 60 {
61 m_Connection = new SqliteConnection(connectionString); 61 m_Connection = new SqliteConnection(connectionString);
62 Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString));
62 m_Connection.Open(); 63 m_Connection.Open();
63 64
64 if (storeName != String.Empty) 65 if (storeName != String.Empty)
65 { 66 {
66 Assembly assem = GetType().Assembly; 67 Assembly assem = GetType().Assembly;
67 SqliteConnection newConnection = 68 //SqliteConnection newConnection =
68 (SqliteConnection)((ICloneable)m_Connection).Clone(); 69 // (SqliteConnection)((ICloneable)m_Connection).Clone();
69 newConnection.Open(); 70 //newConnection.Open();
70 71
71 Migration m = new Migration(newConnection, assem, storeName); 72 //Migration m = new Migration(newConnection, assem, storeName);
73 Migration m = new Migration(m_Connection, assem, storeName);
72 m.Update(); 74 m.Update();
73 newConnection.Close(); 75 //newConnection.Close();
74 newConnection.Dispose(); 76 //newConnection.Dispose();
75 } 77 }
76 78
77 m_initialized = true; 79 m_initialized = true;
@@ -197,7 +199,7 @@ namespace OpenSim.Data.SQLite
197 result.Add(row); 199 result.Add(row);
198 } 200 }
199 201
200 CloseCommand(cmd); 202 //CloseCommand(cmd);
201 203
202 return result.ToArray(); 204 return result.ToArray();
203 } 205 }
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index a5e0517..ece2495 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Data.SqliteClient; 33using Mono.Data.Sqlite;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36 36
@@ -98,11 +98,13 @@ namespace OpenSim.Data.SQLite
98 ds.Tables.Add(createInventoryFoldersTable()); 98 ds.Tables.Add(createInventoryFoldersTable());
99 invFoldersDa.Fill(ds.Tables["inventoryfolders"]); 99 invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
100 setupFoldersCommands(invFoldersDa, conn); 100 setupFoldersCommands(invFoldersDa, conn);
101 CreateDataSetMapping(invFoldersDa, "inventoryfolders");
101 m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); 102 m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
102 103
103 ds.Tables.Add(createInventoryItemsTable()); 104 ds.Tables.Add(createInventoryItemsTable());
104 invItemsDa.Fill(ds.Tables["inventoryitems"]); 105 invItemsDa.Fill(ds.Tables["inventoryitems"]);
105 setupItemsCommands(invItemsDa, conn); 106 setupItemsCommands(invItemsDa, conn);
107 CreateDataSetMapping(invItemsDa, "inventoryitems");
106 m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); 108 m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
107 109
108 ds.AcceptChanges(); 110 ds.AcceptChanges();
@@ -728,6 +730,15 @@ namespace OpenSim.Data.SQLite
728 * 730 *
729 **********************************************************************/ 731 **********************************************************************/
730 732
733 protected void CreateDataSetMapping(IDataAdapter da, string tableName)
734 {
735 ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
736 foreach (DataColumn col in ds.Tables[tableName].Columns)
737 {
738 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
739 }
740 }
741
731 /// <summary> 742 /// <summary>
732 /// Create the "inventoryitems" table 743 /// Create the "inventoryitems" table
733 /// </summary> 744 /// </summary>
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index d2ba9ae..997664a 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -32,7 +32,7 @@ using System.Drawing;
32using System.IO; 32using System.IO;
33using System.Reflection; 33using System.Reflection;
34using log4net; 34using log4net;
35using Mono.Data.SqliteClient; 35using Mono.Data.Sqlite;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
@@ -87,119 +87,142 @@ namespace OpenSim.Data.SQLite
87 /// <param name="connectionString">the connection string</param> 87 /// <param name="connectionString">the connection string</param>
88 public void Initialise(string connectionString) 88 public void Initialise(string connectionString)
89 { 89 {
90 m_connectionString = connectionString; 90 try
91 {
92 m_connectionString = connectionString;
91 93
92 ds = new DataSet(); 94 ds = new DataSet("Region");
93 95
94 m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); 96 m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
95 m_conn = new SqliteConnection(m_connectionString); 97 m_conn = new SqliteConnection(m_connectionString);
96 m_conn.Open(); 98 m_conn.Open();
97 99
100 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
101 primDa = new SqliteDataAdapter(primSelectCmd);
98 102
103 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
104 shapeDa = new SqliteDataAdapter(shapeSelectCmd);
105 // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
99 106
100 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); 107 SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
101 primDa = new SqliteDataAdapter(primSelectCmd); 108 itemsDa = new SqliteDataAdapter(itemsSelectCmd);
102 // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
103 109
104 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); 110 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
105 shapeDa = new SqliteDataAdapter(shapeSelectCmd); 111 terrainDa = new SqliteDataAdapter(terrainSelectCmd);
106 // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
107 112
108 SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); 113 SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
109 itemsDa = new SqliteDataAdapter(itemsSelectCmd); 114 landDa = new SqliteDataAdapter(landSelectCmd);
110 115
111 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); 116 SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
112 terrainDa = new SqliteDataAdapter(terrainSelectCmd); 117 landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
113 118
114 SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); 119 SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
115 landDa = new SqliteDataAdapter(landSelectCmd); 120 regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
121 // This actually does the roll forward assembly stuff
122 Assembly assem = GetType().Assembly;
123 Migration m = new Migration(m_conn, assem, "RegionStore");
124 m.Update();
116 125
117 SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); 126 lock (ds)
118 landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); 127 {
128 ds.Tables.Add(createPrimTable());
129 setupPrimCommands(primDa, m_conn);
119 130
120 SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); 131 ds.Tables.Add(createShapeTable());
121 regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); 132 setupShapeCommands(shapeDa, m_conn);
122 // This actually does the roll forward assembly stuff
123 Assembly assem = GetType().Assembly;
124 Migration m = new Migration(m_conn, assem, "RegionStore");
125 m.Update();
126 133
127 lock (ds) 134 ds.Tables.Add(createItemsTable());
128 { 135 setupItemsCommands(itemsDa, m_conn);
129 ds.Tables.Add(createPrimTable());
130 setupPrimCommands(primDa, m_conn);
131 primDa.Fill(ds.Tables["prims"]);
132 136
133 ds.Tables.Add(createShapeTable()); 137 ds.Tables.Add(createTerrainTable());
134 setupShapeCommands(shapeDa, m_conn); 138 setupTerrainCommands(terrainDa, m_conn);
135 139
136 ds.Tables.Add(createItemsTable()); 140 ds.Tables.Add(createLandTable());
137 setupItemsCommands(itemsDa, m_conn); 141 setupLandCommands(landDa, m_conn);
138 itemsDa.Fill(ds.Tables["primitems"]);
139 142
140 ds.Tables.Add(createTerrainTable()); 143 ds.Tables.Add(createLandAccessListTable());
141 setupTerrainCommands(terrainDa, m_conn); 144 setupLandAccessCommands(landAccessListDa, m_conn);
142 145
143 ds.Tables.Add(createLandTable()); 146 ds.Tables.Add(createRegionSettingsTable());
144 setupLandCommands(landDa, m_conn); 147 setupRegionSettingsCommands(regionSettingsDa, m_conn);
145 148
146 ds.Tables.Add(createLandAccessListTable()); 149 // WORKAROUND: This is a work around for sqlite on
147 setupLandAccessCommands(landAccessListDa, m_conn); 150 // windows, which gets really unhappy with blob columns
151 // that have no sample data in them. At some point we
152 // need to actually find a proper way to handle this.
153 try
154 {
155 primDa.Fill(ds.Tables["prims"]);
156 }
157 catch (Exception)
158 {
159 m_log.Info("[REGION DB]: Caught fill error on prims table");
160 }
148 161
149 ds.Tables.Add(createRegionSettingsTable()); 162 try
150 163 {
151 setupRegionSettingsCommands(regionSettingsDa, m_conn); 164 shapeDa.Fill(ds.Tables["primshapes"]);
165 }
166 catch (Exception)
167 {
168 m_log.Info("[REGION DB]: Caught fill error on primshapes table");
169 }
152 170
153 // WORKAROUND: This is a work around for sqlite on 171 try
154 // windows, which gets really unhappy with blob columns 172 {
155 // that have no sample data in them. At some point we 173 terrainDa.Fill(ds.Tables["terrain"]);
156 // need to actually find a proper way to handle this. 174 }
157 try 175 catch (Exception)
158 { 176 {
159 shapeDa.Fill(ds.Tables["primshapes"]); 177 m_log.Info("[REGION DB]: Caught fill error on terrain table");
160 } 178 }
161 catch (Exception)
162 {
163 m_log.Info("[REGION DB]: Caught fill error on primshapes table");
164 }
165 179
166 try 180 try
167 { 181 {
168 terrainDa.Fill(ds.Tables["terrain"]); 182 landDa.Fill(ds.Tables["land"]);
169 } 183 }
170 catch (Exception) 184 catch (Exception)
171 { 185 {
172 m_log.Info("[REGION DB]: Caught fill error on terrain table"); 186 m_log.Info("[REGION DB]: Caught fill error on land table");
173 } 187 }
174 188
175 try 189 try
176 { 190 {
177 landDa.Fill(ds.Tables["land"]); 191 landAccessListDa.Fill(ds.Tables["landaccesslist"]);
178 } 192 }
179 catch (Exception) 193 catch (Exception)
180 { 194 {
181 m_log.Info("[REGION DB]: Caught fill error on land table"); 195 m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
182 } 196 }
183 197
184 try 198 try
185 { 199 {
186 landAccessListDa.Fill(ds.Tables["landaccesslist"]); 200 regionSettingsDa.Fill(ds.Tables["regionsettings"]);
187 } 201 }
188 catch (Exception) 202 catch (Exception)
189 { 203 {
190 m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); 204 m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
191 } 205 }
192 206
193 try 207 // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
194 { 208 // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409
195 regionSettingsDa.Fill(ds.Tables["regionsettings"]); 209 // Possibly because we manually set up our own DataTables before connecting to the database
196 } 210 CreateDataSetMapping(primDa, "prims");
197 catch (Exception) 211 CreateDataSetMapping(shapeDa, "primshapes");
198 { 212 CreateDataSetMapping(itemsDa, "primitems");
199 m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); 213 CreateDataSetMapping(terrainDa, "terrain");
214 CreateDataSetMapping(landDa, "land");
215 CreateDataSetMapping(landAccessListDa, "landaccesslist");
216 CreateDataSetMapping(regionSettingsDa, "regionsettings");
200 } 217 }
201 return;
202 } 218 }
219 catch (Exception e)
220 {
221 m_log.Error(e);
222 Environment.Exit(23);
223 }
224
225 return;
203 } 226 }
204 227
205 public void Dispose() 228 public void Dispose()
@@ -603,7 +626,7 @@ namespace OpenSim.Data.SQLite
603 } 626 }
604 } 627 }
605 } 628 }
606 rev = (int) row["Revision"]; 629 rev = Convert.ToInt32(row["Revision"]);
607 } 630 }
608 else 631 else
609 { 632 {
@@ -755,6 +778,7 @@ namespace OpenSim.Data.SQLite
755 /// </summary> 778 /// </summary>
756 public void Commit() 779 public void Commit()
757 { 780 {
781 //m_log.Debug("[SQLITE]: Starting commit");
758 lock (ds) 782 lock (ds)
759 { 783 {
760 primDa.Update(ds, "prims"); 784 primDa.Update(ds, "prims");
@@ -769,18 +793,11 @@ namespace OpenSim.Data.SQLite
769 { 793 {
770 regionSettingsDa.Update(ds, "regionsettings"); 794 regionSettingsDa.Update(ds, "regionsettings");
771 } 795 }
772 catch (SqliteExecutionException SqlEx) 796 catch (SqliteException SqlEx)
773 { 797 {
774 if (SqlEx.Message.Contains("logic error")) 798 throw new Exception(
775 { 799 "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
776 throw new Exception( 800 SqlEx);
777 "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
778 SqlEx);
779 }
780 else
781 {
782 throw SqlEx;
783 }
784 } 801 }
785 ds.AcceptChanges(); 802 ds.AcceptChanges();
786 } 803 }
@@ -802,6 +819,15 @@ namespace OpenSim.Data.SQLite
802 * 819 *
803 **********************************************************************/ 820 **********************************************************************/
804 821
822 protected void CreateDataSetMapping(IDataAdapter da, string tableName)
823 {
824 ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
825 foreach (DataColumn col in ds.Tables[tableName].Columns)
826 {
827 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
828 }
829 }
830
805 /// <summary> 831 /// <summary>
806 /// 832 ///
807 /// </summary> 833 /// </summary>
@@ -1897,7 +1923,7 @@ namespace OpenSim.Data.SQLite
1897 /// <param name="items"></param> 1923 /// <param name="items"></param>
1898 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 1924 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
1899 { 1925 {
1900 m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); 1926 //m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
1901 1927
1902 DataTable dbItems = ds.Tables["primitems"]; 1928 DataTable dbItems = ds.Tables["primitems"];
1903 1929
@@ -1964,6 +1990,7 @@ namespace OpenSim.Data.SQLite
1964 sql += ") values (:"; 1990 sql += ") values (:";
1965 sql += String.Join(", :", cols); 1991 sql += String.Join(", :", cols);
1966 sql += ")"; 1992 sql += ")";
1993 //m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
1967 SqliteCommand cmd = new SqliteCommand(sql); 1994 SqliteCommand cmd = new SqliteCommand(sql);
1968 1995
1969 // this provides the binding for all our parameters, so 1996 // this provides the binding for all our parameters, so
@@ -2259,6 +2286,36 @@ namespace OpenSim.Data.SQLite
2259 return DbType.String; 2286 return DbType.String;
2260 } 2287 }
2261 } 2288 }
2289
2290 static void PrintDataSet(DataSet ds)
2291 {
2292 // Print out any name and extended properties.
2293 Console.WriteLine("DataSet is named: {0}", ds.DataSetName);
2294 foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
2295 {
2296 Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
2297 }
2298 Console.WriteLine();
2299 foreach (DataTable dt in ds.Tables)
2300 {
2301 Console.WriteLine("=> {0} Table:", dt.TableName);
2302 // Print out the column names.
2303 for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
2304 {
2305 Console.Write(dt.Columns[curCol].ColumnName + "\t");
2306 }
2307 Console.WriteLine("\n----------------------------------");
2308 // Print the DataTable.
2309 for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
2310 {
2311 for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
2312 {
2313 Console.Write(dt.Rows[curRow][curCol].ToString() + "\t");
2314 }
2315 Console.WriteLine();
2316 }
2317 }
2318 }
2262 2319
2263 } 2320 }
2264} 2321}
diff --git a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs
index 67cf716..893f105 100644
--- a/OpenSim/Data/SQLite/SQLiteUserAccountData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs
@@ -31,7 +31,7 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using Mono.Data.SqliteClient; 34using Mono.Data.Sqlite;
35 35
36namespace OpenSim.Data.SQLite 36namespace OpenSim.Data.SQLite
37{ 37{
@@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite
66 66
67 if (words.Length == 1) 67 if (words.Length == 1)
68 { 68 {
69 cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')", 69 cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
70 m_Realm, scopeID.ToString(), words[0]); 70 m_Realm, scopeID.ToString(), words[0]);
71 } 71 }
72 else 72 else
diff --git a/OpenSim/Data/SQLite/SQLiteUtils.cs b/OpenSim/Data/SQLite/SQLiteUtils.cs
index 4a835ce..07c6b69 100644
--- a/OpenSim/Data/SQLite/SQLiteUtils.cs
+++ b/OpenSim/Data/SQLite/SQLiteUtils.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29using System.Data; 29using System.Data;
30using Mono.Data.SqliteClient; 30using Mono.Data.Sqlite;
31 31
32namespace OpenSim.Data.SQLite 32namespace OpenSim.Data.SQLite
33{ 33{
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
index a66e0c6..be1d041 100644
--- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
+++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
@@ -29,7 +29,7 @@ using System;
29using System.Data; 29using System.Data;
30using System.Reflection; 30using System.Reflection;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using Mono.Data.SqliteClient; 32using Mono.Data.Sqlite;
33using log4net; 33using log4net;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
@@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLite
147 } 147 }
148 148
149 reader.Close(); 149 reader.Close();
150 CloseCommand(cmd); 150 //CloseCommand(cmd);
151 151
152 return perms; 152 return perms;
153 } 153 }
diff --git a/OpenSim/Data/SQLiteNG/Properties/AssemblyInfo.cs b/OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs
index 4aeb67b..609a024 100644
--- a/OpenSim/Data/SQLiteNG/Properties/AssemblyInfo.cs
+++ b/OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs
@@ -32,11 +32,11 @@ using System.Runtime.InteropServices;
32// set of attributes. Change these attribute values to modify the information 32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly. 33// associated with an assembly.
34 34
35[assembly : AssemblyTitle("OpenSim.Data.SQLiteNG")] 35[assembly : AssemblyTitle("OpenSim.Data.SQLiteLegacy")]
36[assembly : AssemblyDescription("")] 36[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")] 37[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("http://opensimulator.org")] 38[assembly : AssemblyCompany("http://opensimulator.org")]
39[assembly : AssemblyProduct("OpenSim.Data.SQLiteNG")] 39[assembly : AssemblyProduct("OpenSim.Data.SQLiteLegacy")]
40[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] 40[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
41[assembly : AssemblyTrademark("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")] 42[assembly : AssemblyCulture("")]
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql
index 2e026ca..2e026ca 100644
--- a/OpenSim/Data/SQLiteNG/Resources/001_AssetStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_AuthStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql
index 468567d..468567d 100644
--- a/OpenSim/Data/SQLiteNG/Resources/001_AuthStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_Avatar.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql
index 7ec906b..7ec906b 100644
--- a/OpenSim/Data/SQLiteNG/Resources/001_Avatar.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_FriendsStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql
index f1b9ab9..f1b9ab9 100644
--- a/OpenSim/Data/SQLiteNG/Resources/001_FriendsStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql
index 554d5c2..554d5c2 100644
--- a/OpenSim/Data/SQLiteNG/Resources/001_InventoryStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql
index 39e8180..39e8180 100644
--- a/OpenSim/Data/SQLiteNG/Resources/001_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_UserAccount.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql
index c38d9a7..c38d9a7 100644
--- a/OpenSim/Data/SQLiteNG/Resources/001_UserAccount.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql
index b584594..b584594 100644
--- a/OpenSim/Data/SQLiteNG/Resources/001_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql
index 5339b84..5339b84 100644
--- a/OpenSim/Data/SQLiteNG/Resources/002_AssetStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_AuthStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql
index 3237b68..3237b68 100644
--- a/OpenSim/Data/SQLiteNG/Resources/002_AuthStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_FriendsStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql
index 6733502..6733502 100644
--- a/OpenSim/Data/SQLiteNG/Resources/002_FriendsStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_InventoryStore.sql
index 01951d6..01951d6 100644
--- a/OpenSim/Data/SQLiteNG/Resources/002_InventoryStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/002_InventoryStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql
index c5c7c99..c5c7c99 100644
--- a/OpenSim/Data/SQLiteNG/Resources/002_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_UserAccount.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql
index c7a6293..c7a6293 100644
--- a/OpenSim/Data/SQLiteNG/Resources/002_UserAccount.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql
index 48fc680..48fc680 100644
--- a/OpenSim/Data/SQLiteNG/Resources/002_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/003_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql
index f54f8d9..f54f8d9 100644
--- a/OpenSim/Data/SQLiteNG/Resources/003_AssetStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/003_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_InventoryStore.sql
index 4c6da91..4c6da91 100644
--- a/OpenSim/Data/SQLiteNG/Resources/003_InventoryStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/003_InventoryStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/003_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql
index 4db2f75..4db2f75 100644
--- a/OpenSim/Data/SQLiteNG/Resources/003_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/003_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql
index 6f890ee..6f890ee 100644
--- a/OpenSim/Data/SQLiteNG/Resources/003_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/004_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql
index 39421c4..39421c4 100644
--- a/OpenSim/Data/SQLiteNG/Resources/004_AssetStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/004_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql
index e8f4d46..e8f4d46 100644
--- a/OpenSim/Data/SQLiteNG/Resources/004_InventoryStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/004_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql
index de328cb..de328cb 100644
--- a/OpenSim/Data/SQLiteNG/Resources/004_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/004_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql
index 03142af..03142af 100644
--- a/OpenSim/Data/SQLiteNG/Resources/004_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/005_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql
index 1f6d1bd..1f6d1bd 100644
--- a/OpenSim/Data/SQLiteNG/Resources/005_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/005_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql
index e45c09a..e45c09a 100644
--- a/OpenSim/Data/SQLiteNG/Resources/005_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/006_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql
index 94ed818..94ed818 100644
--- a/OpenSim/Data/SQLiteNG/Resources/006_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/006_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql
index f9454c5..f9454c5 100644
--- a/OpenSim/Data/SQLiteNG/Resources/006_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/007_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql
index 1c813a0..1c813a0 100644
--- a/OpenSim/Data/SQLiteNG/Resources/007_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/007_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql
index 8b0cd28..8b0cd28 100644
--- a/OpenSim/Data/SQLiteNG/Resources/007_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/008_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql
index 28bfbf5..28bfbf5 100644
--- a/OpenSim/Data/SQLiteNG/Resources/008_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/008_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql
index 97da818..97da818 100644
--- a/OpenSim/Data/SQLiteNG/Resources/008_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/009_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql
index 1f40548..1f40548 100644
--- a/OpenSim/Data/SQLiteNG/Resources/009_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/009_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql
index 8ab03ef..8ab03ef 100644
--- a/OpenSim/Data/SQLiteNG/Resources/009_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/010_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql
index b91ccf0..b91ccf0 100644
--- a/OpenSim/Data/SQLiteNG/Resources/010_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/010_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql
index 5f956da..5f956da 100644
--- a/OpenSim/Data/SQLiteNG/Resources/010_UserStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/011_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql
index 42bef89..42bef89 100644
--- a/OpenSim/Data/SQLiteNG/Resources/011_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/012_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql
index d952b78..d952b78 100644
--- a/OpenSim/Data/SQLiteNG/Resources/012_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/013_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql
index 11529cd..11529cd 100644
--- a/OpenSim/Data/SQLiteNG/Resources/013_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/014_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql
index c59b27e..c59b27e 100644
--- a/OpenSim/Data/SQLiteNG/Resources/014_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/015_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql
index c43f356..c43f356 100644
--- a/OpenSim/Data/SQLiteNG/Resources/015_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/016_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql
index 52f160c..52f160c 100644
--- a/OpenSim/Data/SQLiteNG/Resources/016_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/017_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql
index 6c6b7b5..6c6b7b5 100644
--- a/OpenSim/Data/SQLiteNG/Resources/017_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/018_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql
index 6a390c2..6a390c2 100644
--- a/OpenSim/Data/SQLiteNG/Resources/018_RegionStore.sql
+++ b/OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql
diff --git a/OpenSim/Data/SQLiteNG/Resources/OpenSim.Data.SQLite.addin.xml b/OpenSim/Data/SQLiteLegacy/Resources/OpenSim.Data.SQLite.addin.xml
index e6764fa..e6764fa 100644
--- a/OpenSim/Data/SQLiteNG/Resources/OpenSim.Data.SQLite.addin.xml
+++ b/OpenSim/Data/SQLiteLegacy/Resources/OpenSim.Data.SQLite.addin.xml
diff --git a/OpenSim/Data/SQLiteNG/SQLiteAssetData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
index 9b34a21..0d63dea 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
@@ -30,11 +30,11 @@ using System.Data;
30using System.Reflection; 30using System.Reflection;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using log4net; 32using log4net;
33using Mono.Data.Sqlite; 33using Mono.Data.SqliteClient;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36 36
37namespace OpenSim.Data.SQLiteNG 37namespace OpenSim.Data.SQLiteLegacy
38{ 38{
39 /// <summary> 39 /// <summary>
40 /// An asset storage interface for the SQLite database system 40 /// An asset storage interface for the SQLite database system
@@ -137,7 +137,7 @@ namespace OpenSim.Data.SQLiteNG
137 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); 137 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
138 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); 138 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
139 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 139 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
140 140
141 cmd.ExecuteNonQuery(); 141 cmd.ExecuteNonQuery();
142 } 142 }
143 } 143 }
@@ -340,4 +340,4 @@ namespace OpenSim.Data.SQLiteNG
340 340
341 #endregion 341 #endregion
342 } 342 }
343} 343} \ No newline at end of file
diff --git a/OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs
index 4a5dc2e..c64830a 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs
@@ -31,9 +31,9 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using Mono.Data.Sqlite; 34using Mono.Data.SqliteClient;
35 35
36namespace OpenSim.Data.SQLiteNG 36namespace OpenSim.Data.SQLiteLegacy
37{ 37{
38 public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData 38 public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData
39 { 39 {
@@ -56,8 +56,13 @@ namespace OpenSim.Data.SQLiteNG
56 m_Connection = new SqliteConnection(connectionString); 56 m_Connection = new SqliteConnection(connectionString);
57 m_Connection.Open(); 57 m_Connection.Open();
58 58
59 Migration m = new Migration(m_Connection, GetType().Assembly, "AuthStore"); 59 using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone())
60 m.Update(); 60 {
61 dbcon.Open();
62 Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
63 m.Update();
64 dbcon.Close();
65 }
61 66
62 m_initialized = true; 67 m_initialized = true;
63 } 68 }
@@ -108,7 +113,7 @@ namespace OpenSim.Data.SQLiteNG
108 } 113 }
109 finally 114 finally
110 { 115 {
111 //CloseCommand(cmd); 116 CloseCommand(cmd);
112 } 117 }
113 118
114 return null; 119 return null;
@@ -151,14 +156,14 @@ namespace OpenSim.Data.SQLiteNG
151 { 156 {
152 if (ExecuteNonQuery(cmd, m_Connection) < 1) 157 if (ExecuteNonQuery(cmd, m_Connection) < 1)
153 { 158 {
154 //CloseCommand(cmd); 159 CloseCommand(cmd);
155 return false; 160 return false;
156 } 161 }
157 } 162 }
158 catch (Exception e) 163 catch (Exception e)
159 { 164 {
160 Console.WriteLine(e.ToString()); 165 Console.WriteLine(e.ToString());
161 //CloseCommand(cmd); 166 CloseCommand(cmd);
162 return false; 167 return false;
163 } 168 }
164 } 169 }
@@ -179,19 +184,19 @@ namespace OpenSim.Data.SQLiteNG
179 { 184 {
180 if (ExecuteNonQuery(cmd, m_Connection) < 1) 185 if (ExecuteNonQuery(cmd, m_Connection) < 1)
181 { 186 {
182 //CloseCommand(cmd); 187 CloseCommand(cmd);
183 return false; 188 return false;
184 } 189 }
185 } 190 }
186 catch (Exception e) 191 catch (Exception e)
187 { 192 {
188 Console.WriteLine(e.ToString()); 193 Console.WriteLine(e.ToString());
189 //CloseCommand(cmd); 194 CloseCommand(cmd);
190 return false; 195 return false;
191 } 196 }
192 } 197 }
193 198
194 //CloseCommand(cmd); 199 CloseCommand(cmd);
195 200
196 return true; 201 return true;
197 } 202 }
diff --git a/OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs
index d0fd49c..660632c 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs
@@ -33,9 +33,9 @@ using System.Threading;
33using log4net; 33using log4net;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using Mono.Data.Sqlite; 36using Mono.Data.SqliteClient;
37 37
38namespace OpenSim.Data.SQLiteNG 38namespace OpenSim.Data.SQLiteLegacy
39{ 39{
40 /// <summary> 40 /// <summary>
41 /// A SQLite Interface for Avatar Data 41 /// A SQLite Interface for Avatar Data
@@ -55,8 +55,8 @@ namespace OpenSim.Data.SQLiteNG
55 SqliteCommand cmd = new SqliteCommand(); 55 SqliteCommand cmd = new SqliteCommand();
56 56
57 cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); 57 cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
58 cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); 58 cmd.Parameters.Add(":PrincipalID", principalID.ToString());
59 cmd.Parameters.AddWithValue(":Name", name); 59 cmd.Parameters.Add(":Name", name);
60 60
61 try 61 try
62 { 62 {
@@ -67,7 +67,7 @@ namespace OpenSim.Data.SQLiteNG
67 } 67 }
68 finally 68 finally
69 { 69 {
70 //CloseCommand(cmd); 70 CloseCommand(cmd);
71 } 71 }
72 } 72 }
73 } 73 }
diff --git a/OpenSim/Data/SQLiteNG/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
index 2e2d717..e135eaa 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
@@ -30,12 +30,12 @@ using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Data.Sqlite; 33using Mono.Data.SqliteClient;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37 37
38namespace OpenSim.Data.SQLiteNG 38namespace OpenSim.Data.SQLiteLegacy
39{ 39{
40 public class SQLiteEstateStore : IEstateDataStore 40 public class SQLiteEstateStore : IEstateDataStore
41 { 41 {
@@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLiteNG
62 Migration m = new Migration(m_connection, assem, "EstateStore"); 62 Migration m = new Migration(m_connection, assem, "EstateStore");
63 m.Update(); 63 m.Update();
64 64
65 //m_connection.Close(); 65 m_connection.Close();
66 // m_connection.Open(); 66 m_connection.Open();
67 67
68 Type t = typeof(EstateSettings); 68 Type t = typeof(EstateSettings);
69 m_Fields = t.GetFields(BindingFlags.NonPublic | 69 m_Fields = t.GetFields(BindingFlags.NonPublic |
@@ -87,7 +87,7 @@ namespace OpenSim.Data.SQLiteNG
87 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 87 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
88 88
89 cmd.CommandText = sql; 89 cmd.CommandText = sql;
90 cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); 90 cmd.Parameters.Add(":RegionID", regionID.ToString());
91 91
92 return DoLoad(cmd, regionID, create); 92 return DoLoad(cmd, regionID, create);
93 } 93 }
@@ -143,13 +143,13 @@ namespace OpenSim.Data.SQLiteNG
143 if (m_FieldMap[name].GetValue(es) is bool) 143 if (m_FieldMap[name].GetValue(es) is bool)
144 { 144 {
145 if ((bool)m_FieldMap[name].GetValue(es)) 145 if ((bool)m_FieldMap[name].GetValue(es))
146 cmd.Parameters.AddWithValue(":"+name, "1"); 146 cmd.Parameters.Add(":"+name, "1");
147 else 147 else
148 cmd.Parameters.AddWithValue(":"+name, "0"); 148 cmd.Parameters.Add(":"+name, "0");
149 } 149 }
150 else 150 else
151 { 151 {
152 cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); 152 cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
153 } 153 }
154 } 154 }
155 155
@@ -167,8 +167,8 @@ namespace OpenSim.Data.SQLiteNG
167 r.Close(); 167 r.Close();
168 168
169 cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; 169 cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
170 cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); 170 cmd.Parameters.Add(":RegionID", regionID.ToString());
171 cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); 171 cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
172 172
173 // This will throw on dupe key 173 // This will throw on dupe key
174 try 174 try
@@ -211,13 +211,13 @@ namespace OpenSim.Data.SQLiteNG
211 if (m_FieldMap[name].GetValue(es) is bool) 211 if (m_FieldMap[name].GetValue(es) is bool)
212 { 212 {
213 if ((bool)m_FieldMap[name].GetValue(es)) 213 if ((bool)m_FieldMap[name].GetValue(es))
214 cmd.Parameters.AddWithValue(":"+name, "1"); 214 cmd.Parameters.Add(":"+name, "1");
215 else 215 else
216 cmd.Parameters.AddWithValue(":"+name, "0"); 216 cmd.Parameters.Add(":"+name, "0");
217 } 217 }
218 else 218 else
219 { 219 {
220 cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); 220 cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
221 } 221 }
222 } 222 }
223 223
@@ -236,7 +236,7 @@ namespace OpenSim.Data.SQLiteNG
236 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 236 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
237 237
238 cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; 238 cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
239 cmd.Parameters.AddWithValue(":EstateID", es.EstateID); 239 cmd.Parameters.Add(":EstateID", es.EstateID);
240 240
241 IDataReader r = cmd.ExecuteReader(); 241 IDataReader r = cmd.ExecuteReader();
242 242
@@ -260,7 +260,7 @@ namespace OpenSim.Data.SQLiteNG
260 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 260 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
261 261
262 cmd.CommandText = "delete from estateban where EstateID = :EstateID"; 262 cmd.CommandText = "delete from estateban where EstateID = :EstateID";
263 cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); 263 cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
264 264
265 cmd.ExecuteNonQuery(); 265 cmd.ExecuteNonQuery();
266 266
@@ -270,8 +270,8 @@ namespace OpenSim.Data.SQLiteNG
270 270
271 foreach (EstateBan b in es.EstateBans) 271 foreach (EstateBan b in es.EstateBans)
272 { 272 {
273 cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); 273 cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
274 cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString()); 274 cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString());
275 275
276 cmd.ExecuteNonQuery(); 276 cmd.ExecuteNonQuery();
277 cmd.Parameters.Clear(); 277 cmd.Parameters.Clear();
@@ -283,7 +283,7 @@ namespace OpenSim.Data.SQLiteNG
283 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 283 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
284 284
285 cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; 285 cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
286 cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString()); 286 cmd.Parameters.Add(":EstateID", EstateID.ToString());
287 287
288 cmd.ExecuteNonQuery(); 288 cmd.ExecuteNonQuery();
289 289
@@ -293,8 +293,8 @@ namespace OpenSim.Data.SQLiteNG
293 293
294 foreach (UUID uuid in data) 294 foreach (UUID uuid in data)
295 { 295 {
296 cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString()); 296 cmd.Parameters.Add(":EstateID", EstateID.ToString());
297 cmd.Parameters.AddWithValue(":uuid", uuid.ToString()); 297 cmd.Parameters.Add(":uuid", uuid.ToString());
298 298
299 cmd.ExecuteNonQuery(); 299 cmd.ExecuteNonQuery();
300 cmd.Parameters.Clear(); 300 cmd.Parameters.Clear();
@@ -308,7 +308,7 @@ namespace OpenSim.Data.SQLiteNG
308 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 308 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
309 309
310 cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; 310 cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
311 cmd.Parameters.AddWithValue(":EstateID", EstateID); 311 cmd.Parameters.Add(":EstateID", EstateID);
312 312
313 IDataReader r = cmd.ExecuteReader(); 313 IDataReader r = cmd.ExecuteReader();
314 314
@@ -333,7 +333,7 @@ namespace OpenSim.Data.SQLiteNG
333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
334 334
335 cmd.CommandText = sql; 335 cmd.CommandText = sql;
336 cmd.Parameters.AddWithValue(":EstateID", estateID.ToString()); 336 cmd.Parameters.Add(":EstateID", estateID.ToString());
337 337
338 return DoLoad(cmd, UUID.Zero, false); 338 return DoLoad(cmd, UUID.Zero, false);
339 } 339 }
@@ -347,7 +347,7 @@ namespace OpenSim.Data.SQLiteNG
347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
348 348
349 cmd.CommandText = sql; 349 cmd.CommandText = sql;
350 cmd.Parameters.AddWithValue(":EstateName", search); 350 cmd.Parameters.Add(":EstateName", search);
351 351
352 IDataReader r = cmd.ExecuteReader(); 352 IDataReader r = cmd.ExecuteReader();
353 353
@@ -365,8 +365,8 @@ namespace OpenSim.Data.SQLiteNG
365 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 365 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
366 366
367 cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; 367 cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
368 cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); 368 cmd.Parameters.Add(":RegionID", regionID.ToString());
369 cmd.Parameters.AddWithValue(":EstateID", estateID.ToString()); 369 cmd.Parameters.Add(":EstateID", estateID.ToString());
370 370
371 if (cmd.ExecuteNonQuery() == 0) 371 if (cmd.ExecuteNonQuery() == 0)
372 return false; 372 return false;
diff --git a/OpenSim/Data/SQLiteNG/SQLiteFramework.cs b/OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs
index f0ddc59..606478e 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteFramework.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs
@@ -31,9 +31,9 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using Mono.Data.Sqlite; 34using Mono.Data.SqliteClient;
35 35
36namespace OpenSim.Data.SQLiteNG 36namespace OpenSim.Data.SQLiteLegacy
37{ 37{
38 /// <summary> 38 /// <summary>
39 /// A database interface class to a user profile storage system 39 /// A database interface class to a user profile storage system
@@ -55,14 +55,11 @@ namespace OpenSim.Data.SQLiteNG
55 { 55 {
56 lock (connection) 56 lock (connection)
57 { 57 {
58/*
59 SqliteConnection newConnection = 58 SqliteConnection newConnection =
60 (SqliteConnection)((ICloneable)connection).Clone(); 59 (SqliteConnection)((ICloneable)connection).Clone();
61 newConnection.Open(); 60 newConnection.Open();
62 61
63 cmd.Connection = newConnection; 62 cmd.Connection = newConnection;
64*/
65 cmd.Connection = connection;
66 //Console.WriteLine("XXX " + cmd.CommandText); 63 //Console.WriteLine("XXX " + cmd.CommandText);
67 64
68 return cmd.ExecuteNonQuery(); 65 return cmd.ExecuteNonQuery();
@@ -73,12 +70,11 @@ namespace OpenSim.Data.SQLiteNG
73 { 70 {
74 lock (connection) 71 lock (connection)
75 { 72 {
76 //SqliteConnection newConnection = 73 SqliteConnection newConnection =
77 // (SqliteConnection)((ICloneable)connection).Clone(); 74 (SqliteConnection)((ICloneable)connection).Clone();
78 //newConnection.Open(); 75 newConnection.Open();
79 76
80 //cmd.Connection = newConnection; 77 cmd.Connection = newConnection;
81 cmd.Connection = connection;
82 //Console.WriteLine("XXX " + cmd.CommandText); 78 //Console.WriteLine("XXX " + cmd.CommandText);
83 79
84 return cmd.ExecuteReader(); 80 return cmd.ExecuteReader();
diff --git a/OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs
index 702a1d8..d529d4d 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs
@@ -31,9 +31,9 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using Mono.Data.Sqlite; 34using Mono.Data.SqliteClient;
35 35
36namespace OpenSim.Data.SQLiteNG 36namespace OpenSim.Data.SQLiteLegacy
37{ 37{
38 public class SQLiteFriendsData : SQLiteGenericTableHandler<FriendsData>, IFriendsData 38 public class SQLiteFriendsData : SQLiteGenericTableHandler<FriendsData>, IFriendsData
39 { 39 {
@@ -47,7 +47,7 @@ namespace OpenSim.Data.SQLiteNG
47 SqliteCommand cmd = new SqliteCommand(); 47 SqliteCommand cmd = new SqliteCommand();
48 48
49 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); 49 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);
50 cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString()); 50 cmd.Parameters.Add(":PrincipalID", userID.ToString());
51 51
52 return DoQuery(cmd); 52 return DoQuery(cmd);
53 53
@@ -58,8 +58,8 @@ namespace OpenSim.Data.SQLiteNG
58 SqliteCommand cmd = new SqliteCommand(); 58 SqliteCommand cmd = new SqliteCommand();
59 59
60 cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); 60 cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
61 cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); 61 cmd.Parameters.Add(":PrincipalID", principalID.ToString());
62 cmd.Parameters.AddWithValue(":Friend", friend); 62 cmd.Parameters.Add(":Friend", friend);
63 63
64 ExecuteNonQuery(cmd, cmd.Connection); 64 ExecuteNonQuery(cmd, cmd.Connection);
65 65
diff --git a/OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs
index 632c5bf..1c1fe8c 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs
@@ -30,12 +30,12 @@ using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Data.Sqlite; 33using Mono.Data.SqliteClient;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37 37
38namespace OpenSim.Data.SQLiteNG 38namespace OpenSim.Data.SQLiteLegacy
39{ 39{
40 public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new() 40 public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new()
41 { 41 {
@@ -59,21 +59,19 @@ namespace OpenSim.Data.SQLiteNG
59 if (!m_initialized) 59 if (!m_initialized)
60 { 60 {
61 m_Connection = new SqliteConnection(connectionString); 61 m_Connection = new SqliteConnection(connectionString);
62 Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString));
63 m_Connection.Open(); 62 m_Connection.Open();
64 63
65 if (storeName != String.Empty) 64 if (storeName != String.Empty)
66 { 65 {
67 Assembly assem = GetType().Assembly; 66 Assembly assem = GetType().Assembly;
68 //SqliteConnection newConnection = 67 SqliteConnection newConnection =
69 // (SqliteConnection)((ICloneable)m_Connection).Clone(); 68 (SqliteConnection)((ICloneable)m_Connection).Clone();
70 //newConnection.Open(); 69 newConnection.Open();
71 70
72 //Migration m = new Migration(newConnection, assem, storeName); 71 Migration m = new Migration(newConnection, assem, storeName);
73 Migration m = new Migration(m_Connection, assem, storeName);
74 m.Update(); 72 m.Update();
75 //newConnection.Close(); 73 newConnection.Close();
76 //newConnection.Dispose(); 74 newConnection.Dispose();
77 } 75 }
78 76
79 m_initialized = true; 77 m_initialized = true;
@@ -199,7 +197,7 @@ namespace OpenSim.Data.SQLiteNG
199 result.Add(row); 197 result.Add(row);
200 } 198 }
201 199
202 //CloseCommand(cmd); 200 CloseCommand(cmd);
203 201
204 return result.ToArray(); 202 return result.ToArray();
205 } 203 }
diff --git a/OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs b/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs
index 9207ca3..726703b 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs
@@ -30,11 +30,11 @@ using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Data.Sqlite; 33using Mono.Data.SqliteClient;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36 36
37namespace OpenSim.Data.SQLiteNG 37namespace OpenSim.Data.SQLiteLegacy
38{ 38{
39 /// <summary> 39 /// <summary>
40 /// An Inventory Interface to the SQLite database 40 /// An Inventory Interface to the SQLite database
@@ -98,13 +98,11 @@ namespace OpenSim.Data.SQLiteNG
98 ds.Tables.Add(createInventoryFoldersTable()); 98 ds.Tables.Add(createInventoryFoldersTable());
99 invFoldersDa.Fill(ds.Tables["inventoryfolders"]); 99 invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
100 setupFoldersCommands(invFoldersDa, conn); 100 setupFoldersCommands(invFoldersDa, conn);
101 CreateDataSetMapping(invFoldersDa, "inventoryfolders");
102 m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); 101 m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
103 102
104 ds.Tables.Add(createInventoryItemsTable()); 103 ds.Tables.Add(createInventoryItemsTable());
105 invItemsDa.Fill(ds.Tables["inventoryitems"]); 104 invItemsDa.Fill(ds.Tables["inventoryitems"]);
106 setupItemsCommands(invItemsDa, conn); 105 setupItemsCommands(invItemsDa, conn);
107 CreateDataSetMapping(invItemsDa, "inventoryitems");
108 m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); 106 m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
109 107
110 ds.AcceptChanges(); 108 ds.AcceptChanges();
@@ -730,15 +728,6 @@ namespace OpenSim.Data.SQLiteNG
730 * 728 *
731 **********************************************************************/ 729 **********************************************************************/
732 730
733 protected void CreateDataSetMapping(IDataAdapter da, string tableName)
734 {
735 ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
736 foreach (DataColumn col in ds.Tables[tableName].Columns)
737 {
738 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
739 }
740 }
741
742 /// <summary> 731 /// <summary>
743 /// Create the "inventoryitems" table 732 /// Create the "inventoryitems" table
744 /// </summary> 733 /// </summary>
diff --git a/OpenSim/Data/SQLiteNG/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
index 289d626..eb78037 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
@@ -32,13 +32,13 @@ using System.Drawing;
32using System.IO; 32using System.IO;
33using System.Reflection; 33using System.Reflection;
34using log4net; 34using log4net;
35using Mono.Data.Sqlite; 35using Mono.Data.SqliteClient;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40 40
41namespace OpenSim.Data.SQLiteNG 41namespace OpenSim.Data.SQLiteLegacy
42{ 42{
43 /// <summary> 43 /// <summary>
44 /// A RegionData Interface to the SQLite database 44 /// A RegionData Interface to the SQLite database
@@ -87,142 +87,119 @@ namespace OpenSim.Data.SQLiteNG
87 /// <param name="connectionString">the connection string</param> 87 /// <param name="connectionString">the connection string</param>
88 public void Initialise(string connectionString) 88 public void Initialise(string connectionString)
89 { 89 {
90 try 90 m_connectionString = connectionString;
91 {
92 m_connectionString = connectionString;
93 91
94 ds = new DataSet("Region"); 92 ds = new DataSet();
95 93
96 m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); 94 m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
97 m_conn = new SqliteConnection(m_connectionString); 95 m_conn = new SqliteConnection(m_connectionString);
98 m_conn.Open(); 96 m_conn.Open();
99 97
100 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
101 primDa = new SqliteDataAdapter(primSelectCmd);
102 98
103 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
104 shapeDa = new SqliteDataAdapter(shapeSelectCmd);
105 // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
106 99
107 SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); 100 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
108 itemsDa = new SqliteDataAdapter(itemsSelectCmd); 101 primDa = new SqliteDataAdapter(primSelectCmd);
102 // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
109 103
110 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); 104 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
111 terrainDa = new SqliteDataAdapter(terrainSelectCmd); 105 shapeDa = new SqliteDataAdapter(shapeSelectCmd);
106 // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
112 107
113 SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); 108 SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
114 landDa = new SqliteDataAdapter(landSelectCmd); 109 itemsDa = new SqliteDataAdapter(itemsSelectCmd);
115 110
116 SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); 111 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
117 landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); 112 terrainDa = new SqliteDataAdapter(terrainSelectCmd);
118 113
119 SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); 114 SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
120 regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); 115 landDa = new SqliteDataAdapter(landSelectCmd);
121 // This actually does the roll forward assembly stuff
122 Assembly assem = GetType().Assembly;
123 Migration m = new Migration(m_conn, assem, "RegionStore");
124 m.Update();
125 116
126 lock (ds) 117 SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
127 { 118 landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
128 ds.Tables.Add(createPrimTable());
129 setupPrimCommands(primDa, m_conn);
130 119
131 ds.Tables.Add(createShapeTable()); 120 SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
132 setupShapeCommands(shapeDa, m_conn); 121 regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
122 // This actually does the roll forward assembly stuff
123 Assembly assem = GetType().Assembly;
124 Migration m = new Migration(m_conn, assem, "RegionStore");
125 m.Update();
133 126
134 ds.Tables.Add(createItemsTable()); 127 lock (ds)
135 setupItemsCommands(itemsDa, m_conn); 128 {
129 ds.Tables.Add(createPrimTable());
130 setupPrimCommands(primDa, m_conn);
131 primDa.Fill(ds.Tables["prims"]);
136 132
137 ds.Tables.Add(createTerrainTable()); 133 ds.Tables.Add(createShapeTable());
138 setupTerrainCommands(terrainDa, m_conn); 134 setupShapeCommands(shapeDa, m_conn);
139 135
140 ds.Tables.Add(createLandTable()); 136 ds.Tables.Add(createItemsTable());
141 setupLandCommands(landDa, m_conn); 137 setupItemsCommands(itemsDa, m_conn);
138 itemsDa.Fill(ds.Tables["primitems"]);
142 139
143 ds.Tables.Add(createLandAccessListTable()); 140 ds.Tables.Add(createTerrainTable());
144 setupLandAccessCommands(landAccessListDa, m_conn); 141 setupTerrainCommands(terrainDa, m_conn);
145 142
146 ds.Tables.Add(createRegionSettingsTable()); 143 ds.Tables.Add(createLandTable());
147 setupRegionSettingsCommands(regionSettingsDa, m_conn); 144 setupLandCommands(landDa, m_conn);
148 145
149 // WORKAROUND: This is a work around for sqlite on 146 ds.Tables.Add(createLandAccessListTable());
150 // windows, which gets really unhappy with blob columns 147 setupLandAccessCommands(landAccessListDa, m_conn);
151 // that have no sample data in them. At some point we
152 // need to actually find a proper way to handle this.
153 try
154 {
155 primDa.Fill(ds.Tables["prims"]);
156 }
157 catch (Exception)
158 {
159 m_log.Info("[REGION DB]: Caught fill error on prims table");
160 }
161 148
162 try 149 ds.Tables.Add(createRegionSettingsTable());
163 { 150
164 shapeDa.Fill(ds.Tables["primshapes"]); 151 setupRegionSettingsCommands(regionSettingsDa, m_conn);
165 }
166 catch (Exception)
167 {
168 m_log.Info("[REGION DB]: Caught fill error on primshapes table");
169 }
170 152
171 try 153 // WORKAROUND: This is a work around for sqlite on
172 { 154 // windows, which gets really unhappy with blob columns
173 terrainDa.Fill(ds.Tables["terrain"]); 155 // that have no sample data in them. At some point we
174 } 156 // need to actually find a proper way to handle this.
175 catch (Exception) 157 try
176 { 158 {
177 m_log.Info("[REGION DB]: Caught fill error on terrain table"); 159 shapeDa.Fill(ds.Tables["primshapes"]);
178 } 160 }
161 catch (Exception)
162 {
163 m_log.Info("[REGION DB]: Caught fill error on primshapes table");
164 }
179 165
180 try 166 try
181 { 167 {
182 landDa.Fill(ds.Tables["land"]); 168 terrainDa.Fill(ds.Tables["terrain"]);
183 } 169 }
184 catch (Exception) 170 catch (Exception)
185 { 171 {
186 m_log.Info("[REGION DB]: Caught fill error on land table"); 172 m_log.Info("[REGION DB]: Caught fill error on terrain table");
187 } 173 }
188 174
189 try 175 try
190 { 176 {
191 landAccessListDa.Fill(ds.Tables["landaccesslist"]); 177 landDa.Fill(ds.Tables["land"]);
192 } 178 }
193 catch (Exception) 179 catch (Exception)
194 { 180 {
195 m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); 181 m_log.Info("[REGION DB]: Caught fill error on land table");
196 } 182 }
197 183
198 try 184 try
199 { 185 {
200 regionSettingsDa.Fill(ds.Tables["regionsettings"]); 186 landAccessListDa.Fill(ds.Tables["landaccesslist"]);
201 } 187 }
202 catch (Exception) 188 catch (Exception)
203 { 189 {
204 m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); 190 m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
205 } 191 }
206 192
207 // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! 193 try
208 // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 194 {
209 // Possibly because we manually set up our own DataTables before connecting to the database 195 regionSettingsDa.Fill(ds.Tables["regionsettings"]);
210 CreateDataSetMapping(primDa, "prims");
211 CreateDataSetMapping(shapeDa, "primshapes");
212 CreateDataSetMapping(itemsDa, "primitems");
213 CreateDataSetMapping(terrainDa, "terrain");
214 CreateDataSetMapping(landDa, "land");
215 CreateDataSetMapping(landAccessListDa, "landaccesslist");
216 CreateDataSetMapping(regionSettingsDa, "regionsettings");
217 } 196 }
197 catch (Exception)
198 {
199 m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
200 }
201 return;
218 } 202 }
219 catch (Exception e)
220 {
221 m_log.Error(e);
222 Environment.Exit(23);
223 }
224
225 return;
226 } 203 }
227 204
228 public void Dispose() 205 public void Dispose()
@@ -626,7 +603,7 @@ namespace OpenSim.Data.SQLiteNG
626 } 603 }
627 } 604 }
628 } 605 }
629 rev = Convert.ToInt32(row["Revision"]); 606 rev = (int) row["Revision"];
630 } 607 }
631 else 608 else
632 { 609 {
@@ -778,7 +755,6 @@ namespace OpenSim.Data.SQLiteNG
778 /// </summary> 755 /// </summary>
779 public void Commit() 756 public void Commit()
780 { 757 {
781 m_log.Debug("[SQLITE]: Starting commit");
782 lock (ds) 758 lock (ds)
783 { 759 {
784 primDa.Update(ds, "prims"); 760 primDa.Update(ds, "prims");
@@ -793,11 +769,18 @@ namespace OpenSim.Data.SQLiteNG
793 { 769 {
794 regionSettingsDa.Update(ds, "regionsettings"); 770 regionSettingsDa.Update(ds, "regionsettings");
795 } 771 }
796 catch (SqliteException SqlEx) 772 catch (SqliteExecutionException SqlEx)
797 { 773 {
798 throw new Exception( 774 if (SqlEx.Message.Contains("logic error"))
799 "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", 775 {
800 SqlEx); 776 throw new Exception(
777 "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
778 SqlEx);
779 }
780 else
781 {
782 throw SqlEx;
783 }
801 } 784 }
802 ds.AcceptChanges(); 785 ds.AcceptChanges();
803 } 786 }
@@ -819,15 +802,6 @@ namespace OpenSim.Data.SQLiteNG
819 * 802 *
820 **********************************************************************/ 803 **********************************************************************/
821 804
822 protected void CreateDataSetMapping(IDataAdapter da, string tableName)
823 {
824 ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
825 foreach (DataColumn col in ds.Tables[tableName].Columns)
826 {
827 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
828 }
829 }
830
831 /// <summary> 805 /// <summary>
832 /// 806 ///
833 /// </summary> 807 /// </summary>
@@ -1990,7 +1964,6 @@ namespace OpenSim.Data.SQLiteNG
1990 sql += ") values (:"; 1964 sql += ") values (:";
1991 sql += String.Join(", :", cols); 1965 sql += String.Join(", :", cols);
1992 sql += ")"; 1966 sql += ")";
1993 m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
1994 SqliteCommand cmd = new SqliteCommand(sql); 1967 SqliteCommand cmd = new SqliteCommand(sql);
1995 1968
1996 // this provides the binding for all our parameters, so 1969 // this provides the binding for all our parameters, so
@@ -2286,36 +2259,6 @@ namespace OpenSim.Data.SQLiteNG
2286 return DbType.String; 2259 return DbType.String;
2287 } 2260 }
2288 } 2261 }
2289
2290 static void PrintDataSet(DataSet ds)
2291 {
2292 // Print out any name and extended properties.
2293 Console.WriteLine("DataSet is named: {0}", ds.DataSetName);
2294 foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
2295 {
2296 Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
2297 }
2298 Console.WriteLine();
2299 foreach (DataTable dt in ds.Tables)
2300 {
2301 Console.WriteLine("=> {0} Table:", dt.TableName);
2302 // Print out the column names.
2303 for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
2304 {
2305 Console.Write(dt.Columns[curCol].ColumnName + "\t");
2306 }
2307 Console.WriteLine("\n----------------------------------");
2308 // Print the DataTable.
2309 for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
2310 {
2311 for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
2312 {
2313 Console.Write(dt.Rows[curRow][curCol].ToString() + "\t");
2314 }
2315 Console.WriteLine();
2316 }
2317 }
2318 }
2319 2262
2320 } 2263 }
2321} 2264}
diff --git a/OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs
index f77159c..27553c6 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs
@@ -31,9 +31,9 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using Mono.Data.Sqlite; 34using Mono.Data.SqliteClient;
35 35
36namespace OpenSim.Data.SQLiteNG 36namespace OpenSim.Data.SQLiteLegacy
37{ 37{
38 public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData 38 public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData
39 { 39 {
@@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLiteNG
66 66
67 if (words.Length == 1) 67 if (words.Length == 1)
68 { 68 {
69 cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')", 69 cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
70 m_Realm, scopeID.ToString(), words[0]); 70 m_Realm, scopeID.ToString(), words[0]);
71 } 71 }
72 else 72 else
diff --git a/OpenSim/Data/SQLiteNG/SQLiteUtils.cs b/OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs
index 82a2e37..095a262 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteUtils.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs
@@ -27,9 +27,9 @@
27 27
28using System; 28using System;
29using System.Data; 29using System.Data;
30using Mono.Data.Sqlite; 30using Mono.Data.SqliteClient;
31 31
32namespace OpenSim.Data.SQLiteNG 32namespace OpenSim.Data.SQLiteLegacy
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// A base class for methods needed by all SQLite database classes 35 /// A base class for methods needed by all SQLite database classes
diff --git a/OpenSim/Data/SQLiteNG/SQLiteXInventoryData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs
index a0c17f8..5422cbf 100644
--- a/OpenSim/Data/SQLiteNG/SQLiteXInventoryData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs
@@ -29,12 +29,12 @@ using System;
29using System.Data; 29using System.Data;
30using System.Reflection; 30using System.Reflection;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using Mono.Data.Sqlite; 32using Mono.Data.SqliteClient;
33using log4net; 33using log4net;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36 36
37namespace OpenSim.Data.SQLiteNG 37namespace OpenSim.Data.SQLiteLegacy
38{ 38{
39 /// <summary> 39 /// <summary>
40 /// A MySQL Interface for the Asset Server 40 /// A MySQL Interface for the Asset Server
@@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLiteNG
147 } 147 }
148 148
149 reader.Close(); 149 reader.Close();
150 //CloseCommand(cmd); 150 CloseCommand(cmd);
151 151
152 return perms; 152 return perms;
153 } 153 }
diff --git a/OpenSim/Data/Tests/DataTestUtil.cs b/OpenSim/Data/Tests/DataTestUtil.cs
index d211ab3..5393529 100644
--- a/OpenSim/Data/Tests/DataTestUtil.cs
+++ b/OpenSim/Data/Tests/DataTestUtil.cs
@@ -39,7 +39,8 @@ namespace OpenSim.Data.Tests
39 public class DataTestUtil 39 public class DataTestUtil
40 { 40 {
41 public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; 41 public const uint UNSIGNED_INTEGER_MIN = uint.MinValue;
42 public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue; 42 //public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue;
43 public const uint UNSIGNED_INTEGER_MAX = INTEGER_MAX;
43 44
44 public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue 45 public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue
45 public const int INTEGER_MAX = int.MaxValue; 46 public const int INTEGER_MAX = int.MaxValue;
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 23d5b3c..febd4ca 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -365,6 +365,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
365 List<UUID> GetOnlineFriends(UUID userID) 365 List<UUID> GetOnlineFriends(UUID userID)
366 { 366 {
367 List<string> friendList = new List<string>(); 367 List<string> friendList = new List<string>();
368 List<UUID> online = new List<UUID>();
368 369
369 foreach (FriendInfo fi in m_Friends[userID].Friends) 370 foreach (FriendInfo fi in m_Friends[userID].Friends)
370 { 371 {
@@ -372,9 +373,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
372 friendList.Add(fi.Friend); 373 friendList.Add(fi.Friend);
373 } 374 }
374 375
375 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); 376 if (friendList.Count == 0)
377 // no friends whatsoever
378 return online;
376 379
377 List<UUID> online = new List<UUID>(); 380 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
378 381
379 foreach (PresenceInfo pi in presence) 382 foreach (PresenceInfo pi in presence)
380 { 383 {
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 0a5ff3f..c738296 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -47,6 +47,7 @@
47 <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" /> 47 <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" />
48 <RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" /> 48 <RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" />
49 <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> 49 <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" />
50 <RegionModule id="HGInventoryBroker2" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker2" />
50 <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> 51 <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" />
51 <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> 52 <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" />
52 <RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" /> 53 <RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" />
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs
index 3509161..fc3393f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs
@@ -41,27 +41,22 @@ using OpenMetaverse;
41 41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
43{ 43{
44 public class HGInventoryBroker2 : INonSharedRegionModule, IInventoryService 44 public class HGInventoryBroker2 : ISharedRegionModule, IInventoryService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType); 48 MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 private static bool m_Initialized = false;
51 private static bool m_Enabled = false; 50 private static bool m_Enabled = false;
52 51
53 private static IInventoryService m_LocalGridInventoryService; 52 private static IInventoryService m_LocalGridInventoryService;
54 private static ISessionAuthInventoryService m_HGService; // obsolete
55 private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>(); 53 private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>();
56 54
57 // A cache of userIDs --> ServiceURLs, for HGBroker only 55 // A cache of userIDs --> ServiceURLs, for HGBroker only
58 protected Dictionary<UUID, string> m_InventoryURLs; 56 protected Dictionary<UUID, string> m_InventoryURLs = new Dictionary<UUID,string>();
59 57
60 private Scene m_Scene;
61 private List<Scene> m_Scenes = new List<Scene>(); 58 private List<Scene> m_Scenes = new List<Scene>();
62 59
63 private IUserAccountService m_UserAccountService;
64
65 public Type ReplaceableInterface 60 public Type ReplaceableInterface
66 { 61 {
67 get { return null; } 62 get { return null; }
@@ -74,65 +69,45 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
74 69
75 public void Initialise(IConfigSource source) 70 public void Initialise(IConfigSource source)
76 { 71 {
77 if (!m_Initialized) 72 IConfig moduleConfig = source.Configs["Modules"];
73 if (moduleConfig != null)
78 { 74 {
79 IConfig moduleConfig = source.Configs["Modules"]; 75 string name = moduleConfig.GetString("InventoryServices", "");
80 if (moduleConfig != null) 76 if (name == Name)
81 { 77 {
82 string name = moduleConfig.GetString("InventoryServices", ""); 78 IConfig inventoryConfig = source.Configs["InventoryService"];
83 if (name == Name) 79 if (inventoryConfig == null)
84 { 80 {
85 IConfig inventoryConfig = source.Configs["InventoryService"]; 81 m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
86 if (inventoryConfig == null) 82 return;
87 { 83 }
88 m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
89 return;
90 }
91
92 string localDll = inventoryConfig.GetString("LocalGridInventoryService",
93 String.Empty);
94 string HGDll = inventoryConfig.GetString("HypergridInventoryService",
95 String.Empty);
96
97 if (localDll == String.Empty)
98 {
99 m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
100 //return;
101 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
102 }
103
104 if (HGDll == String.Empty)
105 {
106 m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService");
107 //return;
108 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
109 }
110 84
111 Object[] args = new Object[] { source }; 85 string localDll = inventoryConfig.GetString("LocalGridInventoryService",
112 m_LocalGridInventoryService = 86 String.Empty);
113 ServerUtils.LoadPlugin<IInventoryService>(localDll, 87 //string HGDll = inventoryConfig.GetString("HypergridInventoryService",
114 args); 88 // String.Empty);
115 89
116 m_HGService = 90 if (localDll == String.Empty)
117 ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll, 91 {
118 args); 92 m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
93 //return;
94 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
95 }
119 96
120 if (m_LocalGridInventoryService == null) 97 Object[] args = new Object[] { source };
121 { 98 m_LocalGridInventoryService =
122 m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); 99 ServerUtils.LoadPlugin<IInventoryService>(localDll,
123 return; 100 args);
124 }
125 if (m_HGService == null)
126 {
127 m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service");
128 return;
129 }
130 101
131 m_Enabled = true; 102 if (m_LocalGridInventoryService == null)
132 m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); 103 {
104 m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service");
105 return;
133 } 106 }
107
108 m_Enabled = true;
109 m_log.InfoFormat("[HG INVENTORY CONNECTOR]: HG inventory broker enabled with inner connector of type {0}", m_LocalGridInventoryService.GetType());
134 } 110 }
135 m_Initialized = true;
136 } 111 }
137 } 112 }
138 113
@@ -149,13 +124,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
149 if (!m_Enabled) 124 if (!m_Enabled)
150 return; 125 return;
151 126
152 m_Scene = scene;
153 m_Scenes.Add(scene); 127 m_Scenes.Add(scene);
154 m_UserAccountService = m_Scene.UserAccountService;
155 128
156 scene.RegisterModuleInterface<IInventoryService>(this); 129 scene.RegisterModuleInterface<IInventoryService>(this);
157 130
158 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
159 scene.EventManager.OnClientClosed += OnClientClosed; 131 scene.EventManager.OnClientClosed += OnClientClosed;
160 132
161 } 133 }
@@ -177,13 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
177 149
178 } 150 }
179 151
180 #region Cache 152 #region URL Cache
181
182 void OnMakeRootAgent(ScenePresence presence)
183 {
184 if (!m_InventoryURLs.ContainsKey(presence.UUID))
185 CacheInventoryServiceURL(presence.Scene, presence.UUID);
186 }
187 153
188 void OnClientClosed(UUID clientID, Scene scene) 154 void OnClientClosed(UUID clientID, Scene scene)
189 { 155 {
@@ -200,10 +166,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
200 return; 166 return;
201 } 167 }
202 } 168 }
203
204 m_log.DebugFormat(
205 "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping inventory URL",
206 scene.RegionInfo.RegionName, clientID);
207 DropInventoryServiceURL(clientID); 169 DropInventoryServiceURL(clientID);
208 } 170 }
209 } 171 }
@@ -213,35 +175,47 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
213 /// and sticks it in the cache 175 /// and sticks it in the cache
214 /// </summary> 176 /// </summary>
215 /// <param name="userID"></param> 177 /// <param name="userID"></param>
216 private void CacheInventoryServiceURL(Scene scene, UUID userID) 178 private void CacheInventoryServiceURL(UUID userID)
217 { 179 {
218 if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null) 180 if (m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID) == null)
219 { 181 {
220 // The user does not have a local account; let's cache its service URL 182 // The user does not have a local account; let's cache its service URL
221 string inventoryURL = string.Empty; 183 string inventoryURL = string.Empty;
222 ScenePresence sp = null; 184 ScenePresence sp = null;
223 scene.TryGetScenePresence(userID, out sp); 185 foreach (Scene scene in m_Scenes)
224 if (sp != null)
225 { 186 {
226 AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 187 scene.TryGetScenePresence(userID, out sp);
227 if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) 188 if (sp != null)
228 { 189 {
229 inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); 190 AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
230 if (inventoryURL != null && inventoryURL != string.Empty) 191 if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
231 { 192 {
232 inventoryURL = inventoryURL.Trim(new char[] { '/' }); 193 inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
233 m_InventoryURLs.Add(userID, inventoryURL); 194 if (inventoryURL != null && inventoryURL != string.Empty)
195 {
196 inventoryURL = inventoryURL.Trim(new char[] { '/' });
197 m_InventoryURLs.Add(userID, inventoryURL);
198 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL);
199 return;
200 }
234 } 201 }
235 } 202 }
236 } 203 }
237 } 204 }
205
206 // else put a null; it means that the methods should forward to local grid's inventory
207 m_InventoryURLs.Add(userID, null);
238 } 208 }
239 209
240 private void DropInventoryServiceURL(UUID userID) 210 private void DropInventoryServiceURL(UUID userID)
241 { 211 {
242 lock (m_InventoryURLs) 212 lock (m_InventoryURLs)
243 if (m_InventoryURLs.ContainsKey(userID)) 213 if (m_InventoryURLs.ContainsKey(userID))
214 {
215 string url = m_InventoryURLs[userID];
244 m_InventoryURLs.Remove(userID); 216 m_InventoryURLs.Remove(userID);
217 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Removed {0} from the cache of inventory URLs", url);
218 }
245 } 219 }
246 220
247 public string GetInventoryServiceURL(UUID userID) 221 public string GetInventoryServiceURL(UUID userID)
@@ -249,7 +223,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
249 if (m_InventoryURLs.ContainsKey(userID)) 223 if (m_InventoryURLs.ContainsKey(userID))
250 return m_InventoryURLs[userID]; 224 return m_InventoryURLs[userID];
251 225
252 return null; 226 else
227 CacheInventoryServiceURL(userID);
228
229 return m_InventoryURLs[userID];
253 } 230 }
254 #endregion 231 #endregion
255 232
@@ -276,7 +253,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
276 253
277 public InventoryFolderBase GetRootFolder(UUID userID) 254 public InventoryFolderBase GetRootFolder(UUID userID)
278 { 255 {
279 m_log.DebugFormat("[HGInventory]: GetRootFolder for {0}", userID); 256 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
280 257
281 string invURL = GetInventoryServiceURL(userID); 258 string invURL = GetInventoryServiceURL(userID);
282 259
@@ -290,7 +267,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
290 267
291 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 268 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
292 { 269 {
293 m_log.DebugFormat("[HGInventory]: GetFolderForType {0} type {1}", userID, type); 270 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
294 271
295 string invURL = GetInventoryServiceURL(userID); 272 string invURL = GetInventoryServiceURL(userID);
296 273
@@ -304,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
304 281
305 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 282 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
306 { 283 {
307 m_log.Debug("[HGInventory]: GetFolderContent " + folderID); 284 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
308 285
309 string invURL = GetInventoryServiceURL(userID); 286 string invURL = GetInventoryServiceURL(userID);
310 287
@@ -319,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
319 296
320 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 297 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
321 { 298 {
322 m_log.Debug("[HGInventory]: GetFolderItems " + folderID); 299 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
323 300
324 string invURL = GetInventoryServiceURL(userID); 301 string invURL = GetInventoryServiceURL(userID);
325 302
@@ -337,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
337 if (folder == null) 314 if (folder == null)
338 return false; 315 return false;
339 316
340 m_log.Debug("[HGInventory]: AddFolder " + folder.ID); 317 m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
341 318
342 string invURL = GetInventoryServiceURL(folder.Owner); 319 string invURL = GetInventoryServiceURL(folder.Owner);
343 320
@@ -354,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
354 if (folder == null) 331 if (folder == null)
355 return false; 332 return false;
356 333
357 m_log.Debug("[HGInventory]: UpdateFolder " + folder.ID); 334 m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
358 335
359 string invURL = GetInventoryServiceURL(folder.Owner); 336 string invURL = GetInventoryServiceURL(folder.Owner);
360 337
@@ -373,7 +350,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
373 if (folderIDs.Count == 0) 350 if (folderIDs.Count == 0)
374 return false; 351 return false;
375 352
376 m_log.Debug("[HGInventory]: DeleteFolders for " + ownerID); 353 m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
377 354
378 string invURL = GetInventoryServiceURL(ownerID); 355 string invURL = GetInventoryServiceURL(ownerID);
379 356
@@ -390,7 +367,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
390 if (folder == null) 367 if (folder == null)
391 return false; 368 return false;
392 369
393 m_log.Debug("[HGInventory]: MoveFolder for " + folder.Owner); 370 m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
394 371
395 string invURL = GetInventoryServiceURL(folder.Owner); 372 string invURL = GetInventoryServiceURL(folder.Owner);
396 373
@@ -407,7 +384,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
407 if (folder == null) 384 if (folder == null)
408 return false; 385 return false;
409 386
410 m_log.Debug("[HGInventory]: PurgeFolder for " + folder.Owner); 387 m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
411 388
412 string invURL = GetInventoryServiceURL(folder.Owner); 389 string invURL = GetInventoryServiceURL(folder.Owner);
413 390
@@ -424,7 +401,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
424 if (item == null) 401 if (item == null)
425 return false; 402 return false;
426 403
427 m_log.Debug("[HGInventory]: AddItem " + item.ID); 404 m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
428 405
429 string invURL = GetInventoryServiceURL(item.Owner); 406 string invURL = GetInventoryServiceURL(item.Owner);
430 407
@@ -441,7 +418,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
441 if (item == null) 418 if (item == null)
442 return false; 419 return false;
443 420
444 m_log.Debug("[HGInventory]: UpdateItem " + item.ID); 421 m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
445 422
446 string invURL = GetInventoryServiceURL(item.Owner); 423 string invURL = GetInventoryServiceURL(item.Owner);
447 424
@@ -460,7 +437,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
460 if (items.Count == 0) 437 if (items.Count == 0)
461 return true; 438 return true;
462 439
463 m_log.Debug("[HGInventory]: MoveItems for " + ownerID); 440 m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
464 441
465 string invURL = GetInventoryServiceURL(ownerID); 442 string invURL = GetInventoryServiceURL(ownerID);
466 443
@@ -481,7 +458,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
481 if (itemIDs.Count == 0) 458 if (itemIDs.Count == 0)
482 return true; 459 return true;
483 460
484 m_log.Debug("[HGInventory]: DeleteItems for " + ownerID); 461 m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID);
485 462
486 string invURL = GetInventoryServiceURL(ownerID); 463 string invURL = GetInventoryServiceURL(ownerID);
487 464
@@ -497,7 +474,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
497 { 474 {
498 if (item == null) 475 if (item == null)
499 return null; 476 return null;
500 m_log.Debug("[HGInventory]: GetItem " + item.ID); 477 m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
501 478
502 string invURL = GetInventoryServiceURL(item.Owner); 479 string invURL = GetInventoryServiceURL(item.Owner);
503 480
@@ -514,7 +491,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
514 if (folder == null) 491 if (folder == null)
515 return null; 492 return null;
516 493
517 m_log.Debug("[HGInventory]: GetFolder " + folder.ID); 494 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
518 495
519 string invURL = GetInventoryServiceURL(folder.Owner); 496 string invURL = GetInventoryServiceURL(folder.Owner);
520 497
@@ -538,7 +515,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
538 515
539 public int GetAssetPermissions(UUID userID, UUID assetID) 516 public int GetAssetPermissions(UUID userID, UUID assetID)
540 { 517 {
541 m_log.Debug("[HGInventory]: GetAssetPermissions " + assetID); 518 m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
542 519
543 string invURL = GetInventoryServiceURL(userID); 520 string invURL = GetInventoryServiceURL(userID);
544 521
@@ -575,44 +552,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
575 return connector; 552 return connector;
576 } 553 }
577 554
578
579 private UUID GetSessionID(UUID userID)
580 {
581 ScenePresence sp = null;
582 if (m_Scene.TryGetScenePresence(userID, out sp))
583 {
584 return sp.ControllingClient.SessionId;
585 }
586
587 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scene presence for {0} not found", userID);
588 return UUID.Zero;
589 }
590
591 private bool IsForeignUser(UUID userID, out string inventoryURL)
592 {
593 inventoryURL = string.Empty;
594 UserAccount account = null;
595 if (m_Scene.UserAccountService != null)
596 account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
597
598 if (account == null) // foreign user
599 {
600 ScenePresence sp = null;
601 m_Scene.TryGetScenePresence(userID, out sp);
602 if (sp != null)
603 {
604 AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
605 if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
606 {
607 inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
608 inventoryURL = inventoryURL.Trim(new char[] { '/' });
609 return true;
610 }
611 }
612 }
613 return false;
614 }
615
616
617 } 555 }
618} 556}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index ac9e792..277060d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -172,11 +172,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
172 return m_RemoteConnector.GetFolderForType(userID, type); 172 return m_RemoteConnector.GetFolderForType(userID, type);
173 } 173 }
174 174
175 public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
176 {
177 return m_RemoteConnector.GetSystemFolders(userID);
178 }
179
180 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 175 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
181 { 176 {
182 return m_RemoteConnector.GetFolderContent(userID, folderID); 177 return m_RemoteConnector.GetFolderContent(userID, folderID);
@@ -267,9 +262,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
267 262
268 public InventoryItemBase GetItem(InventoryItemBase item) 263 public InventoryItemBase GetItem(InventoryItemBase item)
269 { 264 {
265 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
270 if (item == null) 266 if (item == null)
271 return null; 267 return null;
272 268
269 if (m_RemoteConnector == null)
270 m_log.DebugFormat("[XINVENTORY CONNECTOR]: connector stub is null!!!");
273 return m_RemoteConnector.GetItem(item); 271 return m_RemoteConnector.GetItem(item);
274 } 272 }
275 273
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs
index 865f99e..5f3666e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
76 76
77 m_PresenceDetector = new PresenceDetector(this); 77 m_PresenceDetector = new PresenceDetector(this);
78 78
79 m_log.Info("[INVENTORY CONNECTOR]: Remote presence enabled"); 79 m_log.Info("[REMOTE PRESENCE CONNECTOR]: Remote presence enabled");
80 } 80 }
81 } 81 }
82 82
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs
deleted file mode 100644
index 41897eb..0000000
--- a/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using log4net;
34using Nini.Config;
35using Nwc.XmlRpc;
36using OpenSim.Server.Base;
37using OpenSim.Server.Handlers.Inventory;
38using OpenSim.Services.Interfaces;
39using OpenSim.Framework;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Server.Handlers.Base;
42using OpenMetaverse;
43
44namespace OpenSim.Server.Handlers.Hypergrid
45{
46 public class HGInventoryServiceInConnector : InventoryServiceInConnector
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 //private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs
51 //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME);
52
53 private IUserAgentService m_UserAgentService;
54
55 public HGInventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
56 base(config, server, configName)
57 {
58 IConfig serverConfig = config.Configs[m_ConfigName];
59 if (serverConfig == null)
60 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
61
62 string userAgentService = serverConfig.GetString("UserAgentService", string.Empty);
63 string m_userserver_url = serverConfig.GetString("UserAgentURI", String.Empty);
64 if (m_userserver_url != string.Empty)
65 {
66 Object[] args = new Object[] { m_userserver_url };
67 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(userAgentService, args);
68 }
69
70 AddHttpHandlers(server);
71 m_log.Debug("[HG INVENTORY HANDLER]: handlers initialized");
72 }
73
74 /// <summary>
75 /// Check that the source of an inventory request for a particular agent is a current session belonging to
76 /// that agent.
77 /// </summary>
78 /// <param name="session_id"></param>
79 /// <param name="avatar_id"></param>
80 /// <returns></returns>
81 public override bool CheckAuthSession(string session_id, string avatar_id)
82 {
83 //m_log.InfoFormat("[HG INVENTORY IN CONNECTOR]: checking authed session {0} {1}", session_id, avatar_id);
84 // This doesn't work
85
86 // if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
87 // {
88 // //cache miss, ask userserver
89 // m_UserAgentService.VerifyAgent(session_id, ???);
90 // }
91 // else
92 // {
93 // // cache hits
94 // m_log.Info("[HG INVENTORY IN CONNECTOR]: got authed session from cache");
95 // return true;
96 // }
97
98 // m_log.Warn("[HG INVENTORY IN CONNECTOR]: unknown session_id, request rejected");
99 // return false;
100
101 return true;
102 }
103 }
104}
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 16b05df..b0fee6d 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -144,8 +144,6 @@ namespace OpenSim.Server.Handlers.Asset
144 return HandleGetActiveGestures(request); 144 return HandleGetActiveGestures(request);
145 case "GETASSETPERMISSIONS": 145 case "GETASSETPERMISSIONS":
146 return HandleGetAssetPermissions(request); 146 return HandleGetAssetPermissions(request);
147 case "GETSYSTEMFOLDERS":
148 return HandleGetSystemFolders(request);
149 } 147 }
150 m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); 148 m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method);
151 } 149 }
@@ -575,29 +573,6 @@ namespace OpenSim.Server.Handlers.Asset
575 return encoding.GetBytes(xmlString); 573 return encoding.GetBytes(xmlString);
576 } 574 }
577 575
578 byte[] HandleGetSystemFolders(Dictionary<string, object> request)
579 {
580 Dictionary<string, object> result = new Dictionary<string, object>();
581 UUID principal = UUID.Zero;
582 UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
583
584 Dictionary<AssetType, InventoryFolderBase> sfolders = GetSystemFolders(principal);
585 //m_log.DebugFormat("[XXX]: SystemFolders got {0} folders", sfolders.Count);
586
587 Dictionary<string, object> folders = new Dictionary<string, object>();
588 int i = 0;
589 foreach (KeyValuePair<AssetType, InventoryFolderBase> kvp in sfolders)
590 {
591 folders["folder_" + i.ToString()] = EncodeFolder(kvp.Value);
592 i++;
593 }
594 result["FOLDERS"] = folders;
595
596 string xmlString = ServerUtils.BuildXmlResponse(result);
597 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
598 UTF8Encoding encoding = new UTF8Encoding();
599 return encoding.GetBytes(xmlString);
600 }
601 576
602 private Dictionary<string, object> EncodeFolder(InventoryFolderBase f) 577 private Dictionary<string, object> EncodeFolder(InventoryFolderBase f)
603 { 578 {
@@ -683,30 +658,5 @@ namespace OpenSim.Server.Handlers.Asset
683 return item; 658 return item;
684 } 659 }
685 660
686 #region Extra
687 private Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
688 {
689 InventoryFolderBase root = m_InventoryService.GetRootFolder(userID);
690 if (root != null)
691 {
692 InventoryCollection content = m_InventoryService.GetFolderContent(userID, root.ID);
693 if (content != null)
694 {
695 Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>();
696 foreach (InventoryFolderBase folder in content.Folders)
697 {
698 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
699 folders[(AssetType)folder.Type] = folder;
700 }
701 // Put the root folder there, as type Folder
702 folders[AssetType.Folder] = root;
703 return folders;
704 }
705 }
706 m_log.WarnFormat("[XINVENTORY SERVICE]: System folders for {0} not found", userID);
707 return new Dictionary<AssetType, InventoryFolderBase>();
708 }
709 #endregion
710
711 } 661 }
712} 662}
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index 52294da..e25e7eb 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -158,30 +158,31 @@ namespace OpenSim.Services.Connectors
158 158
159 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) 159 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
160 { 160 {
161 Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
162 new Dictionary<string,object> {
163 { "PRINCIPAL", principalID.ToString() },
164 { "FOLDER", folderID.ToString() }
165 });
166
167 if (ret == null)
168 return null;
169 if (ret.Count == 0)
170 return null;
171
172
173 InventoryCollection inventory = new InventoryCollection(); 161 InventoryCollection inventory = new InventoryCollection();
174 inventory.Folders = new List<InventoryFolderBase>();
175 inventory.Items = new List<InventoryItemBase>();
176 inventory.UserID = principalID;
177 162
178 Dictionary<string,object> folders =
179 (Dictionary<string,object>)ret["FOLDERS"];
180 Dictionary<string,object> items =
181 (Dictionary<string,object>)ret["ITEMS"];
182
183 try 163 try
184 { 164 {
165 Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
166 new Dictionary<string,object> {
167 { "PRINCIPAL", principalID.ToString() },
168 { "FOLDER", folderID.ToString() }
169 });
170
171 if (ret == null)
172 return null;
173 if (ret.Count == 0)
174 return null;
175
176
177 inventory.Folders = new List<InventoryFolderBase>();
178 inventory.Items = new List<InventoryItemBase>();
179 inventory.UserID = principalID;
180
181 Dictionary<string,object> folders =
182 (Dictionary<string,object>)ret["FOLDERS"];
183 Dictionary<string,object> items =
184 (Dictionary<string,object>)ret["ITEMS"];
185
185 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i 186 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
186 inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); 187 inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
187 foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i 188 foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
@@ -189,7 +190,7 @@ namespace OpenSim.Services.Connectors
189 } 190 }
190 catch (Exception e) 191 catch (Exception e)
191 { 192 {
192 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping content list: {0}", e.Message); 193 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolderContent: {0}", e.Message);
193 } 194 }
194 195
195 return inventory; 196 return inventory;
@@ -408,32 +409,50 @@ namespace OpenSim.Services.Connectors
408 409
409 public InventoryItemBase GetItem(InventoryItemBase item) 410 public InventoryItemBase GetItem(InventoryItemBase item)
410 { 411 {
411 Dictionary<string,object> ret = MakeRequest("GETITEM", 412 try
412 new Dictionary<string,object> { 413 {
414 Dictionary<string, object> ret = MakeRequest("GETITEM",
415 new Dictionary<string, object> {
413 { "ID", item.ID.ToString() } 416 { "ID", item.ID.ToString() }
414 }); 417 });
415 418
416 if (ret == null) 419 if (ret == null)
417 return null; 420 return null;
418 if (ret.Count == 0) 421 if (ret.Count == 0)
419 return null; 422 return null;
423
424 return BuildItem((Dictionary<string, object>)ret["item"]);
425 }
426 catch (Exception e)
427 {
428 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetItem: {0}", e.Message);
429 }
420 430
421 return BuildItem((Dictionary<string, object>)ret["item"]); 431 return null;
422 } 432 }
423 433
424 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 434 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
425 { 435 {
426 Dictionary<string,object> ret = MakeRequest("GETFOLDER", 436 try
427 new Dictionary<string,object> { 437 {
438 Dictionary<string, object> ret = MakeRequest("GETFOLDER",
439 new Dictionary<string, object> {
428 { "ID", folder.ID.ToString() } 440 { "ID", folder.ID.ToString() }
429 }); 441 });
430 442
431 if (ret == null) 443 if (ret == null)
432 return null; 444 return null;
433 if (ret.Count == 0) 445 if (ret.Count == 0)
434 return null; 446 return null;
435 447
436 return BuildFolder((Dictionary<string, object>)ret["folder"]); 448 return BuildFolder((Dictionary<string, object>)ret["folder"]);
449 }
450 catch (Exception e)
451 {
452 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolder: {0}", e.Message);
453 }
454
455 return null;
437 } 456 }
438 457
439 public List<InventoryItemBase> GetActiveGestures(UUID principalID) 458 public List<InventoryItemBase> GetActiveGestures(UUID principalID)
@@ -468,36 +487,6 @@ namespace OpenSim.Services.Connectors
468 return int.Parse(ret["RESULT"].ToString()); 487 return int.Parse(ret["RESULT"].ToString());
469 } 488 }
470 489
471 public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
472 {
473 Dictionary<string, object> ret = MakeRequest("GETSYSTEMFOLDERS",
474 new Dictionary<string, object> {
475 { "PRINCIPAL", userID.ToString() },
476 });
477
478 if (ret == null)
479 return new Dictionary<AssetType,InventoryFolderBase>();
480
481 Dictionary<AssetType, InventoryFolderBase> sfolders = new Dictionary<AssetType, InventoryFolderBase>();
482
483 try
484 {
485 Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"];
486
487 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
488 {
489 InventoryFolderBase folder = BuildFolder((Dictionary<string, object>)o);
490 sfolders.Add((AssetType)folder.Type, folder);
491 }
492
493 }
494 catch (Exception e)
495 {
496 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: exception {0}", e.Message);
497 }
498
499 return sfolders;
500 }
501 490
502 // These are either obsolete or unused 491 // These are either obsolete or unused
503 // 492 //
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
index 4dadd9e..23621b7 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
@@ -329,7 +329,7 @@ namespace OpenSim.Services.Connectors
329 reqString); 329 reqString);
330 if (reply == null || (reply != null && reply == string.Empty)) 330 if (reply == null || (reply != null && reply == string.Empty))
331 { 331 {
332 m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); 332 m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply");
333 return null; 333 return null;
334 } 334 }
335 } 335 }