aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite')
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs289
1 files changed, 151 insertions, 138 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 729db7e..1b16a07 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -29,10 +29,11 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.IO;
32using libsecondlife; 33using libsecondlife;
33using Mono.Data.SqliteClient; 34using Mono.Data.SqliteClient;
34using OpenSim.Framework.Console;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Console;
36using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.LandManagement; 38using OpenSim.Region.Environment.LandManagement;
38using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
@@ -55,6 +56,7 @@ namespace OpenSim.DataStore.MonoSqlite
55 * Public Interface Functions 56 * Public Interface Functions
56 * 57 *
57 **********************************************************************/ 58 **********************************************************************/
59
58 public void Initialise(string dbfile, string dbname) 60 public void Initialise(string dbfile, string dbname)
59 { 61 {
60 string connectionString = "URI=file:" + dbfile + ",version=3"; 62 string connectionString = "URI=file:" + dbfile + ",version=3";
@@ -80,17 +82,18 @@ namespace OpenSim.DataStore.MonoSqlite
80 // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema"); 82 // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema");
81 TestTables(conn); 83 TestTables(conn);
82 84
83 lock(ds) { 85 lock (ds)
86 {
84 ds.Tables.Add(createPrimTable()); 87 ds.Tables.Add(createPrimTable());
85 setupPrimCommands(primDa, conn); 88 setupPrimCommands(primDa, conn);
86 primDa.Fill(ds.Tables["prims"]); 89 primDa.Fill(ds.Tables["prims"]);
87 90
88 ds.Tables.Add(createShapeTable()); 91 ds.Tables.Add(createShapeTable());
89 setupShapeCommands(shapeDa, conn); 92 setupShapeCommands(shapeDa, conn);
90 93
91 ds.Tables.Add(createTerrainTable()); 94 ds.Tables.Add(createTerrainTable());
92 setupTerrainCommands(terrainDa, conn); 95 setupTerrainCommands(terrainDa, conn);
93 96
94 // WORKAROUND: This is a work around for sqlite on 97 // WORKAROUND: This is a work around for sqlite on
95 // windows, which gets really unhappy with blob columns 98 // windows, which gets really unhappy with blob columns
96 // that have no sample data in them. At some point we 99 // that have no sample data in them. At some point we
@@ -118,7 +121,8 @@ namespace OpenSim.DataStore.MonoSqlite
118 121
119 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) 122 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
120 { 123 {
121 lock (ds) { 124 lock (ds)
125 {
122 foreach (SceneObjectPart prim in obj.Children.Values) 126 foreach (SceneObjectPart prim in obj.Children.Values)
123 { 127 {
124 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); 128 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID);
@@ -136,11 +140,12 @@ namespace OpenSim.DataStore.MonoSqlite
136 DataTable shapes = ds.Tables["primshapes"]; 140 DataTable shapes = ds.Tables["primshapes"];
137 141
138 string selectExp = "SceneGroupID = '" + obj.ToString() + "'"; 142 string selectExp = "SceneGroupID = '" + obj.ToString() + "'";
139 lock (ds) { 143 lock (ds)
144 {
140 DataRow[] primRows = prims.Select(selectExp); 145 DataRow[] primRows = prims.Select(selectExp);
141 foreach (DataRow row in primRows) 146 foreach (DataRow row in primRows)
142 { 147 {
143 LLUUID uuid = new LLUUID((string)row["UUID"]); 148 LLUUID uuid = new LLUUID((string) row["UUID"]);
144 DataRow shapeRow = shapes.Rows.Find(uuid); 149 DataRow shapeRow = shapes.Rows.Find(uuid);
145 if (shapeRow != null) 150 if (shapeRow != null)
146 { 151 {
@@ -149,7 +154,7 @@ namespace OpenSim.DataStore.MonoSqlite
149 row.Delete(); 154 row.Delete();
150 } 155 }
151 } 156 }
152 157
153 Commit(); 158 Commit();
154 } 159 }
155 160
@@ -165,16 +170,18 @@ namespace OpenSim.DataStore.MonoSqlite
165 string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; 170 string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'";
166 string orderByParent = "ParentID ASC"; 171 string orderByParent = "ParentID ASC";
167 172
168 lock (ds) { 173 lock (ds)
174 {
169 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); 175 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent);
170 MainLog.Instance.Verbose("DATASTORE", "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 176 MainLog.Instance.Verbose("DATASTORE",
171 177 "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
178
172 foreach (DataRow primRow in primsForRegion) 179 foreach (DataRow primRow in primsForRegion)
173 { 180 {
174 try 181 try
175 { 182 {
176 string uuid = (string)primRow["UUID"]; 183 string uuid = (string) primRow["UUID"];
177 string objID = (string)primRow["SceneGroupID"]; 184 string objID = (string) primRow["SceneGroupID"];
178 if (uuid == objID) //is new SceneObjectGroup ? 185 if (uuid == objID) //is new SceneObjectGroup ?
179 { 186 {
180 SceneObjectGroup group = new SceneObjectGroup(); 187 SceneObjectGroup group = new SceneObjectGroup();
@@ -186,12 +193,13 @@ namespace OpenSim.DataStore.MonoSqlite
186 } 193 }
187 else 194 else
188 { 195 {
189 MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); 196 MainLog.Instance.Notice(
197 "No shape found for prim in storage, so setting default box shape");
190 prim.Shape = BoxShape.Default; 198 prim.Shape = BoxShape.Default;
191 } 199 }
192 group.AddPart(prim); 200 group.AddPart(prim);
193 group.RootPart = prim; 201 group.RootPart = prim;
194 202
195 createdObjects.Add(group.UUID, group); 203 createdObjects.Add(group.UUID, group);
196 retvals.Add(group); 204 retvals.Add(group);
197 } 205 }
@@ -205,7 +213,8 @@ namespace OpenSim.DataStore.MonoSqlite
205 } 213 }
206 else 214 else
207 { 215 {
208 MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); 216 MainLog.Instance.Notice(
217 "No shape found for prim in storage, so setting default box shape");
209 prim.Shape = BoxShape.Default; 218 prim.Shape = BoxShape.Default;
210 } 219 }
211 createdObjects[new LLUUID(objID)].AddPart(prim); 220 createdObjects[new LLUUID(objID)].AddPart(prim);
@@ -228,46 +237,48 @@ namespace OpenSim.DataStore.MonoSqlite
228 237
229 public void StoreTerrain(double[,] ter, LLUUID regionID) 238 public void StoreTerrain(double[,] ter, LLUUID regionID)
230 { 239 {
231 int revision = OpenSim.Framework.Util.UnixTimeSinceEpoch(); 240 int revision = Util.UnixTimeSinceEpoch();
232 241
233 MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); 242 MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString());
234 243
235 DataTable terrain = ds.Tables["terrain"]; 244 DataTable terrain = ds.Tables["terrain"];
236 lock (ds) { 245 lock (ds)
246 {
237 DataRow newrow = terrain.NewRow(); 247 DataRow newrow = terrain.NewRow();
238 fillTerrainRow(newrow, regionID, revision, ter); 248 fillTerrainRow(newrow, regionID, revision, ter);
239 terrain.Rows.Add(newrow); 249 terrain.Rows.Add(newrow);
240 250
241 Commit(); 251 Commit();
242 } 252 }
243 } 253 }
244 254
245 public double[,] LoadTerrain(LLUUID regionID) 255 public double[,] LoadTerrain(LLUUID regionID)
246 { 256 {
247 double[,] terret = new double[256, 256]; 257 double[,] terret = new double[256,256];
248 terret.Initialize(); 258 terret.Initialize();
249 259
250 DataTable terrain = ds.Tables["terrain"]; 260 DataTable terrain = ds.Tables["terrain"];
251 261
252 lock (ds) { 262 lock (ds)
253 DataRow[] rows = terrain.Select("RegionUUID = '" + regionID.ToString() + "'","Revision DESC"); 263 {
254 264 DataRow[] rows = terrain.Select("RegionUUID = '" + regionID.ToString() + "'", "Revision DESC");
265
255 int rev = 0; 266 int rev = 0;
256 267
257 if (rows.Length > 0) 268 if (rows.Length > 0)
258 { 269 {
259 DataRow row = rows[0]; 270 DataRow row = rows[0];
260 271
261 byte[] heightmap = (byte[])row["Heightfield"]; 272 byte[] heightmap = (byte[]) row["Heightfield"];
262 for (int x = 0; x < 256; x++) 273 for (int x = 0; x < 256; x++)
263 { 274 {
264 for (int y = 0; y < 256; y++) 275 for (int y = 0; y < 256; y++)
265 { 276 {
266 terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8); 277 terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8);
267 } 278 }
268 } 279 }
269 280
270 rev = (int)row["Revision"]; 281 rev = (int) row["Revision"];
271 } 282 }
272 else 283 else
273 { 284 {
@@ -275,7 +286,7 @@ namespace OpenSim.DataStore.MonoSqlite
275 return null; 286 return null;
276 } 287 }
277 288
278 289
279 MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); 290 MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString());
280 } 291 }
281 292
@@ -284,12 +295,10 @@ namespace OpenSim.DataStore.MonoSqlite
284 295
285 public void RemoveLandObject(uint id) 296 public void RemoveLandObject(uint id)
286 { 297 {
287
288 } 298 }
289 299
290 public void StoreParcel(Land parcel) 300 public void StoreParcel(Land parcel)
291 { 301 {
292
293 } 302 }
294 303
295 public List<Land> LoadLandObjects() 304 public List<Land> LoadLandObjects()
@@ -299,7 +308,8 @@ namespace OpenSim.DataStore.MonoSqlite
299 308
300 public void Commit() 309 public void Commit()
301 { 310 {
302 lock (ds) { 311 lock (ds)
312 {
303 primDa.Update(ds, "prims"); 313 primDa.Update(ds, "prims");
304 shapeDa.Update(ds, "primshapes"); 314 shapeDa.Update(ds, "primshapes");
305 terrainDa.Update(ds, "terrain"); 315 terrainDa.Update(ds, "terrain");
@@ -320,7 +330,7 @@ namespace OpenSim.DataStore.MonoSqlite
320 * 330 *
321 **********************************************************************/ 331 **********************************************************************/
322 332
323 private void createCol(DataTable dt, string name, System.Type type) 333 private void createCol(DataTable dt, string name, Type type)
324 { 334 {
325 DataColumn col = new DataColumn(name, type); 335 DataColumn col = new DataColumn(name, type);
326 dt.Columns.Add(col); 336 dt.Columns.Add(col);
@@ -330,9 +340,9 @@ namespace OpenSim.DataStore.MonoSqlite
330 { 340 {
331 DataTable terrain = new DataTable("terrain"); 341 DataTable terrain = new DataTable("terrain");
332 342
333 createCol(terrain, "RegionUUID", typeof(System.String)); 343 createCol(terrain, "RegionUUID", typeof (String));
334 createCol(terrain, "Revision", typeof(System.Int32)); 344 createCol(terrain, "Revision", typeof (Int32));
335 createCol(terrain, "Heightfield", typeof(System.Byte[])); 345 createCol(terrain, "Heightfield", typeof (Byte[]));
336 346
337 return terrain; 347 return terrain;
338 } 348 }
@@ -341,52 +351,52 @@ namespace OpenSim.DataStore.MonoSqlite
341 { 351 {
342 DataTable prims = new DataTable("prims"); 352 DataTable prims = new DataTable("prims");
343 353
344 createCol(prims, "UUID", typeof(System.String)); 354 createCol(prims, "UUID", typeof (String));
345 createCol(prims, "RegionUUID", typeof(System.String)); 355 createCol(prims, "RegionUUID", typeof (String));
346 createCol(prims, "ParentID", typeof(System.Int32)); 356 createCol(prims, "ParentID", typeof (Int32));
347 createCol(prims, "CreationDate", typeof(System.Int32)); 357 createCol(prims, "CreationDate", typeof (Int32));
348 createCol(prims, "Name", typeof(System.String)); 358 createCol(prims, "Name", typeof (String));
349 createCol(prims, "SceneGroupID", typeof(System.String)); 359 createCol(prims, "SceneGroupID", typeof (String));
350 // various text fields 360 // various text fields
351 createCol(prims, "Text", typeof(System.String)); 361 createCol(prims, "Text", typeof (String));
352 createCol(prims, "Description", typeof(System.String)); 362 createCol(prims, "Description", typeof (String));
353 createCol(prims, "SitName", typeof(System.String)); 363 createCol(prims, "SitName", typeof (String));
354 createCol(prims, "TouchName", typeof(System.String)); 364 createCol(prims, "TouchName", typeof (String));
355 // permissions 365 // permissions
356 createCol(prims, "ObjectFlags", typeof(System.Int32)); 366 createCol(prims, "ObjectFlags", typeof (Int32));
357 createCol(prims, "CreatorID", typeof(System.String)); 367 createCol(prims, "CreatorID", typeof (String));
358 createCol(prims, "OwnerID", typeof(System.String)); 368 createCol(prims, "OwnerID", typeof (String));
359 createCol(prims, "GroupID", typeof(System.String)); 369 createCol(prims, "GroupID", typeof (String));
360 createCol(prims, "LastOwnerID", typeof(System.String)); 370 createCol(prims, "LastOwnerID", typeof (String));
361 createCol(prims, "OwnerMask", typeof(System.Int32)); 371 createCol(prims, "OwnerMask", typeof (Int32));
362 createCol(prims, "NextOwnerMask", typeof(System.Int32)); 372 createCol(prims, "NextOwnerMask", typeof (Int32));
363 createCol(prims, "GroupMask", typeof(System.Int32)); 373 createCol(prims, "GroupMask", typeof (Int32));
364 createCol(prims, "EveryoneMask", typeof(System.Int32)); 374 createCol(prims, "EveryoneMask", typeof (Int32));
365 createCol(prims, "BaseMask", typeof(System.Int32)); 375 createCol(prims, "BaseMask", typeof (Int32));
366 // vectors 376 // vectors
367 createCol(prims, "PositionX", typeof(System.Double)); 377 createCol(prims, "PositionX", typeof (Double));
368 createCol(prims, "PositionY", typeof(System.Double)); 378 createCol(prims, "PositionY", typeof (Double));
369 createCol(prims, "PositionZ", typeof(System.Double)); 379 createCol(prims, "PositionZ", typeof (Double));
370 createCol(prims, "GroupPositionX", typeof(System.Double)); 380 createCol(prims, "GroupPositionX", typeof (Double));
371 createCol(prims, "GroupPositionY", typeof(System.Double)); 381 createCol(prims, "GroupPositionY", typeof (Double));
372 createCol(prims, "GroupPositionZ", typeof(System.Double)); 382 createCol(prims, "GroupPositionZ", typeof (Double));
373 createCol(prims, "VelocityX", typeof(System.Double)); 383 createCol(prims, "VelocityX", typeof (Double));
374 createCol(prims, "VelocityY", typeof(System.Double)); 384 createCol(prims, "VelocityY", typeof (Double));
375 createCol(prims, "VelocityZ", typeof(System.Double)); 385 createCol(prims, "VelocityZ", typeof (Double));
376 createCol(prims, "AngularVelocityX", typeof(System.Double)); 386 createCol(prims, "AngularVelocityX", typeof (Double));
377 createCol(prims, "AngularVelocityY", typeof(System.Double)); 387 createCol(prims, "AngularVelocityY", typeof (Double));
378 createCol(prims, "AngularVelocityZ", typeof(System.Double)); 388 createCol(prims, "AngularVelocityZ", typeof (Double));
379 createCol(prims, "AccelerationX", typeof(System.Double)); 389 createCol(prims, "AccelerationX", typeof (Double));
380 createCol(prims, "AccelerationY", typeof(System.Double)); 390 createCol(prims, "AccelerationY", typeof (Double));
381 createCol(prims, "AccelerationZ", typeof(System.Double)); 391 createCol(prims, "AccelerationZ", typeof (Double));
382 // quaternions 392 // quaternions
383 createCol(prims, "RotationX", typeof(System.Double)); 393 createCol(prims, "RotationX", typeof (Double));
384 createCol(prims, "RotationY", typeof(System.Double)); 394 createCol(prims, "RotationY", typeof (Double));
385 createCol(prims, "RotationZ", typeof(System.Double)); 395 createCol(prims, "RotationZ", typeof (Double));
386 createCol(prims, "RotationW", typeof(System.Double)); 396 createCol(prims, "RotationW", typeof (Double));
387 397
388 // Add in contraints 398 // Add in contraints
389 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 399 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
390 400
391 return prims; 401 return prims;
392 } 402 }
@@ -394,40 +404,40 @@ namespace OpenSim.DataStore.MonoSqlite
394 private DataTable createShapeTable() 404 private DataTable createShapeTable()
395 { 405 {
396 DataTable shapes = new DataTable("primshapes"); 406 DataTable shapes = new DataTable("primshapes");
397 createCol(shapes, "UUID", typeof(System.String)); 407 createCol(shapes, "UUID", typeof (String));
398 // shape is an enum 408 // shape is an enum
399 createCol(shapes, "Shape", typeof(System.Int32)); 409 createCol(shapes, "Shape", typeof (Int32));
400 // vectors 410 // vectors
401 createCol(shapes, "ScaleX", typeof(System.Double)); 411 createCol(shapes, "ScaleX", typeof (Double));
402 createCol(shapes, "ScaleY", typeof(System.Double)); 412 createCol(shapes, "ScaleY", typeof (Double));
403 createCol(shapes, "ScaleZ", typeof(System.Double)); 413 createCol(shapes, "ScaleZ", typeof (Double));
404 // paths 414 // paths
405 createCol(shapes, "PCode", typeof(System.Int32)); 415 createCol(shapes, "PCode", typeof (Int32));
406 createCol(shapes, "PathBegin", typeof(System.Int32)); 416 createCol(shapes, "PathBegin", typeof (Int32));
407 createCol(shapes, "PathEnd", typeof(System.Int32)); 417 createCol(shapes, "PathEnd", typeof (Int32));
408 createCol(shapes, "PathScaleX", typeof(System.Int32)); 418 createCol(shapes, "PathScaleX", typeof (Int32));
409 createCol(shapes, "PathScaleY", typeof(System.Int32)); 419 createCol(shapes, "PathScaleY", typeof (Int32));
410 createCol(shapes, "PathShearX", typeof(System.Int32)); 420 createCol(shapes, "PathShearX", typeof (Int32));
411 createCol(shapes, "PathShearY", typeof(System.Int32)); 421 createCol(shapes, "PathShearY", typeof (Int32));
412 createCol(shapes, "PathSkew", typeof(System.Int32)); 422 createCol(shapes, "PathSkew", typeof (Int32));
413 createCol(shapes, "PathCurve", typeof(System.Int32)); 423 createCol(shapes, "PathCurve", typeof (Int32));
414 createCol(shapes, "PathRadiusOffset", typeof(System.Int32)); 424 createCol(shapes, "PathRadiusOffset", typeof (Int32));
415 createCol(shapes, "PathRevolutions", typeof(System.Int32)); 425 createCol(shapes, "PathRevolutions", typeof (Int32));
416 createCol(shapes, "PathTaperX", typeof(System.Int32)); 426 createCol(shapes, "PathTaperX", typeof (Int32));
417 createCol(shapes, "PathTaperY", typeof(System.Int32)); 427 createCol(shapes, "PathTaperY", typeof (Int32));
418 createCol(shapes, "PathTwist", typeof(System.Int32)); 428 createCol(shapes, "PathTwist", typeof (Int32));
419 createCol(shapes, "PathTwistBegin", typeof(System.Int32)); 429 createCol(shapes, "PathTwistBegin", typeof (Int32));
420 // profile 430 // profile
421 createCol(shapes, "ProfileBegin", typeof(System.Int32)); 431 createCol(shapes, "ProfileBegin", typeof (Int32));
422 createCol(shapes, "ProfileEnd", typeof(System.Int32)); 432 createCol(shapes, "ProfileEnd", typeof (Int32));
423 createCol(shapes, "ProfileCurve", typeof(System.Int32)); 433 createCol(shapes, "ProfileCurve", typeof (Int32));
424 createCol(shapes, "ProfileHollow", typeof(System.Int32)); 434 createCol(shapes, "ProfileHollow", typeof (Int32));
425 // text TODO: this isn't right, but I'm not sure the right 435 // text TODO: this isn't right, but I'm not sure the right
426 // way to specify this as a blob atm 436 // way to specify this as a blob atm
427 createCol(shapes, "Texture", typeof(System.Byte[])); 437 createCol(shapes, "Texture", typeof (Byte[]));
428 createCol(shapes, "ExtraParams", typeof(System.Byte[])); 438 createCol(shapes, "ExtraParams", typeof (Byte[]));
429 439
430 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; 440 shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
431 441
432 return shapes; 442 return shapes;
433 } 443 }
@@ -446,23 +456,23 @@ namespace OpenSim.DataStore.MonoSqlite
446 // interesting has to be done to actually get these values 456 // interesting has to be done to actually get these values
447 // back out. Not enough time to figure it out yet. 457 // back out. Not enough time to figure it out yet.
448 SceneObjectPart prim = new SceneObjectPart(); 458 SceneObjectPart prim = new SceneObjectPart();
449 prim.UUID = new LLUUID((String)row["UUID"]); 459 prim.UUID = new LLUUID((String) row["UUID"]);
450 // explicit conversion of integers is required, which sort 460 // explicit conversion of integers is required, which sort
451 // of sucks. No idea if there is a shortcut here or not. 461 // of sucks. No idea if there is a shortcut here or not.
452 prim.ParentID = Convert.ToUInt32(row["ParentID"]); 462 prim.ParentID = Convert.ToUInt32(row["ParentID"]);
453 prim.CreationDate = Convert.ToInt32(row["CreationDate"]); 463 prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
454 prim.Name = (String)row["Name"]; 464 prim.Name = (String) row["Name"];
455 // various text fields 465 // various text fields
456 prim.Text = (String)row["Text"]; 466 prim.Text = (String) row["Text"];
457 prim.Description = (String)row["Description"]; 467 prim.Description = (String) row["Description"];
458 prim.SitName = (String)row["SitName"]; 468 prim.SitName = (String) row["SitName"];
459 prim.TouchName = (String)row["TouchName"]; 469 prim.TouchName = (String) row["TouchName"];
460 // permissions 470 // permissions
461 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); 471 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
462 prim.CreatorID = new LLUUID((String)row["CreatorID"]); 472 prim.CreatorID = new LLUUID((String) row["CreatorID"]);
463 prim.OwnerID = new LLUUID((String)row["OwnerID"]); 473 prim.OwnerID = new LLUUID((String) row["OwnerID"]);
464 prim.GroupID = new LLUUID((String)row["GroupID"]); 474 prim.GroupID = new LLUUID((String) row["GroupID"]);
465 prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); 475 prim.LastOwnerID = new LLUUID((String) row["LastOwnerID"]);
466 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); 476 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
467 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); 477 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
468 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); 478 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
@@ -510,8 +520,8 @@ namespace OpenSim.DataStore.MonoSqlite
510 row["RegionUUID"] = regionUUID; 520 row["RegionUUID"] = regionUUID;
511 row["Revision"] = rev; 521 row["Revision"] = rev;
512 522
513 System.IO.MemoryStream str = new System.IO.MemoryStream(65536 * sizeof(double)); 523 MemoryStream str = new MemoryStream(65536*sizeof (double));
514 System.IO.BinaryWriter bw = new System.IO.BinaryWriter(str); 524 BinaryWriter bw = new BinaryWriter(str);
515 525
516 // TODO: COMPATIBILITY - Add byte-order conversions 526 // TODO: COMPATIBILITY - Add byte-order conversions
517 for (int x = 0; x < 256; x++) 527 for (int x = 0; x < 256; x++)
@@ -599,8 +609,8 @@ namespace OpenSim.DataStore.MonoSqlite
599 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); 609 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
600 // text TODO: this isn't right] = but I'm not sure the right 610 // text TODO: this isn't right] = but I'm not sure the right
601 // way to specify this as a blob atm 611 // way to specify this as a blob atm
602 s.TextureEntry = (byte[])row["Texture"]; 612 s.TextureEntry = (byte[]) row["Texture"];
603 s.ExtraParams = (byte[])row["ExtraParams"]; 613 s.ExtraParams = (byte[]) row["ExtraParams"];
604 // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); 614 // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
605 // string texture = encoding.GetString((Byte[])row["Texture"]); 615 // string texture = encoding.GetString((Byte[])row["Texture"]);
606 // if (!texture.StartsWith("<")) 616 // if (!texture.StartsWith("<"))
@@ -751,7 +761,8 @@ namespace OpenSim.DataStore.MonoSqlite
751 foreach (DataColumn col in dt.Columns) 761 foreach (DataColumn col in dt.Columns)
752 { 762 {
753 if (subsql.Length > 0) 763 if (subsql.Length > 0)
754 { // a map function would rock so much here 764 {
765 // a map function would rock so much here
755 subsql += ", "; 766 subsql += ", ";
756 } 767 }
757 subsql += col.ColumnName + "= :" + col.ColumnName; 768 subsql += col.ColumnName + "= :" + col.ColumnName;
@@ -778,7 +789,8 @@ namespace OpenSim.DataStore.MonoSqlite
778 foreach (DataColumn col in dt.Columns) 789 foreach (DataColumn col in dt.Columns)
779 { 790 {
780 if (subsql.Length > 0) 791 if (subsql.Length > 0)
781 { // a map function would rock so much here 792 {
793 // a map function would rock so much here
782 subsql += ",\n"; 794 subsql += ",\n";
783 } 795 }
784 subsql += col.ColumnName + " " + sqliteType(col.DataType); 796 subsql += col.ColumnName + " " + sqliteType(col.DataType);
@@ -812,7 +824,7 @@ namespace OpenSim.DataStore.MonoSqlite
812 /// for us. 824 /// for us.
813 ///</summary> 825 ///</summary>
814 ///<returns>a built sqlite parameter</returns> 826 ///<returns>a built sqlite parameter</returns>
815 private SqliteParameter createSqliteParameter(string name, System.Type type) 827 private SqliteParameter createSqliteParameter(string name, Type type)
816 { 828 {
817 SqliteParameter param = new SqliteParameter(); 829 SqliteParameter param = new SqliteParameter();
818 param.ParameterName = ":" + name; 830 param.ParameterName = ":" + name;
@@ -831,7 +843,7 @@ namespace OpenSim.DataStore.MonoSqlite
831 da.UpdateCommand.Connection = conn; 843 da.UpdateCommand.Connection = conn;
832 844
833 SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); 845 SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID");
834 delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); 846 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
835 delete.Connection = conn; 847 delete.Connection = conn;
836 da.DeleteCommand = delete; 848 da.DeleteCommand = delete;
837 } 849 }
@@ -851,7 +863,7 @@ namespace OpenSim.DataStore.MonoSqlite
851 da.UpdateCommand.Connection = conn; 863 da.UpdateCommand.Connection = conn;
852 864
853 SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); 865 SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID");
854 delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); 866 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
855 delete.Connection = conn; 867 delete.Connection = conn;
856 da.DeleteCommand = delete; 868 da.DeleteCommand = delete;
857 } 869 }
@@ -871,8 +883,9 @@ namespace OpenSim.DataStore.MonoSqlite
871 { 883 {
872 pcmd.ExecuteNonQuery(); 884 pcmd.ExecuteNonQuery();
873 } 885 }
874 catch (SqliteSyntaxException) { 886 catch (SqliteSyntaxException)
875 MainLog.Instance.Warn("SQLITE","Primitives Table Already Exists"); 887 {
888 MainLog.Instance.Warn("SQLITE", "Primitives Table Already Exists");
876 } 889 }
877 890
878 try 891 try
@@ -912,7 +925,7 @@ namespace OpenSim.DataStore.MonoSqlite
912 sDa.Fill(tmpDS, "primshapes"); 925 sDa.Fill(tmpDS, "primshapes");
913 tDa.Fill(tmpDS, "terrain"); 926 tDa.Fill(tmpDS, "terrain");
914 } 927 }
915 catch (Mono.Data.SqliteClient.SqliteSyntaxException) 928 catch (SqliteSyntaxException)
916 { 929 {
917 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); 930 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
918 InitDB(conn); 931 InitDB(conn);
@@ -957,27 +970,27 @@ namespace OpenSim.DataStore.MonoSqlite
957 970
958 private DbType dbtypeFromType(Type type) 971 private DbType dbtypeFromType(Type type)
959 { 972 {
960 if (type == typeof(System.String)) 973 if (type == typeof (String))
961 { 974 {
962 return DbType.String; 975 return DbType.String;
963 } 976 }
964 else if (type == typeof(System.Int32)) 977 else if (type == typeof (Int32))
965 { 978 {
966 return DbType.Int32; 979 return DbType.Int32;
967 } 980 }
968 else if (type == typeof(System.Double)) 981 else if (type == typeof (Double))
969 { 982 {
970 return DbType.Double; 983 return DbType.Double;
971 } 984 }
972 else if (type == typeof(System.Byte)) 985 else if (type == typeof (Byte))
973 { 986 {
974 return DbType.Byte; 987 return DbType.Byte;
975 } 988 }
976 else if (type == typeof(System.Double)) 989 else if (type == typeof (Double))
977 { 990 {
978 return DbType.Double; 991 return DbType.Double;
979 } 992 }
980 else if (type == typeof(System.Byte[])) 993 else if (type == typeof (Byte[]))
981 { 994 {
982 return DbType.Binary; 995 return DbType.Binary;
983 } 996 }
@@ -991,19 +1004,19 @@ namespace OpenSim.DataStore.MonoSqlite
991 // slightly differently. 1004 // slightly differently.
992 private string sqliteType(Type type) 1005 private string sqliteType(Type type)
993 { 1006 {
994 if (type == typeof(System.String)) 1007 if (type == typeof (String))
995 { 1008 {
996 return "varchar(255)"; 1009 return "varchar(255)";
997 } 1010 }
998 else if (type == typeof(System.Int32)) 1011 else if (type == typeof (Int32))
999 { 1012 {
1000 return "integer"; 1013 return "integer";
1001 } 1014 }
1002 else if (type == typeof(System.Double)) 1015 else if (type == typeof (Double))
1003 { 1016 {
1004 return "float"; 1017 return "float";
1005 } 1018 }
1006 else if (type == typeof(System.Byte[])) 1019 else if (type == typeof (Byte[]))
1007 { 1020 {
1008 return "blob"; 1021 return "blob";
1009 } 1022 }
@@ -1013,4 +1026,4 @@ namespace OpenSim.DataStore.MonoSqlite
1013 } 1026 }
1014 } 1027 }
1015 } 1028 }
1016} 1029} \ No newline at end of file