aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
diff options
context:
space:
mode:
authorMW2007-06-08 16:49:24 +0000
committerMW2007-06-08 16:49:24 +0000
commita8cabbd600f2bf4e3ecd8b48d726f9c1036d9f93 (patch)
treed9c04b9241c67f892285bc2b9fb05b1e70e40576 /OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
parentprebuild.xml should be fixed/updated. (diff)
downloadopensim-SC_OLD-a8cabbd600f2bf4e3ecd8b48d726f9c1036d9f93.zip
opensim-SC_OLD-a8cabbd600f2bf4e3ecd8b48d726f9c1036d9f93.tar.gz
opensim-SC_OLD-a8cabbd600f2bf4e3ecd8b48d726f9c1036d9f93.tar.bz2
opensim-SC_OLD-a8cabbd600f2bf4e3ecd8b48d726f9c1036d9f93.tar.xz
Deleted OpenGridServices folder as the easiest way to reimport the latest version from trunk
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs111
1 files changed, 0 insertions, 111 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
deleted file mode 100644
index 1606765..0000000
--- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
+++ /dev/null
@@ -1,111 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Db4objects.Db4o;
5using OpenGrid.Framework.Data;
6using libsecondlife;
7
8namespace OpenGrid.Framework.Data.DB4o
9{
10 class DB4oGridManager
11 {
12 public Dictionary<LLUUID, SimProfileData> simProfiles = new Dictionary<LLUUID, SimProfileData>();
13 string dbfl;
14
15 public DB4oGridManager(string db4odb)
16 {
17 dbfl = db4odb;
18 IObjectContainer database;
19 database = Db4oFactory.OpenFile(dbfl);
20 IObjectSet result = database.Get(typeof(SimProfileData));
21 foreach(SimProfileData row in result) {
22 simProfiles.Add(row.UUID, row);
23 }
24 database.Close();
25 }
26
27 /// <summary>
28 /// Adds a new profile to the database (Warning: Probably slow.)
29 /// </summary>
30 /// <param name="row">The profile to add</param>
31 /// <returns>Successful?</returns>
32 public bool AddRow(SimProfileData row)
33 {
34 if (simProfiles.ContainsKey(row.UUID))
35 {
36 simProfiles[row.UUID] = row;
37 }
38 else
39 {
40 simProfiles.Add(row.UUID, row);
41 }
42
43 try
44 {
45 IObjectContainer database;
46 database = Db4oFactory.OpenFile(dbfl);
47 database.Set(row);
48 database.Close();
49 return true;
50 }
51 catch (Exception e)
52 {
53 return false;
54 }
55 }
56
57
58 }
59
60 class DB4oUserManager
61 {
62 public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>();
63 string dbfl;
64
65 public DB4oUserManager(string db4odb)
66 {
67 dbfl = db4odb;
68 IObjectContainer database;
69 database = Db4oFactory.OpenFile(dbfl);
70 IObjectSet result = database.Get(typeof(UserProfileData));
71 foreach (UserProfileData row in result)
72 {
73 userProfiles.Add(row.UUID, row);
74 }
75 database.Close();
76 }
77
78 /// <summary>
79 /// Adds a new profile to the database (Warning: Probably slow.)
80 /// </summary>
81 /// <param name="row">The profile to add</param>
82 /// <returns>Successful?</returns>
83 public bool AddRow(UserProfileData row)
84 {
85 Console.WriteLine("adding profile to database" + row.username);
86 if (userProfiles.ContainsKey(row.UUID))
87 {
88 userProfiles[row.UUID] = row;
89 }
90 else
91 {
92 userProfiles.Add(row.UUID, row);
93 }
94
95 try
96 {
97 IObjectContainer database;
98 database = Db4oFactory.OpenFile(dbfl);
99 database.Set(row);
100 database.Close();
101 return true;
102 }
103 catch (Exception e)
104 {
105 return false;
106 }
107 }
108
109
110 }
111}