aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r--OpenSim/Data/SQLite/Properties/AssemblyInfo.cs10
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs24
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs34
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs116
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs36
-rw-r--r--OpenSim/Data/SQLite/SQLiteUtils.cs4
6 files changed, 112 insertions, 112 deletions
diff --git a/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs b/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
index 4616cbc..221495e 100644
--- a/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
+++ b/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
@@ -28,7 +28,7 @@
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30 30
31// General Information about an assembly is controlled through the following 31// General information about an assembly is controlled through the following
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
@@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
41[assembly : AssemblyTrademark("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")] 42[assembly : AssemblyCulture("")]
43 43
44// Setting ComVisible to false makes the types in this assembly not visible 44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from 45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type. 46// COM, set the ComVisible attribute to true on that type.
47 47
48[assembly : ComVisible(false)] 48[assembly : ComVisible(false)]
@@ -54,11 +54,11 @@ using System.Runtime.InteropServices;
54// Version information for an assembly consists of the following four values: 54// Version information for an assembly consists of the following four values:
55// 55//
56// Major Version 56// Major Version
57// Minor Version 57// Minor Version
58// Build Number 58// Build Number
59// Revision 59// Revision
60// 60//
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("1.0.0.0")] 64[assembly : AssemblyVersion("1.0.0.0")]
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index 34329bb..8d4fb99 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Data.SQLite
51 private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; 51 private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
52 private const string DeleteAssetSQL = "delete from assets where UUID=:UUID"; 52 private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
53 private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, InvType, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :InvType, :Local, :Temporary, :Data)"; 53 private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, InvType, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :InvType, :Local, :Temporary, :Data)";
54 private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, InvType=:InvType, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID"; 54 private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, InvType=:InvType, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
55 private const string assetSelect = "select * from assets"; 55 private const string assetSelect = "select * from assets";
56 56
57 private SqliteConnection m_conn; 57 private SqliteConnection m_conn;
@@ -70,11 +70,11 @@ namespace OpenSim.Data.SQLite
70 70
71 override public AssetBase FetchAsset(LLUUID uuid) 71 override public AssetBase FetchAsset(LLUUID uuid)
72 { 72 {
73 73
74 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) 74 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
75 { 75 {
76 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); 76 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
77 using (IDataReader reader = cmd.ExecuteReader()) 77 using (IDataReader reader = cmd.ExecuteReader())
78 { 78 {
79 if (reader.Read()) 79 if (reader.Read())
80 { 80 {
@@ -98,7 +98,7 @@ namespace OpenSim.Data.SQLite
98 { 98 {
99 m_log.Info("[ASSET DB]: Asset exists already, ignoring."); 99 m_log.Info("[ASSET DB]: Asset exists already, ignoring.");
100 } 100 }
101 else 101 else
102 { 102 {
103 using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) 103 using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
104 { 104 {
@@ -110,7 +110,7 @@ namespace OpenSim.Data.SQLite
110 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); 110 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
111 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); 111 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
112 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 112 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
113 113
114 cmd.ExecuteNonQuery(); 114 cmd.ExecuteNonQuery();
115 } 115 }
116 } 116 }
@@ -119,7 +119,7 @@ namespace OpenSim.Data.SQLite
119 override public void UpdateAsset(AssetBase asset) 119 override public void UpdateAsset(AssetBase asset)
120 { 120 {
121 LogAssetLoad(asset); 121 LogAssetLoad(asset);
122 122
123 using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) 123 using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
124 { 124 {
125 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); 125 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
@@ -130,7 +130,7 @@ namespace OpenSim.Data.SQLite
130 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); 130 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
131 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); 131 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
132 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 132 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
133 133
134 cmd.ExecuteNonQuery(); 134 cmd.ExecuteNonQuery();
135 } 135 }
136 136
@@ -154,14 +154,14 @@ namespace OpenSim.Data.SQLite
154 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) 154 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
155 { 155 {
156 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); 156 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
157 using (IDataReader reader = cmd.ExecuteReader()) 157 using (IDataReader reader = cmd.ExecuteReader())
158 { 158 {
159 if (reader.Read()) 159 if (reader.Read())
160 { 160 {
161 reader.Close(); 161 reader.Close();
162 return true; 162 return true;
163 } 163 }
164 else 164 else
165 { 165 {
166 reader.Close(); 166 reader.Close();
167 return false; 167 return false;
@@ -175,7 +175,7 @@ namespace OpenSim.Data.SQLite
175 using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn)) 175 using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
176 { 176 {
177 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); 177 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
178 178
179 cmd.ExecuteNonQuery(); 179 cmd.ExecuteNonQuery();
180 } 180 }
181 } 181 }
@@ -193,7 +193,7 @@ namespace OpenSim.Data.SQLite
193 /*********************************************************************** 193 /***********************************************************************
194 * 194 *
195 * Database Definition Functions 195 * Database Definition Functions
196 * 196 *
197 * This should be db agnostic as we define them in ADO.NET terms 197 * This should be db agnostic as we define them in ADO.NET terms
198 * 198 *
199 **********************************************************************/ 199 **********************************************************************/
@@ -216,7 +216,7 @@ namespace OpenSim.Data.SQLite
216 } 216 }
217 217
218 /*********************************************************************** 218 /***********************************************************************
219 * 219 *
220 * Convert between ADO.NET <=> OpenSim Objects 220 * Convert between ADO.NET <=> OpenSim Objects
221 * 221 *
222 * These should be database independant 222 * These should be database independant
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 1ab971c..5acc5f2 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -106,22 +106,22 @@ namespace OpenSim.Data.SQLite
106 // new fields 106 // new fields
107 if (!Convert.IsDBNull(row["salePrice"])) 107 if (!Convert.IsDBNull(row["salePrice"]))
108 item.SalePrice = Convert.ToInt32(row["salePrice"]); 108 item.SalePrice = Convert.ToInt32(row["salePrice"]);
109 109
110 if (!Convert.IsDBNull(row["saleType"])) 110 if (!Convert.IsDBNull(row["saleType"]))
111 item.SaleType = Convert.ToByte(row["saleType"]); 111 item.SaleType = Convert.ToByte(row["saleType"]);
112 112
113 if (!Convert.IsDBNull(row["creationDate"])) 113 if (!Convert.IsDBNull(row["creationDate"]))
114 item.CreationDate = Convert.ToInt32(row["creationDate"]); 114 item.CreationDate = Convert.ToInt32(row["creationDate"]);
115 115
116 if (!Convert.IsDBNull(row["groupID"])) 116 if (!Convert.IsDBNull(row["groupID"]))
117 item.GroupID = new LLUUID((string)row["groupID"]); 117 item.GroupID = new LLUUID((string)row["groupID"]);
118 118
119 if (!Convert.IsDBNull(row["groupOwned"])) 119 if (!Convert.IsDBNull(row["groupOwned"]))
120 item.GroupOwned = Convert.ToBoolean(row["groupOwned"]); 120 item.GroupOwned = Convert.ToBoolean(row["groupOwned"]);
121 121
122 if (!Convert.IsDBNull(row["Flags"])) 122 if (!Convert.IsDBNull(row["Flags"]))
123 item.Flags = Convert.ToUInt32(row["Flags"]); 123 item.Flags = Convert.ToUInt32(row["Flags"]);
124 124
125 return item; 125 return item;
126 } 126 }
127 127
@@ -221,7 +221,7 @@ namespace OpenSim.Data.SQLite
221 { 221 {
222 if (add) 222 if (add)
223 m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID); 223 m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID);
224 224
225 fillItemRow(inventoryRow, item); 225 fillItemRow(inventoryRow, item);
226 } 226 }
227 invItemsDa.Update(ds, "inventoryitems"); 227 invItemsDa.Update(ds, "inventoryitems");
@@ -314,9 +314,9 @@ namespace OpenSim.Data.SQLite
314 314
315 // There should only ever be one root folder for a user. However, if there's more 315 // There should only ever be one root folder for a user. However, if there's more
316 // than one we'll simply use the first one rather than failing. It would be even 316 // than one we'll simply use the first one rather than failing. It would be even
317 // nicer to print some message to this effect, but this feels like it's too low a 317 // nicer to print some message to this effect, but this feels like it's too low a
318 // to put such a message out, and it's too minor right now to spare the time to 318 // to put such a message out, and it's too minor right now to spare the time to
319 // suitably refactor. 319 // suitably refactor.
320 if (folders.Count > 0) 320 if (folders.Count > 0)
321 { 321 {
322 return folders[0]; 322 return folders[0];
@@ -327,7 +327,7 @@ namespace OpenSim.Data.SQLite
327 } 327 }
328 328
329 /// <summary> 329 /// <summary>
330 /// Append a list of all the child folders of a parent folder 330 /// Append a list of all the child folders of a parent folder
331 /// </summary> 331 /// </summary>
332 /// <param name="folders">list where folders will be appended</param> 332 /// <param name="folders">list where folders will be appended</param>
333 /// <param name="parentID">ID of parent</param> 333 /// <param name="parentID">ID of parent</param>
@@ -435,7 +435,7 @@ namespace OpenSim.Data.SQLite
435 } 435 }
436 436
437 /// <summary> 437 /// <summary>
438 /// 438 ///
439 /// </summary> 439 /// </summary>
440 /// <param name="item"></param> 440 /// <param name="item"></param>
441 public void deleteInventoryItem(LLUUID itemID) 441 public void deleteInventoryItem(LLUUID itemID)
@@ -664,7 +664,7 @@ namespace OpenSim.Data.SQLite
664 { 664 {
665 string createInventoryItems = defineTable(createInventoryItemsTable()); 665 string createInventoryItems = defineTable(createInventoryItemsTable());
666 string createInventoryFolders = defineTable(createInventoryFoldersTable()); 666 string createInventoryFolders = defineTable(createInventoryFoldersTable());
667 667
668 SqliteCommand pcmd = new SqliteCommand(createInventoryItems, conn); 668 SqliteCommand pcmd = new SqliteCommand(createInventoryItems, conn);
669 SqliteCommand scmd = new SqliteCommand(createInventoryFolders, conn); 669 SqliteCommand scmd = new SqliteCommand(createInventoryFolders, conn);
670 670
@@ -697,7 +697,7 @@ namespace OpenSim.Data.SQLite
697 // Very clumsy way of checking whether we need to upgrade the database table version and then updating. Only 697 // Very clumsy way of checking whether we need to upgrade the database table version and then updating. Only
698 // putting up with this because this code should be blown away soon by nhibernate... 698 // putting up with this because this code should be blown away soon by nhibernate...
699 conn.Open(); 699 conn.Open();
700 700
701 SqliteCommand cmd; 701 SqliteCommand cmd;
702 try 702 try
703 { 703 {
@@ -707,7 +707,7 @@ namespace OpenSim.Data.SQLite
707 catch (SqliteSyntaxException) 707 catch (SqliteSyntaxException)
708 { 708 {
709 m_log.Info("[INVENTORY DB]: Upgrading sqlite inventory database to version 2"); 709 m_log.Info("[INVENTORY DB]: Upgrading sqlite inventory database to version 2");
710 710
711 cmd = new SqliteCommand("alter table inventoryitems add column salePrice integer default 99;", conn); 711 cmd = new SqliteCommand("alter table inventoryitems add column salePrice integer default 99;", conn);
712 cmd.ExecuteNonQuery(); 712 cmd.ExecuteNonQuery();
713 cmd = new SqliteCommand("alter table inventoryitems add column saleType integer default 0;", conn); 713 cmd = new SqliteCommand("alter table inventoryitems add column saleType integer default 0;", conn);
@@ -719,15 +719,15 @@ namespace OpenSim.Data.SQLite
719 cmd = new SqliteCommand("alter table inventoryitems add column groupOwned integer default 0;", conn); 719 cmd = new SqliteCommand("alter table inventoryitems add column groupOwned integer default 0;", conn);
720 cmd.ExecuteNonQuery(); 720 cmd.ExecuteNonQuery();
721 cmd = new SqliteCommand("alter table inventoryitems add column flags integer default 0;", conn); 721 cmd = new SqliteCommand("alter table inventoryitems add column flags integer default 0;", conn);
722 cmd.ExecuteNonQuery(); 722 cmd.ExecuteNonQuery();
723 723
724 pDa.Fill(tmpDS, "inventoryitems"); 724 pDa.Fill(tmpDS, "inventoryitems");
725 } 725 }
726 finally 726 finally
727 { 727 {
728 conn.Close(); 728 conn.Close();
729 } 729 }
730 730
731 foreach (DataColumn col in createInventoryItemsTable().Columns) 731 foreach (DataColumn col in createInventoryItemsTable().Columns)
732 { 732 {
733 if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName)) 733 if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName))
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 1b577db..6a16a88 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -90,11 +90,11 @@ namespace OpenSim.Data.SQLite
90 90
91 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); 91 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
92 shapeDa = new SqliteDataAdapter(shapeSelectCmd); 92 shapeDa = new SqliteDataAdapter(shapeSelectCmd);
93 // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); 93 // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
94 94
95 SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); 95 SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
96 itemsDa = new SqliteDataAdapter(itemsSelectCmd); 96 itemsDa = new SqliteDataAdapter(itemsSelectCmd);
97 97
98 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); 98 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
99 terrainDa = new SqliteDataAdapter(terrainSelectCmd); 99 terrainDa = new SqliteDataAdapter(terrainSelectCmd);
100 100
@@ -117,7 +117,7 @@ namespace OpenSim.Data.SQLite
117 117
118 ds.Tables.Add(createShapeTable()); 118 ds.Tables.Add(createShapeTable());
119 setupShapeCommands(shapeDa, m_conn); 119 setupShapeCommands(shapeDa, m_conn);
120 120
121 if (persistPrimInventories) 121 if (persistPrimInventories)
122 { 122 {
123 ds.Tables.Add(createItemsTable()); 123 ds.Tables.Add(createItemsTable());
@@ -183,8 +183,8 @@ namespace OpenSim.Data.SQLite
183 { 183 {
184 foreach (SceneObjectPart prim in obj.Children.Values) 184 foreach (SceneObjectPart prim in obj.Children.Values)
185 { 185 {
186 if ((prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Physics) == 0 186 if ((prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Physics) == 0
187 && (prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Temporary) == 0 187 && (prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Temporary) == 0
188 && (prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.TemporaryOnRez) == 0) 188 && (prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.TemporaryOnRez) == 0)
189 { 189 {
190 m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); 190 m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
@@ -210,7 +210,7 @@ namespace OpenSim.Data.SQLite
210 public void RemoveObject(LLUUID obj, LLUUID regionUUID) 210 public void RemoveObject(LLUUID obj, LLUUID regionUUID)
211 { 211 {
212 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID); 212 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
213 213
214 DataTable prims = ds.Tables["prims"]; 214 DataTable prims = ds.Tables["prims"];
215 DataTable shapes = ds.Tables["primshapes"]; 215 DataTable shapes = ds.Tables["primshapes"];
216 216
@@ -234,7 +234,7 @@ namespace OpenSim.Data.SQLite
234 } 234 }
235 235
236 // Remove prim row 236 // Remove prim row
237 row.Delete(); 237 row.Delete();
238 } 238 }
239 } 239 }
240 240
@@ -247,11 +247,11 @@ namespace OpenSim.Data.SQLite
247 /// </summary> 247 /// </summary>
248 private void RemoveItems(LLUUID uuid) 248 private void RemoveItems(LLUUID uuid)
249 { 249 {
250 DataTable items = ds.Tables["primitems"]; 250 DataTable items = ds.Tables["primitems"];
251 251
252 String sql = String.Format("primID = '{0}'", uuid); 252 String sql = String.Format("primID = '{0}'", uuid);
253 DataRow[] itemRows = items.Select(sql); 253 DataRow[] itemRows = items.Select(sql);
254 254
255 foreach (DataRow itemRow in itemRows) 255 foreach (DataRow itemRow in itemRows)
256 { 256 {
257 itemRow.Delete(); 257 itemRow.Delete();
@@ -286,7 +286,7 @@ namespace OpenSim.Data.SQLite
286 try 286 try
287 { 287 {
288 SceneObjectPart prim = null; 288 SceneObjectPart prim = null;
289 289
290 string uuid = (string) primRow["UUID"]; 290 string uuid = (string) primRow["UUID"];
291 string objID = (string) primRow["SceneGroupID"]; 291 string objID = (string) primRow["SceneGroupID"];
292 if (uuid == objID) //is new SceneObjectGroup ? 292 if (uuid == objID) //is new SceneObjectGroup ?
@@ -353,25 +353,25 @@ namespace OpenSim.Data.SQLite
353 private void LoadItems(SceneObjectPart prim) 353 private void LoadItems(SceneObjectPart prim)
354 { 354 {
355 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); 355 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
356 356
357 DataTable dbItems = ds.Tables["primitems"]; 357 DataTable dbItems = ds.Tables["primitems"];
358 358
359 String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); 359 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
360 DataRow[] dbItemRows = dbItems.Select(sql); 360 DataRow[] dbItemRows = dbItems.Select(sql);
361 361
362 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 362 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
363 363
364 foreach (DataRow row in dbItemRows) 364 foreach (DataRow row in dbItemRows)
365 { 365 {
366 TaskInventoryItem item = buildItem(row); 366 TaskInventoryItem item = buildItem(row);
367 inventory.Add(item); 367 inventory.Add(item);
368 368
369 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); 369 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
370 } 370 }
371 371
372 prim.RestoreInventoryItems(inventory); 372 prim.RestoreInventoryItems(inventory);
373 373
374 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in 374 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in
375 // every item). This data should really be stored in the prim table itself. 375 // every item). This data should really be stored in the prim table itself.
376 if (dbItemRows.Length > 0) 376 if (dbItemRows.Length > 0)
377 { 377 {
@@ -548,12 +548,12 @@ namespace OpenSim.Data.SQLite
548 { 548 {
549 primDa.Update(ds, "prims"); 549 primDa.Update(ds, "prims");
550 shapeDa.Update(ds, "primshapes"); 550 shapeDa.Update(ds, "primshapes");
551 551
552 if (persistPrimInventories) 552 if (persistPrimInventories)
553 { 553 {
554 itemsDa.Update(ds, "primitems"); 554 itemsDa.Update(ds, "primitems");
555 } 555 }
556 556
557 terrainDa.Update(ds, "terrain"); 557 terrainDa.Update(ds, "terrain");
558 landDa.Update(ds, "land"); 558 landDa.Update(ds, "land");
559 landAccessListDa.Update(ds, "landaccesslist"); 559 landAccessListDa.Update(ds, "landaccesslist");
@@ -569,7 +569,7 @@ namespace OpenSim.Data.SQLite
569 /*********************************************************************** 569 /***********************************************************************
570 * 570 *
571 * Database Definition Functions 571 * Database Definition Functions
572 * 572 *
573 * This should be db agnostic as we define them in ADO.NET terms 573 * This should be db agnostic as we define them in ADO.NET terms
574 * 574 *
575 **********************************************************************/ 575 **********************************************************************/
@@ -705,8 +705,8 @@ namespace OpenSim.Data.SQLite
705 createCol(items, "primID", typeof (String)); 705 createCol(items, "primID", typeof (String));
706 createCol(items, "assetID", typeof (String)); 706 createCol(items, "assetID", typeof (String));
707 createCol(items, "parentFolderID", typeof (String)); 707 createCol(items, "parentFolderID", typeof (String));
708 708
709 createCol(items, "invType", typeof (Int32)); 709 createCol(items, "invType", typeof (Int32));
710 createCol(items, "assetType", typeof (Int32)); 710 createCol(items, "assetType", typeof (Int32));
711 711
712 createCol(items, "name", typeof (String)); 712 createCol(items, "name", typeof (String));
@@ -784,7 +784,7 @@ namespace OpenSim.Data.SQLite
784 } 784 }
785 785
786 /*********************************************************************** 786 /***********************************************************************
787 * 787 *
788 * Convert between ADO.NET <=> OpenSim Objects 788 * Convert between ADO.NET <=> OpenSim Objects
789 * 789 *
790 * These should be database independant 790 * These should be database independant
@@ -897,7 +897,7 @@ namespace OpenSim.Data.SQLite
897 897
898 return prim; 898 return prim;
899 } 899 }
900 900
901 /// <summary> 901 /// <summary>
902 /// Build a prim inventory item from the persisted data. 902 /// Build a prim inventory item from the persisted data.
903 /// </summary> 903 /// </summary>
@@ -906,15 +906,15 @@ namespace OpenSim.Data.SQLite
906 private static TaskInventoryItem buildItem(DataRow row) 906 private static TaskInventoryItem buildItem(DataRow row)
907 { 907 {
908 TaskInventoryItem taskItem = new TaskInventoryItem(); 908 TaskInventoryItem taskItem = new TaskInventoryItem();
909 909
910 taskItem.ItemID = new LLUUID((String)row["itemID"]); 910 taskItem.ItemID = new LLUUID((String)row["itemID"]);
911 taskItem.ParentPartID = new LLUUID((String)row["primID"]); 911 taskItem.ParentPartID = new LLUUID((String)row["primID"]);
912 taskItem.AssetID = new LLUUID((String)row["assetID"]); 912 taskItem.AssetID = new LLUUID((String)row["assetID"]);
913 taskItem.ParentID = new LLUUID((String)row["parentFolderID"]); 913 taskItem.ParentID = new LLUUID((String)row["parentFolderID"]);
914 914
915 taskItem.InvType = Convert.ToInt32(row["invType"]); 915 taskItem.InvType = Convert.ToInt32(row["invType"]);
916 taskItem.Type = Convert.ToInt32(row["assetType"]); 916 taskItem.Type = Convert.ToInt32(row["assetType"]);
917 917
918 taskItem.Name = (String)row["name"]; 918 taskItem.Name = (String)row["name"];
919 taskItem.Description = (String)row["description"]; 919 taskItem.Description = (String)row["description"];
920 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); 920 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
@@ -922,13 +922,13 @@ namespace OpenSim.Data.SQLite
922 taskItem.OwnerID = new LLUUID((String)row["ownerID"]); 922 taskItem.OwnerID = new LLUUID((String)row["ownerID"]);
923 taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]); 923 taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]);
924 taskItem.GroupID = new LLUUID((String)row["groupID"]); 924 taskItem.GroupID = new LLUUID((String)row["groupID"]);
925 925
926 taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]); 926 taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]);
927 taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]); 927 taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]);
928 taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]); 928 taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]);
929 taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]); 929 taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]);
930 taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]); 930 taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]);
931 931
932 return taskItem; 932 return taskItem;
933 } 933 }
934 934
@@ -990,14 +990,14 @@ namespace OpenSim.Data.SQLite
990 cmd.ExecuteNonQuery(); 990 cmd.ExecuteNonQuery();
991 m_conn.Close(); 991 m_conn.Close();
992 m_conn.Dispose(); 992 m_conn.Dispose();
993 993
994 m_log.Error("[REGION DB]: The land table was recently updated. You need to restart the simulator. Exiting now."); 994 m_log.Error("[REGION DB]: The land table was recently updated. You need to restart the simulator. Exiting now.");
995 995
996 Thread.Sleep(10000); 996 Thread.Sleep(10000);
997 997
998 // ICK! but it's better then A thousand red SQLITE error messages! 998 // ICK! but it's better then A thousand red SQLITE error messages!
999 Environment.Exit(0); 999 Environment.Exit(0);
1000 1000
1001 } 1001 }
1002 catch (Exception) 1002 catch (Exception)
1003 { 1003 {
@@ -1006,7 +1006,7 @@ namespace OpenSim.Data.SQLite
1006 Environment.Exit(0); 1006 Environment.Exit(0);
1007 } 1007 }
1008 } 1008 }
1009 1009
1010 return newData; 1010 return newData;
1011 } 1011 }
1012 1012
@@ -1107,17 +1107,17 @@ namespace OpenSim.Data.SQLite
1107 row["SitTargetOrientY"] = sitTargetOrient.Y; 1107 row["SitTargetOrientY"] = sitTargetOrient.Y;
1108 row["SitTargetOrientZ"] = sitTargetOrient.Z; 1108 row["SitTargetOrientZ"] = sitTargetOrient.Z;
1109 } 1109 }
1110 1110
1111 private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) 1111 private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
1112 { 1112 {
1113 row["itemID"] = taskItem.ItemID; 1113 row["itemID"] = taskItem.ItemID;
1114 row["primID"] = taskItem.ParentPartID; 1114 row["primID"] = taskItem.ParentPartID;
1115 row["assetID"] = taskItem.AssetID; 1115 row["assetID"] = taskItem.AssetID;
1116 row["parentFolderID"] = taskItem.ParentID; 1116 row["parentFolderID"] = taskItem.ParentID;
1117 1117
1118 row["invType"] = taskItem.InvType; 1118 row["invType"] = taskItem.InvType;
1119 row["assetType"] = taskItem.Type; 1119 row["assetType"] = taskItem.Type;
1120 1120
1121 row["name"] = taskItem.Name; 1121 row["name"] = taskItem.Name;
1122 row["description"] = taskItem.Description; 1122 row["description"] = taskItem.Description;
1123 row["creationDate"] = taskItem.CreationDate; 1123 row["creationDate"] = taskItem.CreationDate;
@@ -1294,37 +1294,37 @@ namespace OpenSim.Data.SQLite
1294 fillShapeRow(shapeRow, prim); 1294 fillShapeRow(shapeRow, prim);
1295 } 1295 }
1296 } 1296 }
1297 1297
1298 // see IRegionDatastore 1298 // see IRegionDatastore
1299 public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) 1299 public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
1300 { 1300 {
1301 if (!persistPrimInventories) 1301 if (!persistPrimInventories)
1302 return; 1302 return;
1303 1303
1304 m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); 1304 m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
1305 1305
1306 DataTable dbItems = ds.Tables["primitems"]; 1306 DataTable dbItems = ds.Tables["primitems"];
1307 1307
1308 // For now, we're just going to crudely remove all the previous inventory items 1308 // For now, we're just going to crudely remove all the previous inventory items
1309 // no matter whether they have changed or not, and replace them with the current set. 1309 // no matter whether they have changed or not, and replace them with the current set.
1310 lock (ds) 1310 lock (ds)
1311 { 1311 {
1312 RemoveItems(primID); 1312 RemoveItems(primID);
1313 1313
1314 // repalce with current inventory details 1314 // repalce with current inventory details
1315 foreach (TaskInventoryItem newItem in items) 1315 foreach (TaskInventoryItem newItem in items)
1316 { 1316 {
1317// m_log.InfoFormat( 1317// m_log.InfoFormat(
1318// "[DATASTORE]: ", 1318// "[DATASTORE]: ",
1319// "Adding item {0}, {1} to prim ID {2}", 1319// "Adding item {0}, {1} to prim ID {2}",
1320// newItem.Name, newItem.ItemID, newItem.ParentPartID); 1320// newItem.Name, newItem.ItemID, newItem.ParentPartID);
1321 1321
1322 DataRow newItemRow = dbItems.NewRow(); 1322 DataRow newItemRow = dbItems.NewRow();
1323 fillItemRow(newItemRow, newItem); 1323 fillItemRow(newItemRow, newItem);
1324 dbItems.Rows.Add(newItemRow); 1324 dbItems.Rows.Add(newItemRow);
1325 } 1325 }
1326 } 1326 }
1327 1327
1328 Commit(); 1328 Commit();
1329 } 1329 }
1330 1330
@@ -1436,7 +1436,7 @@ namespace OpenSim.Data.SQLite
1436 /// This is a convenience function that collapses 5 repetitive 1436 /// This is a convenience function that collapses 5 repetitive
1437 /// lines for defining SqliteParameters to 2 parameters: 1437 /// lines for defining SqliteParameters to 2 parameters:
1438 /// column name and database type. 1438 /// column name and database type.
1439 /// 1439 ///
1440 /// It assumes certain conventions like :param as the param 1440 /// It assumes certain conventions like :param as the param
1441 /// name to replace in parametrized queries, and that source 1441 /// name to replace in parametrized queries, and that source
1442 /// version is always current version, both of which are fine 1442 /// version is always current version, both of which are fine
@@ -1451,7 +1451,7 @@ namespace OpenSim.Data.SQLite
1451 param.SourceColumn = name; 1451 param.SourceColumn = name;
1452 param.SourceVersion = DataRowVersion.Current; 1452 param.SourceVersion = DataRowVersion.Current;
1453 return param; 1453 return param;
1454 } 1454 }
1455 1455
1456 private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) 1456 private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn)
1457 { 1457 {
@@ -1466,7 +1466,7 @@ namespace OpenSim.Data.SQLite
1466 delete.Connection = conn; 1466 delete.Connection = conn;
1467 da.DeleteCommand = delete; 1467 da.DeleteCommand = delete;
1468 } 1468 }
1469 1469
1470 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) 1470 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
1471 { 1471 {
1472 da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]); 1472 da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]);
@@ -1479,7 +1479,7 @@ namespace OpenSim.Data.SQLite
1479 delete.Parameters.Add(createSqliteParameter("itemID", typeof (String))); 1479 delete.Parameters.Add(createSqliteParameter("itemID", typeof (String)));
1480 delete.Connection = conn; 1480 delete.Connection = conn;
1481 da.DeleteCommand = delete; 1481 da.DeleteCommand = delete;
1482 } 1482 }
1483 1483
1484 private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) 1484 private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn)
1485 { 1485 {
@@ -1660,7 +1660,7 @@ namespace OpenSim.Data.SQLite
1660 return false; 1660 return false;
1661 } 1661 }
1662 } 1662 }
1663 1663
1664 // XXX primitems should probably go here eventually 1664 // XXX primitems should probably go here eventually
1665 1665
1666 foreach (DataColumn col in createTerrainTable().Columns) 1666 foreach (DataColumn col in createTerrainTable().Columns)
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 8f78e0b..d8b140c 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Data.SQLite
58 58
59 private const string AvatarPickerAndSQL = "select * from users where username like :username and surname like :surname"; 59 private const string AvatarPickerAndSQL = "select * from users where username like :username and surname like :surname";
60 private const string AvatarPickerOrSQL = "select * from users where username like :username or surname like :surname"; 60 private const string AvatarPickerOrSQL = "select * from users where username like :username or surname like :surname";
61 61
62 private DataSet ds; 62 private DataSet ds;
63 private SqliteDataAdapter da; 63 private SqliteDataAdapter da;
64 private SqliteDataAdapter daf; 64 private SqliteDataAdapter daf;
@@ -67,16 +67,16 @@ namespace OpenSim.Data.SQLite
67 override public void Initialise(string connect) 67 override public void Initialise(string connect)
68 { 68 {
69 // default to something sensible 69 // default to something sensible
70 if (connect == "") 70 if (connect == "")
71 connect = "URI=file:userprofiles.db,version=3"; 71 connect = "URI=file:userprofiles.db,version=3";
72 72
73 SqliteConnection conn = new SqliteConnection(connect); 73 SqliteConnection conn = new SqliteConnection(connect);
74 TestTables(conn); 74 TestTables(conn);
75 75
76 // This sucks, but It doesn't seem to work with the dataset Syncing :P 76 // This sucks, but It doesn't seem to work with the dataset Syncing :P
77 g_conn = conn; 77 g_conn = conn;
78 g_conn.Open(); 78 g_conn.Open();
79 79
80 ds = new DataSet(); 80 ds = new DataSet();
81 da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); 81 da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn));
82 daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn)); 82 daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn));
@@ -159,7 +159,7 @@ namespace OpenSim.Data.SQLite
159 override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) 159 override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
160 { 160 {
161 string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)"; 161 string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)";
162 162
163 using (SqliteCommand cmd = new SqliteCommand(InsertFriends, g_conn)) 163 using (SqliteCommand cmd = new SqliteCommand(InsertFriends, g_conn))
164 { 164 {
165 cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.UUID.ToString())); 165 cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.UUID.ToString()));
@@ -228,11 +228,11 @@ namespace OpenSim.Data.SQLite
228 m_log.Error("[USER DB]: Exception getting friends list for user: " + ex.ToString()); 228 m_log.Error("[USER DB]: Exception getting friends list for user: " + ex.ToString());
229 } 229 }
230 } 230 }
231 231
232 return returnlist; 232 return returnlist;
233 } 233 }
234 234
235 235
236 236
237 237
238 #endregion 238 #endregion
@@ -380,9 +380,9 @@ namespace OpenSim.Data.SQLite
380 else 380 else
381 { 381 {
382 fillUserRow(row, user); 382 fillUserRow(row, user);
383 383
384 } 384 }
385 // This is why we're getting the 'logins never log-off'.. because It isn't clearing the 385 // This is why we're getting the 'logins never log-off'.. because It isn't clearing the
386 // useragents table once the useragent is null 386 // useragents table once the useragent is null
387 // 387 //
388 // A database guy should look at this and figure out the best way to clear the useragents table. 388 // A database guy should look at this and figure out the best way to clear the useragents table.
@@ -403,7 +403,7 @@ namespace OpenSim.Data.SQLite
403 } 403 }
404 else 404 else
405 { 405 {
406 // I just added this to help the standalone login situation. 406 // I just added this to help the standalone login situation.
407 //It still needs to be looked at by a Database guy 407 //It still needs to be looked at by a Database guy
408 DataTable ua = ds.Tables["useragents"]; 408 DataTable ua = ds.Tables["useragents"];
409 row = ua.Rows.Find(Util.ToRawUuidString(user.ID)); 409 row = ua.Rows.Find(Util.ToRawUuidString(user.ID));
@@ -480,7 +480,7 @@ namespace OpenSim.Data.SQLite
480 480
481 /// Appearance 481 /// Appearance
482 /// TODO: stubs for now to get us to a compiling state gently 482 /// TODO: stubs for now to get us to a compiling state gently
483 // override public AvatarAppearance GetUserAppearance(LLUUID user) 483 // override public AvatarAppearance GetUserAppearance(LLUUID user)
484 // { 484 // {
485 // return new AvatarAppearance(); 485 // return new AvatarAppearance();
486 // } 486 // }
@@ -494,17 +494,17 @@ namespace OpenSim.Data.SQLite
494 { 494 {
495 return; 495 return;
496 } 496 }
497 497
498 override public void RemoveAttachment(LLUUID user, LLUUID item) 498 override public void RemoveAttachment(LLUUID user, LLUUID item)
499 { 499 {
500 return; 500 return;
501 } 501 }
502 502
503 override public List<LLUUID> GetAttachments(LLUUID user) 503 override public List<LLUUID> GetAttachments(LLUUID user)
504 { 504 {
505 return new List<LLUUID>(); 505 return new List<LLUUID>();
506 } 506 }
507 507
508 /// <summary> 508 /// <summary>
509 /// Returns the name of the storage provider 509 /// Returns the name of the storage provider
510 /// </summary> 510 /// </summary>
@@ -525,13 +525,13 @@ namespace OpenSim.Data.SQLite
525 525
526 /*********************************************************************** 526 /***********************************************************************
527 * 527 *
528 * DataTable creation 528 * DataTable creation
529 * 529 *
530 **********************************************************************/ 530 **********************************************************************/
531 /*********************************************************************** 531 /***********************************************************************
532 * 532 *
533 * Database Definition Functions 533 * Database Definition Functions
534 * 534 *
535 * This should be db agnostic as we define them in ADO.NET terms 535 * This should be db agnostic as we define them in ADO.NET terms
536 * 536 *
537 **********************************************************************/ 537 **********************************************************************/
@@ -610,7 +610,7 @@ namespace OpenSim.Data.SQLite
610 } 610 }
611 611
612 /*********************************************************************** 612 /***********************************************************************
613 * 613 *
614 * Convert between ADO.NET <=> OpenSim Objects 614 * Convert between ADO.NET <=> OpenSim Objects
615 * 615 *
616 * These should be database independant 616 * These should be database independant
diff --git a/OpenSim/Data/SQLite/SQLiteUtils.cs b/OpenSim/Data/SQLite/SQLiteUtils.cs
index 5bb22f7..0862de0 100644
--- a/OpenSim/Data/SQLite/SQLiteUtils.cs
+++ b/OpenSim/Data/SQLite/SQLiteUtils.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Data.SQLite
39 /*********************************************************************** 39 /***********************************************************************
40 * 40 *
41 * Database Definition Helper Functions 41 * Database Definition Helper Functions
42 * 42 *
43 * This should be db agnostic as we define them in ADO.NET terms 43 * This should be db agnostic as we define them in ADO.NET terms
44 * 44 *
45 **********************************************************************/ 45 **********************************************************************/
@@ -161,7 +161,7 @@ namespace OpenSim.Data.SQLite
161 /// This is a convenience function that collapses 5 repetitive 161 /// This is a convenience function that collapses 5 repetitive
162 /// lines for defining SqliteParameters to 2 parameters: 162 /// lines for defining SqliteParameters to 2 parameters:
163 /// column name and database type. 163 /// column name and database type.
164 /// 164 ///
165 /// It assumes certain conventions like :param as the param 165 /// It assumes certain conventions like :param as the param
166 /// name to replace in parametrized queries, and that source 166 /// name to replace in parametrized queries, and that source
167 /// version is always current version, both of which are fine 167 /// version is always current version, both of which are fine