diff options
Diffstat (limited to 'OpenSim/Region/Storage')
3 files changed, 172 insertions, 167 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 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Data; | 31 | using System.Data; |
32 | using System.IO; | ||
32 | using libsecondlife; | 33 | using libsecondlife; |
33 | using Mono.Data.SqliteClient; | 34 | using Mono.Data.SqliteClient; |
34 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.LandManagement; | 38 | using OpenSim.Region.Environment.LandManagement; |
38 | using OpenSim.Region.Environment.Scenes; | 39 | using 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 |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index f726ea2..4e1f71e 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs | |||
@@ -26,21 +26,16 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | |||
33 | using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenSim.Region.Environment.LandManagement; | ||
35 | using OpenSim.Region.Environment.Interfaces; | ||
36 | using OpenSim.Framework.Console; | ||
37 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Region.Environment.Interfaces; | ||
32 | using OpenSim.Region.Environment.LandManagement; | ||
33 | using OpenSim.Region.Environment.Scenes; | ||
38 | 34 | ||
39 | namespace OpenSim.DataStore.NullStorage | 35 | namespace OpenSim.DataStore.NullStorage |
40 | { | 36 | { |
41 | public class NullDataStore : IRegionDataStore | 37 | public class NullDataStore : IRegionDataStore |
42 | { | 38 | { |
43 | |||
44 | public void Initialise(string dbfile, string dbname) | 39 | public void Initialise(string dbfile, string dbname) |
45 | { | 40 | { |
46 | return; | 41 | return; |
@@ -48,12 +43,10 @@ namespace OpenSim.DataStore.NullStorage | |||
48 | 43 | ||
49 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) | 44 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) |
50 | { | 45 | { |
51 | |||
52 | } | 46 | } |
53 | 47 | ||
54 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) | 48 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) |
55 | { | 49 | { |
56 | |||
57 | } | 50 | } |
58 | 51 | ||
59 | public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) | 52 | public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) |
@@ -63,7 +56,6 @@ namespace OpenSim.DataStore.NullStorage | |||
63 | 56 | ||
64 | public void StoreTerrain(double[,] ter, LLUUID regionID) | 57 | public void StoreTerrain(double[,] ter, LLUUID regionID) |
65 | { | 58 | { |
66 | |||
67 | } | 59 | } |
68 | 60 | ||
69 | public double[,] LoadTerrain(LLUUID regionID) | 61 | public double[,] LoadTerrain(LLUUID regionID) |
@@ -73,12 +65,10 @@ namespace OpenSim.DataStore.NullStorage | |||
73 | 65 | ||
74 | public void RemoveLandObject(uint id) | 66 | public void RemoveLandObject(uint id) |
75 | { | 67 | { |
76 | |||
77 | } | 68 | } |
78 | 69 | ||
79 | public void StoreParcel(Land land) | 70 | public void StoreParcel(Land land) |
80 | { | 71 | { |
81 | |||
82 | } | 72 | } |
83 | 73 | ||
84 | public List<Land> LoadLandObjects() | 74 | public List<Land> LoadLandObjects() |
@@ -88,7 +78,6 @@ namespace OpenSim.DataStore.NullStorage | |||
88 | 78 | ||
89 | public void Shutdown() | 79 | public void Shutdown() |
90 | { | 80 | { |
91 | |||
92 | } | 81 | } |
93 | } | 82 | } |
94 | } | 83 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs index fd86315..7608202 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs | |||
@@ -1,26 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
4 | 3 | ||
5 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 6 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.DataStore.NullStorage")] | 7 | |
9 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.DataStore.NullStorage")] |
10 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
11 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
12 | [assembly: AssemblyProduct("OpenSim.DataStore.NullStorage")] | 11 | [assembly : AssemblyCompany("")] |
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.DataStore.NullStorage")] |
14 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
15 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
16 | 16 | ||
17 | // Setting ComVisible to false makes the types in this assembly not visible | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
18 | // to COM components. If you need to access a type in this assembly from | 18 | // to COM components. If you need to access a type in this assembly from |
19 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
20 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
21 | 22 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("b4a1656d-de22-4080-a970-fd8166acbf16")] | 24 | |
25 | [assembly : Guid("b4a1656d-de22-4080-a970-fd8166acbf16")] | ||
24 | 26 | ||
25 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
26 | // | 28 | // |
@@ -31,5 +33,6 @@ using System.Runtime.InteropServices; | |||
31 | // | 33 | // |
32 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
33 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
34 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||